2016-10-06 02:08:43 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
2017-03-28 04:12:12 +00:00
|
|
|
namespace JKingWeb\Arsse\Db;
|
2016-10-06 02:08:43 +00:00
|
|
|
|
2017-03-02 14:04:04 +00:00
|
|
|
interface Driver {
|
2017-05-07 22:27:16 +00:00
|
|
|
const TR_PEND = 0;
|
|
|
|
const TR_COMMIT = 1;
|
|
|
|
const TR_ROLLBACK = 2;
|
|
|
|
const TR_PEND_COMMIT = -1;
|
|
|
|
const TR_PEND_ROLLBACK = -2;
|
|
|
|
|
2017-03-28 22:50:00 +00:00
|
|
|
function __construct(bool $install = false);
|
2017-02-16 20:29:42 +00:00
|
|
|
// returns a human-friendly name for the driver (for display in installer, for example)
|
|
|
|
static function driverName(): string;
|
|
|
|
// returns the version of the scheme of the opened database; if uninitialized should return 0
|
|
|
|
function schemaVersion(): int;
|
2017-05-06 16:02:27 +00:00
|
|
|
// return a Transaction object
|
|
|
|
function begin(): Transaction;
|
|
|
|
// manually begin a real or synthetic transactions, with real or synthetic nesting
|
2017-05-07 22:27:16 +00:00
|
|
|
function savepointCreate(): int;
|
2017-05-06 16:02:27 +00:00
|
|
|
// manually commit either the latest or all pending nested transactions
|
2017-05-07 22:27:16 +00:00
|
|
|
function savepointRelease(int $index = null): bool;
|
2017-05-06 16:02:27 +00:00
|
|
|
// manually rollback either the latest or all pending nested transactions
|
2017-05-07 22:27:16 +00:00
|
|
|
function savepointUndo(int $index = null): bool;
|
2017-02-16 20:29:42 +00:00
|
|
|
// attempt to advise other processes that they should not attempt to access the database; used during live upgrades
|
|
|
|
function lock(): bool;
|
|
|
|
function unlock(): bool;
|
|
|
|
function isLocked(): bool;
|
|
|
|
// attempt to perform an in-place upgrade of the database schema; this may be a no-op which always throws an exception
|
2017-03-03 03:43:59 +00:00
|
|
|
function schemaUpdate(int $to): bool;
|
2017-02-16 20:29:42 +00:00
|
|
|
// execute one or more unsanitized SQL queries and return an indication of success
|
|
|
|
function exec(string $query): bool;
|
|
|
|
// perform a single unsanitized query and return a result set
|
|
|
|
function query(string $query): Result;
|
|
|
|
// ready a prepared statement for later execution
|
2017-07-07 15:49:54 +00:00
|
|
|
function prepare(string $query, ...$paramType): Statement;
|
|
|
|
function prepareArray(string $query, array $paramTypes): Statement;
|
2016-10-06 02:08:43 +00:00
|
|
|
}
|