Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (75 sloc) 4.16 KB

SQLite : SQLite

Kind: global class

new SQLite(databaseFilename, tableCreateArray, onReady)

Creates and manages an sqlite3 instance.

Param Type Description
databaseFilename string The file name of the SQLITE database file to be used.
tableCreateArray Array.<Object> An array containing the name and SQL create string describing each column
tableCreateArray[].name string Name of the column
tableCreateArray[].columns string SQL describing the content of the row
onReady function Called after the tables have been created.

sqLite.debug : number

Specifies how much will be output to the console. 0 means no output, 3 means verbose output.

Kind: instance property of SQLite

sqLite.onOpenComplete : function

Called after tables have been created.

Kind: instance property of SQLite

sqLite.tables : Array.<Object>

An array containing the name and SQL create string describing each column

Kind: instance property of SQLite

sqLite.close()

Closes the SQLite3 process gracefully. The object can however be reused.

Kind: instance method of SQLite

sqLite.resolveBind(q, params) ⇒ string

Injects values into a query string: ?id for identifier $id for string, #id for number, &id for binary.

Kind: instance method of SQLite

Param Type
q string
params object

sqLite.sql(q, callbackOrParametersObject, [callbackIfParameters])

Runs the specified query and calls a callback when it completes. An optional object may be used to resolve bind parameters.

Kind: instance method of SQLite

Param Type Description
q string Query
callbackOrParametersObject object | function Either the callback or if the query string contains bind parameters, an object used to look up values
[callbackIfParameters] function Callback if bind paramters are used.

sqLite.createTable(name, columns, callback)

Creates a table

Kind: instance method of SQLite

Param Type Description
name string The name of the table
columns string A string containing the SQL Syntax for all columns
callback function Callback to be run upon completion.

sqLite.createTables(tablesArray, callback)

Creates any number of tables and runs the specified callback upon completion.

Kind: instance method of SQLite

Param Type Description
tablesArray Array.<Object> An array containing the name and SQL create string describing each column
tablesArray[].name string Name of the column
tablesArray[].columns string SQL describing the content of the row
callback function