Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/libpkgx/vendor/sqlite3@0.10.0/mod.ts>Statement

`import`… but with pkging powers
Very Popular
Latest
class Statement
Re-export
import { Statement } from "https://deno.land/x/libpkgx@v0.20.0/vendor/sqlite3@0.10.0/mod.ts";

Represents a prepared statement.

See Database#prepare for more information.

Constructors

new
Statement(db: Database, sql: string)

Properties

readonly
bindParameterCount: number

Number of parameters (to be) bound

readonly
expandedSql: string

SQL string including bindings

readonly
readonly: boolean

Whether this statement doesn't make any direct changes to the DB

readonly
sql: string

The SQL string that we passed when creating statement

readonly
unsafeHandle: Deno.PointerValue

Unsafe Raw (pointer) to the sqlite object

Methods

all<T extends Record<string, unknown> = Record<string, any>>(...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.

This method is merely just for optimization to avoid binding parameters each time in prepared statement.

bindParameterIndex(name: string): number

Get bind parameter index by name

bindParameterName(i: number): string

Get bind parameter name by index

columnNames(): string[]
finalize(): void

Free up the statement object.

get<T extends Record<string, unknown>>(...params: RestBindParameters): T | undefined

Fetch only first row as an object, if any.

run(...args: RestBindParameters): number

Simply run the query without retrieving any output there may be.

toString(): string

Coerces the statement to a string, which in this case is expanded SQL.

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.

[Symbol.iterator](): IterableIterator<any>

Iterate over resultant rows from query.