The SQLITE has a distinguished feature: it works directly on database files. This makes it very simple to manage SQL database by a stand-alone computer and convenient to distribute database. Although the library includes only few functions, they are enough to perform nearly all SQL operations supported by SQLITE.
| Function | Parameter Type | Remark |
| sqlite(filename) | string | Opens the database file and returns a SQLITE object. If the file does not exist, the function tries to create the file. |
| :version() | Returns the SQLITE version as string. | |
| :exec(str) | string | Executes a SQL statement. Returns true if no error or false otherwise. |
| :callback(func) | string | Sets a Z-Script function to handle SQL output. The callback function must handle the first argument as the count of output; the second as the column number of items, and the third as the content string. If the count is 0, the content string is the column names. |
| :error() | Returns the last error message as string. |
load("sqlite.dll");
sql = sqlite("test.sql");
sql:exec("create table mytable(first_name, last_name, address);");
// strings must be qouted
sql:exec("insert into mytable values(\"Jiye\", \"Zeng\", \"123 ABC street\");");
sql:exec("insert into mytable values(\"Georgy\", \"Bush\", \"123 USA street\");");
// numbers can be inserted directly
sql:exec("insert into mytable values(123, 456, \"numerical street\");");
// output to diaplay by default
sql:exec("select * from mytable;");
// control output by callback function
sql:callback("callback");
sql:exec("select * from mytable;");
function callback(row, col, val)
{
csv(row, col, val);
}