SQLite module.

Robert Carr

API Reference
Examples

API Reference

The sqlite module allows for manipulation and querying of sqlite databases.

	sqlite = imports.sqlite;
      

The SQLite module provides a selection of status enums, to be used as the return values of functions. For meanings, consult the SQLite C documentation.
sqlite.[OK, ERROR, INTERNAL, PERM ABORT, BUSY,
        LOCKED, NOMEM, READONLY, INTERRUPT, CORRUPT,
        NOTFOUND, FULL, CANTOPEN, PROTOCOL, EMPTY,
        SCHEMA, TOOBIG, CONSTRAINT, MISMATCH, MISUSE,
        NOLFS, AUTH, FORMAT, RANGE, NOTADB, ROW, DONE]
    

new sqlite.Database(filename)

Constructs a new sqlite.Database

filename

The SQLite database to be opened (or constructed if it does not exist

Returns

A new sqlite.Database object, the status property will be one of the SQLite status enums


database.exec(command, callback)

Executes the SQLite command on the given database. If callback is defined, it is called with each table entry from the given command, with a single argument. The argument has properties for each value in the returned table entry.

Keep in mind that, just like in C, it is necessary to sanitize user input in your SQL before passing it to the database.

command

The SQLite command to evaluate

callback

The callback to invoke, should expect one argument and return nothing. optional

Returns

An SQLite status enum representing the result of the operation


database.close()

Closes an SQLite database and syncs