gdDocumentation0.8.0

API reference

GDSQLiteDB

Synchronous connection to the embedded SQLite.

Methods

exec

exec(sql: String, params: Array = []) -> Dictionary, Err

Bind values and execute one SQL statement.

Parameters

NameTypeDefaultDescription
sqlStringRequiredSQL statement; bind external values through the separate parameter array.
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.

query

query(sql: String, params: Array = []) -> Array, Err

Bind values and return read-only SQL rows.

Parameters

NameTypeDefaultDescription
sqlStringRequiredSQL statement; bind external values through the separate parameter array.
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.

prepare

prepare(sql: String) -> GDSQLiteStatement, Err

Create a prepared statement that parses SQL once.

Parameters

NameTypeDefaultDescription
sqlStringRequiredSQL statement; bind external values through the separate parameter array.

Return value

GDSQLiteStatement, 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

Close the connection.

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_open

is_open() -> bool

Check whether the connection is 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.