SQLite๏
Node containing a SQLiteDatabase resource.
Description๏
Node containing a SQLiteDatabase resource.
Tutorials๏
Properties๏
Methods๏
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 ๐
void set_database(value: SQLiteDatabase)
SQLiteDatabase get_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.
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.
Rebuilds the database to reclaim space.
bool wal_checkpoint(db_name: String = "main") ๐
Performs a WAL checkpoint on db_name.