-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dibi\Driver => Dibi\Drivers\Connection Dibi\ResultDriver => Dibi\Drivers\Result Dibi\Reflector => Dibi\Drivers\Engine
- Loading branch information
Showing
40 changed files
with
284 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Dibi, smart database abstraction layer (https://dibiphp.com) | ||
* Copyright (c) 2005 David Grudl (https://davidgrudl.com) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dibi\Drivers; | ||
|
||
use Dibi\DriverException; | ||
use Dibi\Exception; | ||
|
||
|
||
/** | ||
* Database connection driver. | ||
*/ | ||
interface Connection | ||
{ | ||
/** | ||
* Disconnects from a database. | ||
* @throws Exception | ||
*/ | ||
function disconnect(): void; | ||
|
||
/** | ||
* Internal: Executes the SQL query. | ||
* @throws DriverException | ||
*/ | ||
function query(string $sql): ?Result; | ||
|
||
/** | ||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query. | ||
*/ | ||
function getAffectedRows(): ?int; | ||
|
||
/** | ||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query. | ||
*/ | ||
function getInsertId(?string $sequence): ?int; | ||
|
||
/** | ||
* Begins a transaction (if supported). | ||
* @throws DriverException | ||
*/ | ||
function begin(?string $savepoint = null): void; | ||
|
||
/** | ||
* Commits statements in a transaction. | ||
* @throws DriverException | ||
*/ | ||
function commit(?string $savepoint = null): void; | ||
|
||
/** | ||
* Rollback changes in a transaction. | ||
* @throws DriverException | ||
*/ | ||
function rollback(?string $savepoint = null): void; | ||
|
||
/** | ||
* Returns the connection resource. | ||
*/ | ||
function getResource(): mixed; | ||
|
||
/** | ||
* Returns the connection reflector. | ||
*/ | ||
function getReflector(): Engine; | ||
|
||
/** | ||
* Encodes data for use in a SQL statement. | ||
*/ | ||
function escapeText(string $value): string; | ||
|
||
function escapeBinary(string $value): string; | ||
|
||
function escapeIdentifier(string $value): string; | ||
|
||
function escapeBool(bool $value): string; | ||
|
||
function escapeDate(\DateTimeInterface $value): string; | ||
|
||
function escapeDateTime(\DateTimeInterface $value): string; | ||
|
||
function escapeDateInterval(\DateInterval $value): string; | ||
|
||
/** | ||
* Encodes string for use in a LIKE statement. | ||
*/ | ||
function escapeLike(string $value, int $pos): string; | ||
|
||
/** | ||
* Injects LIMIT/OFFSET to the SQL query. | ||
*/ | ||
function applyLimit(string &$sql, ?int $limit, ?int $offset): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Dibi, smart database abstraction layer (https://dibiphp.com) | ||
* Copyright (c) 2005 David Grudl (https://davidgrudl.com) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dibi\Drivers; | ||
|
||
|
||
/** | ||
* Engine-specific behaviors. | ||
*/ | ||
interface Engine | ||
{ | ||
/** | ||
* Returns list of tables. | ||
* @return array of {name [, (bool) view ]} | ||
*/ | ||
function getTables(): array; | ||
|
||
/** | ||
* Returns metadata for all columns in a table. | ||
* @return array of {name, nativetype [, table, fullname, (int) size, (bool) nullable, (mixed) default, (bool) autoincrement, (array) vendor ]} | ||
*/ | ||
function getColumns(string $table): array; | ||
|
||
/** | ||
* Returns metadata for all indexes in a table. | ||
* @return array of {name, (array of names) columns [, (bool) unique, (bool) primary ]} | ||
*/ | ||
function getIndexes(string $table): array; | ||
|
||
/** | ||
* Returns metadata for all foreign keys in a table. | ||
*/ | ||
function getForeignKeys(string $table): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.