The @sqlite module is just a single class @sqlite, which represents a SQLite database.

The version of SQLite compiled into Axiom is 3.33.0, and has the following extensions enabled:

Methods

:new(path) #

Create or open a SQLite database at path.

Parameters

Return

Example

db = sqlite('data.db') print db.schema() #print the schema print db.query('SELECT * FROM entries WHERE rowid = ?',[2]) #print row with rowid=2 :query(sql,args,headers) #

Query the database.

Parameters

Return

Notes

SQLite uses '?' as placeholder to bind arguments to query statements.

Headers only appear if there are 1 or more rows in the result. If there are 0 rows in the result, headers will not appear even if headers is true.

:commit() #

Commit changes to the database.

Notes

This will block until the commit actually happens (unlike Python, which fails if the database is locked and forces you to retry repeatedly).

:last_insert_rowid() #

The the rowid of the last inserted row.

Notes

Every row in every table in SQLite has a implicit nonzero integer autoincrement field called 'rowid', which can be used to uniquely identify a row within a table.

:tables(glob) #

Get all tables matching glob.

Parameters

Return

:schema() #

Get the schema of the database.

Return

Notes

Subsequent modifications ('ALTER TABLE...') are reflected within the schema.

:indices() #

Get just the indices within the database.

Return

Functions

:version() #

Get the version of SQLite used.

Return

Notes

Should return the following value:

'3.33.0 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0alt2'