Lua SQLite (database) interface

LuaSQLite 3 is a thin wrapper around the public domain SQLite3 database engine.

The lsqlite3 module supports the creation and manipulation of SQLite3 databases. The exported functions are called with prefix sqlite3. However, most sqlite3 functions are called via an object-oriented interface to either database or SQL statement objects.

This documentation does not attempt to describe how SQLite3 itself works, it just describes the Lua binding and the available functions.

For more information about the SQL features supported by SQLite3 and details about the syntax of SQL statements and queries, please see the SQLite3 documentation http://www.sqlite.org/.

Using some of the advanced features (how to use callbacks, for instance) will require some familiarity with the SQLite3 API.

General technique


Numerical error and result codes

The following constants are defined by module sqlite3:

  OK: 0          ERROR: 1       INTERNAL: 2    PERM: 3        ABORT: 4
  BUSY: 5        LOCKED: 6      NOMEM: 7       READONLY: 8    INTERRUPT: 9
  IOERR: 10      CORRUPT: 11    NOTFOUND: 12   FULL: 13       CANTOPEN: 14
  PROTOCOL: 15   EMPTY: 16      SCHEMA: 17     TOOBIG: 18     CONSTRAINT: 19
  MISMATCH: 20   MISUSE: 21     NOLFS: 22      FORMAT: 24     RANGE: 25
  NOTADB: 26     ROW: 100       DONE: 101
For details about their exact meaning please see the SQLite3 documentation http://www.sqlite.org/.

Lua functions

Topics