Package namespace
Turso\Doctrine\DBAL
Core classes
| Class | Role |
|---|---|
Driver |
Implements Doctrine DBAL driver. Detects connection mode, creates LibSQL connection, returns DBAL connection wrapper. |
Connection |
Implements Doctrine DBAL connection. Prepares statements, executes queries, manages transactions, quotes strings, exposes native LibSQL connection. |
Statement |
Implements DBAL statement. Binds values, encodes binary params, executes through connection. |
Result |
Implements DBAL result. Supports numeric/associative fetch, row/column counts, free, column names. |
BlobCodec |
Internal transport codec for binary values. |
Exception |
DBAL driver exception wrapper. |
Driver
use Turso\Doctrine\DBAL\Driver;
$params = ['url' => 'database.sqlite', 'driverClass' => Driver::class];
Key behavior:
connect(array $params): ConnectiongetDatabasePlatform(ServerVersionProvider $versionProvider): SQLitePlatformgetExceptionConverter(): ExceptionConverter
Connection modes: memory, local, remote, remote_replica.
Connection
Key methods:
prepare(string $sql): Statementquery(string $sql): Resultexec(string $sql): int|stringexecuteStatement(string $sql, array $parameters): ResultbeginTransaction(),commit(),rollBack()lastInsertId(): int|stringgetNativeConnection(): LibSQLgetServerVersion(): string
Statement
bindValue(int|string $param, mixed $value, ParameterType $type): voidexecute(): Result
Binary values with ParameterType::BINARY are encoded via BlobCodec::encode().
Result
fetchNumeric(),fetchAssociative(),fetchOne()fetchAllNumeric(),fetchAllAssociative(),fetchFirstColumn()rowCount(),columnCount(),getColumnName(int $index)free()
Native LibSQL helpers
Through $conn->getNativeConnection() you can access extension capabilities such as sync(), isOnline(), and getPendingOperationsCount() where supported. These are especially relevant for replica/offline-write modes.