SQLite๏ƒ

Inherits: Node < Object

Node containing a SQLiteDatabase resource.

Description๏ƒ

Node containing a SQLiteDatabase resource.

Tutorials๏ƒ

Properties๏ƒ

SQLiteDatabase

database

Methods๏ƒ

bool

attach_database(path: String, alias: String)

SQLiteBackup

backup_async(path: String)

bool

backup_to(path: String)

SQLiteQuery

begin_transaction()

void

close()

SQLiteQuery

commit_transaction()

bool

create_aggregate(name: String, argc: int, step_callable: Callable, final_callable: Callable)

bool

create_collation(name: String, callable: Callable)

bool

create_function(name: String, argc: int, callable: Callable)

SQLiteQuery

create_index(index_name: String, table_name: String, columns: Array[String], unique: bool = false)

SQLiteQuery

create_query(query: String, arguments: Array = [])

SQLiteQuery

create_savepoint(name: String)

SQLiteQuery

create_table(table_name: String, columns: Array[SQLiteColumnSchema])

SQLiteQuery

delete_rows(table_name: String, condition: String = "")

bool

deserialize_object(table_name: String, key: String, object: Object)

bool

detach_database(alias: String)

SQLiteQuery

drop_index(index_name: String)

SQLiteQuery

drop_table(table_name: String)

bool

enable_load_extension(enabled: bool)

SQLiteQueryResult

execute_query(query: String, arguments: Array = [])

bool

execute_script(path: String)

String

export_to_json(table_name: String)

int

get_changes() const

Array[SQLiteColumnSchema]

get_columns(table_name: String) const

String

get_database_filename(db_name: String = "main") const

int

get_db_config(op: int) const

int

get_db_status(op: int, reset: bool = false) const

int

get_global_status(op: int, reset: bool) static

int

get_last_error_code() const

String

get_last_error_message() const

int

get_last_insert_rowid() const

int

get_limit(id: int) const

Dictionary

get_tables() const

int

get_total_changes() const

bool

import_from_json(table_name: String, json_string: String)

SQLiteQuery

insert_row(table_name: String, value: Dictionary)

SQLiteQuery

insert_rows(table_name: String, values: Array[Dictionary])

Variant

instantiate_object(table_name: String, key: String)

void

interrupt()

bool

is_autocommit() const

bool

is_readonly(db_name: String = "main") const

bool

load_from(path: String)

SQLiteBlob

open_blob(db_name: String, table_name: String, column_name: String, rowid: int, read_write: bool = false)

int

release_memory(bytes: int) static

SQLiteQuery

release_savepoint(name: String)

SQLiteBackup

restore_async(path: String)

bool

restore_from(path: String)

SQLiteQuery

rollback_to_savepoint(name: String)

SQLiteQuery

rollback_transaction()

SQLiteQuery

select_rows(table_name: String, condition: String = "")

bool

serialize_object(table_name: String, key: String, object: Object)

void

set_authorizer(callable: Callable)

bool

set_busy_timeout(ms: int)

bool

set_db_config(op: int, val: int)

void

set_foreign_keys_enabled(enabled: bool)

int

set_limit(id: int, new_val: int)

void

set_progress_handler(instructions: int)

void

set_soft_heap_limit(bytes: int) static

void

set_trace(enabled: bool)

SQLiteQuery

update_rows(table_name: String, condition: String, value: Dictionary = {})

bool

vacuum()

bool

wal_checkpoint(db_name: String = "main")


Signals๏ƒ

query_progress() ๐Ÿ”—

Emitted periodically while a long-running SQL query is executing.

This can be used to monitor progress or implement cancellation logic during heavy database operations.


row_updated(update_operation: int, db_name: String, table_name: String, rowid: int) ๐Ÿ”—

Emitted whenever a row is inserted, updated, or deleted.

The type of operation is given by update_operation, while db_name and table_name identify the affected database and table.

The modified row is identified by rowid.


transaction_committed() ๐Ÿ”—

Emitted when a database transaction is successfully committed and all changes are permanently applied.


transaction_rolled_back() ๐Ÿ”—

Emitted when a database transaction is rolled back and all uncommitted changes are discarded.


wal_updated(db_name: String, pages_in_wal: int) ๐Ÿ”—

Emitted when the Write-Ahead Logging (WAL) file is updated.

The db_name specifies the database that was modified, and pages_in_wal indicates how many pages are currently stored in the WAL.


Property Descriptions๏ƒ

SQLiteDatabase database ๐Ÿ”—

The underlying SQLiteDatabase resource managed by this node.

It represents the actual SQLite database instance used for executing queries, managing tables, and performing transactions.


Method Descriptions๏ƒ

bool attach_database(path: String, alias: String) ๐Ÿ”—

Attaches an external SQLite database located at path to the current connection using the alias alias.

This allows queries to reference multiple databases within the same connection.


SQLiteBackup backup_async(path: String) ๐Ÿ”—

Creates an asynchronous backup of the current database to path.

Returns a SQLiteBackup object that can be used to monitor progress.


bool backup_to(path: String) ๐Ÿ”—

Creates a full backup of the database and writes it to path.

Returns true if the operation succeeds.


SQLiteQuery begin_transaction() ๐Ÿ”—

Begins a new database transaction.

All subsequent changes will be part of this transaction until committed or rolled back.


void close() ๐Ÿ”—

Closes the database connection and releases all associated resources.


SQLiteQuery commit_transaction() ๐Ÿ”—

Commits the current transaction, permanently applying all changes made during the transaction.


bool create_aggregate(name: String, argc: int, step_callable: Callable, final_callable: Callable) ๐Ÿ”—

Creates a custom aggregate SQL function named name that processes argc arguments using step_callable for iteration and final_callable for final result computation.


bool create_collation(name: String, callable: Callable) ๐Ÿ”—

Creates a custom collation function named name using callable to define string comparison rules.


bool create_function(name: String, argc: int, callable: Callable) ๐Ÿ”—

Creates a custom SQL function named name that takes argc arguments and executes callable.


SQLiteQuery create_index(index_name: String, table_name: String, columns: Array[String], unique: bool = false) ๐Ÿ”—

Creates an index named index_name on table_name using the specified columns.

If unique is true, enforces uniqueness.


SQLiteQuery create_query(query: String, arguments: Array = []) ๐Ÿ”—

Creates a prepared SQL query from query with optional arguments.


SQLiteQuery create_savepoint(name: String) ๐Ÿ”—

Creates a savepoint named name inside the current transaction.


SQLiteQuery create_table(table_name: String, columns: Array[SQLiteColumnSchema]) ๐Ÿ”—

Creates a table named table_name using the provided columns schema definition.


SQLiteQuery delete_rows(table_name: String, condition: String = "") ๐Ÿ”—

Deletes rows from table_name that match the SQL WHERE clause in condition.

If empty, all rows may be affected.


bool deserialize_object(table_name: String, key: String, object: Object) ๐Ÿ”—

Deserializes data stored in table_name under key into object.


bool detach_database(alias: String) ๐Ÿ”—

Detaches a previously attached database identified by alias.


SQLiteQuery drop_index(index_name: String) ๐Ÿ”—

Drops the index named index_name from the database.


SQLiteQuery drop_table(table_name: String) ๐Ÿ”—

Drops the table named table_name from the database.


bool enable_load_extension(enabled: bool) ๐Ÿ”—

Enables or disables SQLite extension loading.


SQLiteQueryResult execute_query(query: String, arguments: Array = []) ๐Ÿ”—

Executes the SQL query with optional arguments and returns the result set.


bool execute_script(path: String) ๐Ÿ”—

Executes an SQL script located at path.


String export_to_json(table_name: String) ๐Ÿ”—

Exports the contents of table_name as a JSON string.


int get_changes() const ๐Ÿ”—

Returns the number of rows affected by the most recent operation.


Array[SQLiteColumnSchema] get_columns(table_name: String) const ๐Ÿ”—

Returns the column schema information for table_name.


String get_database_filename(db_name: String = "main") const ๐Ÿ”—

Returns the filename of the database identified by db_name.


int get_db_config(op: int) const ๐Ÿ”—

Returns the database configuration value identified by op.


int get_db_status(op: int, reset: bool = false) const ๐Ÿ”—

Returns the database status value for op.

If reset is true, the counter is reset.


int get_global_status(op: int, reset: bool) static ๐Ÿ”—

Returns a global SQLite status counter for op.


int get_last_error_code() const ๐Ÿ”—

Returns the last error code produced by the database.


String get_last_error_message() const ๐Ÿ”—

Returns the last error message produced by the database.


int get_last_insert_rowid() const ๐Ÿ”—

Returns the row ID of the last inserted record.


int get_limit(id: int) const ๐Ÿ”—

Returns the SQLite limit value identified by id.


Dictionary get_tables() const ๐Ÿ”—

Returns a dictionary containing all tables in the database and their metadata.


int get_total_changes() const ๐Ÿ”—

Returns the total number of changes made since the connection was opened.


bool import_from_json(table_name: String, json_string: String) ๐Ÿ”—

Imports data into table_name from a JSON string.


SQLiteQuery insert_row(table_name: String, value: Dictionary) ๐Ÿ”—

Inserts a single row into table_name using value as column data.


SQLiteQuery insert_rows(table_name: String, values: Array[Dictionary]) ๐Ÿ”—

Inserts multiple rows into table_name.


Variant instantiate_object(table_name: String, key: String) ๐Ÿ”—

Creates an object instance from database data.


void interrupt() ๐Ÿ”—

Interrupts any running query.


bool is_autocommit() const ๐Ÿ”—

Returns true if the database is in autocommit mode.


bool is_readonly(db_name: String = "main") const ๐Ÿ”—

Returns true if the database db_name is read-only.


bool load_from(path: String) ๐Ÿ”—

Loads a database from path.


SQLiteBlob open_blob(db_name: String, table_name: String, column_name: String, rowid: int, read_write: bool = false) ๐Ÿ”—

Opens a BLOB for direct access.


int release_memory(bytes: int) static ๐Ÿ”—

Releases up to bytes of SQLite internal memory.


SQLiteQuery release_savepoint(name: String) ๐Ÿ”—

Releases the savepoint name.


SQLiteBackup restore_async(path: String) ๐Ÿ”—

Restores a database asynchronously from path.


bool restore_from(path: String) ๐Ÿ”—

Restores the database from path.


SQLiteQuery rollback_to_savepoint(name: String) ๐Ÿ”—

Rolls back to savepoint name.


SQLiteQuery rollback_transaction() ๐Ÿ”—

Rolls back the current transaction.


SQLiteQuery select_rows(table_name: String, condition: String = "") ๐Ÿ”—

Selects rows from table_name matching condition.


bool serialize_object(table_name: String, key: String, object: Object) ๐Ÿ”—

Serializes object into the database.


void set_authorizer(callable: Callable) ๐Ÿ”—

Sets an authorization callback.


bool set_busy_timeout(ms: int) ๐Ÿ”—

Sets the busy timeout to ms milliseconds.


bool set_db_config(op: int, val: int) ๐Ÿ”—

Sets database configuration option op.


void set_foreign_keys_enabled(enabled: bool) ๐Ÿ”—

Enables or disables foreign keys.


int set_limit(id: int, new_val: int) ๐Ÿ”—

Sets a SQLite limit.


void set_progress_handler(instructions: int) ๐Ÿ”—

Sets a progress callback.


void set_soft_heap_limit(bytes: int) static ๐Ÿ”—

Sets SQLite soft heap limit.


void set_trace(enabled: bool) ๐Ÿ”—

Enables or disables SQL tracing.


SQLiteQuery update_rows(table_name: String, condition: String, value: Dictionary = {}) ๐Ÿ”—

Updates rows in table_name matching condition.


bool vacuum() ๐Ÿ”—

Rebuilds the database to reclaim space.


bool wal_checkpoint(db_name: String = "main") ๐Ÿ”—

Performs a WAL checkpoint on db_name.