{ } qjs-modules

sqlite

Source: quickjs-sqlite.c — module exports SQLite3, SQLite3Error, SQLite3Result

SQLite3 client (wraps libsqlite3).

SQLite3

new SQLite3()   // length 1

Methods

MethodArgsDescription
open(filename)1Opens (or creates) a database file.
query(sql)1Runs a query; returns a SQLite3Result.
exec(sql)1Runs a statement without returning rows.
close()0Closes the connection.
escapeString(str)1Escapes a string for safe interpolation.
quoteString(str)1Quotes a string as an SQL literal.
valueString(value)0Renders one value as SQL.
valuesString(values)1Renders a value list as SQL.
insertQuery(table, row)2Builds an INSERT statement.

Properties (read-only)

affectedRows/changes, insertId/lastInsertRowid, totalChanges, errorMessage, errorCode, filename.

Static members

MemberArgsKindDescription
escapeString(str)1functionStatic escaping helper.
quoteString(str)1functionStatic quoting helper.
valueString(value)0functionRenders one value as SQL.

SQLite3Result

A result set; iterable.

MemberArgsKindDescription
fetchRow()0methodFetches the next row as an array.
fetchAssoc()0methodFetches the next row as an object.
fetchField(i)1methodReturns metadata for one field.
fetchFields()0methodReturns metadata for all fields.
reset()0methodResets the statement for re-execution.
eof—getterWhether all rows are consumed.
[Symbol.iterator]0methodRow iteration.

SQLite3Error

Error subclass (name = "SQLite3Error") carrying SQLite error details.

Export list

Generated by utilities/doc-api.js from the sqlite dump of utilities/api-surface.sh: 73 members. Edit the text above this block, not the block.

SQLite3

class, constructible

  • static methods: escapeString(), quoteString(), valueString()
  • static values: BLOB = 4, FLOAT = 2, INTEGER = 1, NULL = 5, OPEN_CREATE = 4, OPEN_FULLMUTEX = 65536, OPEN_MEMORY = 128, OPEN_NOMUTEX = 32768, OPEN_PRIVATECACHE = 262144, OPEN_READONLY = 1, OPEN_READWRITE = 2, OPEN_SHAREDCACHE = 131072, OPEN_URI = 64, RESULT_OBJECT = 1, RESULT_STRING = 2, TEXT = 3
  • methods: close(), escapeString(), exec(), execute(), insertQuery(), open(), query(), quoteString(), valueString(), valuesString()
  • properties: BLOB = 4, FLOAT = 2, INTEGER = 1, NULL = 5, OPEN_CREATE = 4, OPEN_FULLMUTEX = 65536, OPEN_MEMORY = 128, OPEN_NOMUTEX = 32768, OPEN_PRIVATECACHE = 262144, OPEN_READONLY = 1, OPEN_READWRITE = 2, OPEN_SHAREDCACHE = 131072, OPEN_URI = 64, RESULT_OBJECT = 1, RESULT_STRING = 2, TEXT = 3, affectedRows (get), changes (get), errorCode (get), errorMessage (get), filename (get), insertId (get), lastInsertRowid (get), totalChanges (get), [Symbol.toStringTag]

SQLite3Error

class, constructible

  • properties: name, type = 0, [Symbol.toStringTag]

SQLite3Result

class, constructible

  • methods: fetchAssoc(), fetchField(), fetchFields(), fetchRow(), reset(), [Symbol.iterator]()
  • properties: eof (get), numFields (get), numRows (get), [Symbol.toStringTag]