LibSQL Class
Introduction
LibSQL PHP Extension Class
Introduction
The LibSQL PHP Extension facilitates connections to LibSQL databases from PHP applications, offering a range of functionalities to streamline database operations. This documentation provides a detailed overview of the LibSQL class and its methods.
Class Synopsis
class LibSQL
{
// Constants
const OPEN_READONLY = 1;
const OPEN_READWRITE = 2;
const OPEN_CREATE = 4;
// Properties
public $mode;
// Methods
public function __construct(string|array $config, ?int $flags = 6, ?string $encryption_key = "");
public static function version(): string;
public function changes(): int;
public function isAutocommit(): bool;
public function execute(string $stmt, ?array $parameters = []): int;
public function executeBatch(string $stmt): bool;
public function query(string $stmt, ?array $parameters = []): array;
public function transaction(?string $behavior = "DEFERRED"): LibSQLTransaction;
public function prepare(string $sql): LibSQLStatement;
public function close(): void;
public function sync(): void;
}
Table of Contents
__construct(string|array $config, ?int $flags = 6, ?string $encryption_key = "")
: Creates a new LibSQL instance.version(): string
: Retrieves the version of the LibSQL library.changes(): int
: Retrieves the number of rows changed by the last SQL statement.isAutocommit(): bool
: Checks if autocommit mode is enabled for the connection.execute(string $stmt, array $parameters = []): int
: Executes an SQL statement on the database.executeBatch(string $stmt): bool
: Executes a batch of SQL statements on the database.query(string $stmt, array $parameters = []): array
: Executes an SQL query on the database.transaction(string $behavior = "DEFERRED"): LibSQLTransaction
: Initiates a new database transaction.prepare(string $sql): LibSQLStatement
: Prepares an SQL statement for execution.close(): void
: Closes the database connection.sync(): void
: Sync remote replica database.
Was this page helpful?