SQLite3#
- class sqlite3db#
A SQLite3 database connection.
Database connections are created using
eg-overlay.sqlite3open()
.- prepare(sql)#
Prepare the given
sql
statement. An error will be raised if an error occurs during prepartion, otherwise this method returns a newsqlite3stmt
.Note
If the supplied
sql
statement can not be prepared, an error is logged andnil
is returned instead.- Parameters:
sql (
string
)- Return type:
Version History
Version
Notes
0.3.0
Added
- execute(sql)#
A convenience function that prepares, steps, and finalizes a statement for the given
sql
.If the statement returns data it will be returned as a Lua table. If no data is returned but the statement is executed successfully,
true
is returned. If any error occurs, it will be logged and nothing (nil
) is returned.Version History
Version
Notes
0.3.0
Added
- class sqlite3stmt#
- bind(key, value[, blob])#
Set a statement parameter to given value.
key
can be either an integer or a string and must match the parameters specified when this statement was prepared.See SQLite parameters.
Important
Number parameters begin at
1
.- Parameters:
key
value
blob (
boolean
) – (Optional) Bind the parameter as a BLOB instead of autodetecting the type.
Version History
Version
Notes
0.3.0
Added
- step()#
Begin or continue execution of this statement.
If the statement returns data, typically a single result row, it will be returned as a Lua table. If the statement successfully completes but no data is returned, true is returned. If an error occurs, it will be logged and nothing (
nil
) is returned.Version History
Version
Notes
0.3.0
Added