| Syntax |
|
| Documentation | Executes the given sql statement on the database of the current branch by using a transaction in 'read only' mode:
line_begin_token, line_end_token, cell_begin_token, cell_end_token, optional values used to format the table returned as a result of the executed statement. If those tokens are not specified to the function call then the table will not be returned and its entries can be accessed by calling $sqlResultSet. |
| Examples | |
Example 1:
$// creates table, column names and type $sql {create table $get{table1} (firstName varchar, content varchar)} ... table $get{table1} created successfully. $// inserts values into table $sql {insert into $get{table1} values ('jack', 'call again')} ... values inserted successfully. $// selects all from table, query transaction, returns values in a table $sqlQuery {select * from $get{table1}}{<td><b>}{</b></td>}{<tr>}{</tr>} Result: creates table "user2DB" with the column definition "firstName" of type varchar in the first column and "content" of type varchar in the second column inserts value "jack" into the first column and "call again" into the second column executes query from table "userDB2" and returns the result in a table: ... table user2DB created successfully. ... values inserted successfully. jack call again
$sql {create table $get{table1} (firstName varchar, content varchar)} ... table $get{table1} created successfully. $set{i}{0} $while{$less{$get{i}}{4}}
$sql {insert into $get{table1} values ('jack', 'call again')} $set{i}{$inc{$get{i}}} } $sqlQuery {select * from $get{table1}} $while {$sqlResultSet{next}}
$sqlResultSet{getCell}{1} | $sqlResultSet{getCell}{2}<BR> } creates table "user3DB" with the column definition "firstName" of type varchar in the first column and "content" of type varchar in the second column inserts value "jack" into the first column and "call again" into the second column of each row while variable "i" is less than "4" executes query from table "user3DB" and returns the result using the function sqlResultSet: ... table user3DB created successfully. ... values inserted successfully. jack | call again jack | call again jack | call again jack | call |
|
| Group | SQL |
| Minimum required transaction-mode: | READ |
| Required scripting permission of the developer | PERMISSION_FL_EXPERT |
| Minimum parameters | 1 |
| Maximum parameters | 5 |