The library, which can be found in mako.zip, is loaded as follows:
The sqlutil functions:
Function su.open() creates a database environment object by calling luasql.sqlite() and and then opens the database file by calling env:connect().
Function su.open() returns two values, the database environment object and a database file connection object.
The complete database name is calculated as follows: (path from 1-4 above)/data/(name).sqlite.db
Options can be one of the two strings 'READONLY' or 'NOCREATE'. READONLY opens the connection in read only mode and NOCREATE prevents creation of an SQL database.
Get the database directory (if no argument) or set the database directory, thus overriding the path calculated in step 1-4 in su.open().
Returns true if the database file exists, otherwise false is returned.
Search the database using the provided SQL query and return the first entry found. The first argument is either a connection object or a function that returns env,conn. The database is also automatically closed if the argument is a function.Example:
local a,b,c = su.find(conn,"a,b,c FROM table WHERE a='10' LIMIT 1")
Function su.findt is similar to su.find, except that the return values are saved in the provided table instead of being returned.
Execute the provided SQL query and call the provided callback function "func". The first argument is either a connection object or a function that returns env,conn. The database is also automatically closed if the argument is a function.