bBox_ExecuteSQL( filename; sqlQuery {; columnSeparator; rowSeparator; arguments...} )

Parameters:
   filename: name of the database file, or "" for current file
   sqlQuery: a valid SQL expression
   columnSeparator: delimiter to use for columns in output (defaults to tab character)
   rowSeparator: delimiter to use for rows (defaults to newline)
   arguments: zero or more SQL parameters

Result:
   text result of the SQL expression, or "?" if there was an error

Error:
   bBox_LastError ("sql")

Script Step:
   bBox Execute SQL [ Expression; Field Separator; Row Separator; Parameter 1; Parameter 2; Parameter 3; Parameter 4 ]

––––––––––

First appeared in: 0.3

Examples in demo file: 6

Compatibility:   WPE, WebDirect, Ubuntu, Server, macOS, Client

––––––––––

UPDATE , INSERT , and TRUNCATE operations are supported. However, CREATE, DROP, or ALTER statements should also work. There is a known issue where if a record is open on the same table as being queried by SQL the query will take longer than usual.

Note that this can be run from any layout, and even target another (previously opened) file.

An example of a simple expression is below. Since only a SQL expression is expected, we don’t add a semicolon to the end of statement.

Set Variable [ ""; $result; "bBox_ExecuteSQL ("SELECT category,name from EXAMPLE") ]

––––––––––

bBox Functions

bBox Wiki