<iSQL>Tag
<iSQL | [DBNAME="datasource name"] | (From Registry) | |
SQL="SQL Statement" | |||
[LOGIN="uid/pword"] | (From Registry) | ||
[TIMEOUT="# seconds"] | (10) | Ent. Edition | |
[MUTEX="<None|Lock|Unlock|ReadOnly>"] | (None) | Ent. Edition | |
[ALIAS="alias"] | (i_sql) | Pro Edition | |
> |
This tag sets up a query in SQL, but does not generate any output directly. It functions as specifying the query to be made. The iSQLFETCH tag gets each record of the result set. | |
Usage | Commonly used alone with SQL queries that do not generate output (i.e., insert, updates and delete statements). To output multiple result records from a database, use this tag in combination with the iLOOP or iWHILE tag. This tag allows more control in the output from the database than the iHTML tag. If specified, the ALIAS directive can be used to distinguish between multiple queries in effect at once. The syntax of the variables then becomes :<alias>_<column name> where the alias and underscore are inserted into the default syntax. You will be able to use this tag in combination with iHTML tags. But if you use this nested with <iHTML>, make sure you do not use the default alias, since the iHTML tag shares the default alias as its only alias. It is possible to embed an <iHTML> database command within an <iSQL> construct by using an alias on the <iSQL> command. See Chapter 6 for a more in-depth discussion on ALIASing. |
Comments | If the query generates a single result record, the MUTEX directive may be used. This specifies the level of lock to place on the result record. TIMEOUT specifies how long to keep it locked if not unlocked by an UNLOCK. |
Notes | :i_sqlempty only reflects the results of the most recent fetch attempt. |
If there are extra values that need to be passed to the DBMS as part of the connection string, simply append them to the password in a name-value pairing delimited by semi-colons. | |
SQL uses the single quote character (') as a special character. If any content being inserted or updated contains a single quotation mark, it has to be escaped. This is done automatically by the iSQL tag. | |
All default database connections share one connection, since this is the whole point of a held open connection. However, it should be noted that if this is a problem on certain datasources, simply using explicit logins each time will force separate connections. | |
If not using an ALIAS, it is also possible to refer to the columns in the result set by their number as is done with the iHTML command. | |
To get the variable results from a single column result such as count when using a nested query, simply assign a variable to the result |