Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
The fastest and correct module for SQLite3 in Deno
- @db/sqlite
default
Classes
Represents a SQLite3 database connection.
- aggregate(): voidname: string,options: AggregateFunctionOptions
Creates a new user-defined aggregate function.
- autocommit(): boolean
Whether autocommit is enabled. Enabled by default, can be disabled using BEGIN statement.
- backup(): voiddest: Database,name?: string,pages?No documentation available
- changes(): number
Number of rows changed by the last executed statement.
- close(): void
Closes the database connection.
- enableLoadExtension(): booleanNo documentation available
- exec(): numbersql: string,...params: RestBindParameters
Simply executes the SQL statement (supports multiple statements separated by semicolon). Returns the number of changes made by last statement.
- function(): voidname: string,fn: CallableFunction,options?: FunctionOptions
Creates a new user-defined function.
- inTransaction(): boolean
Whether DB is in mid of a transaction
- int64: boolean
Whether to support BigInt columns. False by default, integers larger than 32 bit will be inaccurate.
- lastInsertRowId(): number
Gets last inserted Row ID
- loadExtension(): voidfile: string,entryPoint?: string
Loads an SQLite extension library from the named file.
- open(): boolean
Whether DB connection is open
- openBlob(options: BlobOpenOptions): SQLBlob
Open a Blob for incremental I/O.
- parseJson: boolean
Whether to parse JSON columns as JS objects. True by default.
- path(): string
Path of the database file.
- prepare<T extends object = Record<string, any>>(sql: string): Statement<T>
Creates a new Prepared Statement from the given SQL statement.
- run(): numbersql: string,...params: RestBindParameters
Alias for
exec. - sql<T extends Record<string, any> = Record<string, any>>(): T[]strings: TemplateStringsArray,...parameters: RestBindParameters
Safely execute SQL with parameters using a tagged template
- totalChanges(): number
Number of rows changed since the database connection was opened.
- transaction<T extends () => void>(fn: T): Transaction<T>this: Transaction<T>,...args: any[]
Wraps a callback function in a transaction.
- unsafeConcurrency: booleanNo documentation available
- unsafeHandle(): Deno.PointerValue
Unsafe Raw (pointer) to the sqlite object
Enumerates SQLite3 Blob opened for streamed I/O.
- byteLength(): number
Byte size of the Blob
- close(): void
Close the Blob. It must be called to prevent leaks.
- readSync(): voidoffset: number,p: Uint8Array
Read from the Blob at given offset into a buffer (Uint8Array)
- readable(): ReadableStream<Uint8Array>
Obtains Web Stream for reading the Blob
- writable(): WritableStream<Uint8Array>
Obtains Web Stream for writing to the Blob
- writeSync(): voidoffset: number,p: Uint8Array
Write a buffer (Uint8Array) at given offset in the Blob
- name: stringNo documentation available
Represents a prepared statement.
- all<T extends object = TStatement>(...args: RestBindParameters): T[]
Run the query and return the resulting rows where rows are objects mapping column name to their corresponding values.
- bind(...params: RestBindParameters): this
Bind parameters to the statement. This method can only be called once to set the parameters to be same throughout the statement. You cannot change the parameters after this method is called.
- bindParameterCount(): number
Number of parameters (to be) bound
- bindParameterIndex(name: string): number
Get bind parameter index by name
- bindParameterName(i: number): string
Get bind parameter name by index
- columnNames(): string[]No documentation available
- defaultInt64(): thisNo documentation available
- defaultParseJson(): thisNo documentation available
- disableInt64(): thisNo documentation available
- disableParseJson(): thisNo documentation available
- enableInt64(): thisNo documentation available
- enableParseJson(): thisNo documentation available
- expandedSql(): string
SQL string including bindings
- finalize(): void
Free up the statement object.
- get<T extends object = TStatement>(...params: RestBindParameters): T | undefined
Fetch only first row as an object, if any.
- getRowObject(): () => anyh: Deno.PointerValue,int64: boolean,parseJson: booleanNo documentation available
- int64: booleanNo documentation available
- iter(...params: RestBindParameters): IterableIterator<any>
Iterate over resultant rows from query.
- parseJson: booleanNo documentation available
- readonly(): boolean
Whether this statement doesn't make any direct changes to the DB
- run(...args: RestBindParameters): number
Simply run the query without retrieving any output there may be.
- sql(): string
The SQL string that we passed when creating statement
- toString(): string
Coerces the statement to a string, which in this case is expanded SQL.
- unsafeHandle(): Deno.PointerValue
Unsafe Raw (pointer) to the sqlite object
- value<T extends Array<unknown>>(...params: RestBindParameters): T | undefined
Fetch only first row as an array, if any.
- values<T extends unknown[] = any[]>(...args: RestBindParameters): T[]
Run the query and return the resulting rows where rows are array of columns.
Functions
Whether the given SQL statement is complete.
Interfaces
Options for user-defined aggregate functions.
Various options that can be configured when opening a Blob via Database#openBlob.
Various options that can be configured when opening Database connection.
- create: boolean
Whether to create a new database file at specified path if one does not exist already. By default this is true.
- enableLoadExtension: boolean
Enable or disable extension loading
- flags: number
Raw SQLite C API flags. Specifying this ignores all other options.
- int64: boolean
Whether to support BigInt columns. False by default, integers larger than 32 bit will be inaccurate.
- memory: boolean
Opens an in-memory database.
- parseJson: boolean
Whether to parse JSON columns as JS objects. True by default.
- readonly: boolean
Whether to open database only in read-only mode. By default, this is false.
- unsafeConcurrency: boolean
Apply agressive optimizations that are not possible with concurrent clients.
Options for user-defined functions.
- deterministic: booleanNo documentation available
- directOnly: booleanNo documentation available
- innocuous: booleanNo documentation available
- subtype: booleanNo documentation available
- varargs: booleanNo documentation available
Type Aliases
| string
| symbol
| bigint
| boolean
| null
| undefined
| Date
| Uint8Array
| BindValue[]
| { [key: string]: BindValue; }
Types that can be possibly serialized as SQLite bind values
& { default: Transaction<T>; deferred: Transaction<T>; immediate: Transaction<T>; exclusive: Transaction<T>; database: Database; }
Transaction function created using Database#transaction.
Variables
SQLite source ID string
SQLite version string