Struct Database

An database connection.

struct Database ;

This struct is a reference-counted wrapper around a sqlite3* pointer.

Constructors

NameDescription
this (path, flags) Opens a database connection.

Properties

NameTypeDescription
changes[get] intGets the number of database rows that were changed, inserted or deleted by the most recently executed SQL statement.
errorCode[get] intGets the SQLite error code of the last operation.
handle[get] d2sqlite3.sqlite3.sqlite3*Gets the SQLite internal handle of the database connection.
totalChanges[get] intGets the number of database rows that were changed, inserted or deleted since the database was opened.

Methods

NameDescription
attachedFilePath (database) Gets the path associated with an attached database.
begin () Convenience functions equivalent to an SQL statement.
close () Explicitly closes the database connection.
commit () Convenience functions equivalent to an SQL statement.
config (code, args) Sets a connection configuration option.
createAggregate (name, agg, det) Creates and registers a new aggregate function in the database.
createCollation (name, fun) Creates and registers a collation function in the database.
createFunction (name, fun, det) Creates and registers a new function in the database.
enableLoadExtensions (enable) Enables or disables loading extensions.
execute (sql, args) Executes a single SQL statement and returns the results directly.
interrupt () Interrupts any pending database operations.
isReadOnly (database) Gets the read-only status of an attached database.
lastInsertRowid () Returns the rowid of the last INSERT statement.
loadExtension (path, entryPoint) Loads an extension.
prepare (sql) Prepares (compiles) a single SQL statement and returns it, so that it can be bound to values before execution.
rollback () Convenience functions equivalent to an SQL statement.
run (script, dg) Runs an SQL script that can contain multiple statements.
setCommitHook (commitHook) Registers a delegate of type CommitHookDelegate as the database's commit hook. Any previously set hook is released.
setProfileCallback (profileCallback) Registers a delegate of type ProfileCallbackDelegate as the profile callback.
setProgressHandler (pace, progressHandler) Registers a delegate of type ProgressHandlerDelegate as the progress handler.
setRollbackHook (rollbackHook) Registers a delegate of type RoolbackHookDelegate as the database's rollback hook.
setTraceCallback (traceCallback) Registers a delegate of type TraceCallbackDelegate as the trace callback.
setUpdateHook (updateHook) Registers a delegate of type UpdateHookDelegate as the database's update hook.
tableColumnMetadata (table, column, database) Gets metadata for a specific table column of an attached database.