sqlite
—
access SQLite3 files from Lua
local sqlite = require 'sqlite'
err
= sqlite.initialize()
-
sqlite.shutdown()
-
db,
err = sqlite.open(file [, flags])
-
version
= sqlite.libversion()
-
version
= sqlite.libversion_number()
-
id
= sqlite.sourceid()
-
err
= sqlite.close(db)
-
stmt,
err = sqlite.prepare(db, sql)
-
err
= sqlite.exec(db, sql)
-
err
= sqlite.errcode(db)
-
msg
= sqlite.errmsg(db)
-
res
= sqlite.get_autocommit(db)
-
res
= sqlite.changes(db)
-
err
= sqlite.bind(stmt, pidx, value)
-
count
= sqlite.bind_parameter_count(stmt)
-
pidx
= sqlite.bind_parameter_index(stmt, name)
-
name
= sqlite.bind_parameter_name(stmt, pidx)
-
err
= sqlite.step(stmt)
-
value
= sqlite.column(stmt, cidx)
-
sqlite.reset(stmt)
-
sqlite.clear_bindings(stmt)
-
sqlite.finalize(stmt)
-
name
= sqlite.column_name(stmt, cidx)
-
count
= sqlite.column_count(stmt)
-
The sqlite
Lua binding provides access to SQLite3 files.
err
= sqlite.initialize()
- Initialize the SQLite3 library. Workstation applications using SQLite
normally do not need to invoke this function.
sqlite.shutdown()
- Deallocate any resources that were allocated by
sqlite.initialize
(). Workstation applications
using SQLite normally do not need to invoke this function.
db,
err = sqlite.open(file [, flags])
- Open a database, optionally passing flags. When called without flags, the
database will be opened for reading and writing and it will be created if
it does not yet exist. The following flags are defined:
sqlite.OPEN_READONLY
- The database is opened in read-only mode. If the database does not
already exist, an error is returned.
sqlite.OPEN_READWRITE
- The database is opened for reading and writing if possible, or reading
only if the file is write protected by the operating system. In either
case the database must already exist, otherwise an error is returned.
sqlite.OPEN_CREATE
- The database is opened for reading and writing, and is created if it
does not already exist.
version
= sqlite.libversion()
- Return the SQLite3 library version number as a string.
version
= sqlite.libversion_number()
- Return the SQLite3 library version number as a number.
id
= sqlite.sourceid()
- Return the SQLite3 library source id as a string.
An sqlite
manual appeared in NetBSD
7.0.