gdDocumentation0.8.0

API reference

GDSQLiteStatement

A SQLite statement prepared once and reused.

Methods

run

run(params: Array = []) -> Dictionary, Err

Execute a write statement and return affected rows.

Parameters

NameTypeDefaultDescription
paramsArray[]Parameter values to bind to a prepared SQL statement.

Return value

Dictionary, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

run_many

run_many(rows: Array) -> Dictionary, Err

Execute a write statement for multiple argument sets.

Parameters

NameTypeDefaultDescription
rowsArrayRequiredRows in input order. Batch database calls use one parameter set per row.

Return value

Dictionary, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

one

one(params: Array = []) -> Variant, Err

Return the first read-only query row.

Return the first row and Err. An empty result returns Err.NOT_FOUND.

Parameters

NameTypeDefaultDescription
paramsArray[]Parameter values to bind to a prepared SQL statement.

Return value

Variant, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

all

all(params: Array = []) -> Array, Err

Return all read-only query rows.

Parameters

NameTypeDefaultDescription
paramsArray[]Parameter values to bind to a prepared SQL statement.

Return value

Array, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

close

close() -> void

Release the prepared statement explicitly.

Parameters

No parameters.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

is_valid

is_valid() -> bool

Check whether both statement and connection are usable.

Parameters

No parameters.

Return value

bool

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.