Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

SQLiteAccessΒΆ

Inherits: RefCounted < Object

Wrapper class for SQLite databases.

DescriptionΒΆ

A wrapper class that lets you perform SQL statements on an SQLite database file.

For queries that involve arbitrary user input, you should use methods that end in *_with_args, as these protect against SQL injection.

MethodsΒΆ

bool

backup(path: String)

bool

close()

SQLiteQuery

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

int

get_last_error_code() const

String

get_last_error_message() const

bool

open(database: String)

bool

open_buffered(path: String, buffers: PackedByteArray, size: int)

bool

open_in_memory()


Method DescriptionsΒΆ

bool backup(path: String) πŸ”—

Creates a backup of the database at the given path.


bool close() πŸ”—

Closes the database handle.


SQLiteQuery create_query(statement: String, arguments: Array = []) πŸ”—

Creates a new query object.


int get_last_error_code() const πŸ”—

Gets the last error code.


String get_last_error_message() const πŸ”—

Gets the last error message.


bool open(database: String) πŸ”—

Opens the database file at the given path. Returns true if the database was successfully opened, false otherwise.

If the path starts with "res://", it will use open_buffered implicitly.


bool open_buffered(path: String, buffers: PackedByteArray, size: int) πŸ”—

Opens a temporary database with the data in buffer. Used for opening databases stored in res:// or compressed databases. Returns true if the database was opened successfully.

Can be written to, but the changes are NOT saved!


bool open_in_memory() πŸ”—

Opens an in-memory database.