SQLExt.pm - A macro to execute SQL statements to external database.

Current version: 00.00.02/2004-05-26

This macro extends SQL.pm macro to execute query to an external database. You can also execute not-returning query like delete, insert and update.

It's forward compatible with SQL macro, so you can write something like this

^SQLExt("select count(*) from users","There are ^0; users on this system.");

 

But you can also write something like this

^SQLExt("select * from table1","^0;-^1;","external_database","db_username","db_password","remote_host");

 

If you have defined some databaseLink, you can use them too like this:

^SQLExt("select * from table1","^0;-^1;",1000)

 

where 1000 is the databaseLinkId.

The complete syntax of this macro is:

^SQLExt($sql_statement,[$format],[$databaseLink])

 

or

^SQLExt($sql_statement,[$format],$db_name,$db_user,$db_pass,[$db_host])

 

where

To install it copy SQLExt-xx.yy.zz.pm into lib/WebGUI/Macro/SQLExt.pm. Then open WebGUI.conf and append

    SQLExt => SQLExt

 

at the end of the macro section. If, as an example, last line is

    u => u_companyUrl

 

replace this with

    u => u_companyUrl, \
      SQLExt => SQLExt