-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
144 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Amp\Sql; | ||
|
||
/** | ||
* @template TConfig of SqlConfig | ||
* @template TResult of SqlResult | ||
* @template TStatement of SqlStatement<TResult> | ||
* @template TTransaction of SqlTransaction | ||
* | ||
* @extends SqlLink<TResult, TStatement, TTransaction> | ||
*/ | ||
interface SqlConnection extends SqlLink | ||
{ | ||
/** | ||
* @return TConfig The configuration used to create this connection. | ||
*/ | ||
public function getConfig(): SqlConfig; | ||
|
||
/** | ||
* @return SqlTransactionIsolation Current transaction isolation used when beginning transactions on this connection. | ||
*/ | ||
public function getTransactionIsolation(): SqlTransactionIsolation; | ||
|
||
/** | ||
* Sets the transaction isolation level for transactions began on this link. | ||
* | ||
* @see SqlLink::beginTransaction() | ||
*/ | ||
public function setTransactionIsolation(SqlTransactionIsolation $isolation): 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
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,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Amp\Sql; | ||
|
||
/** | ||
* @template TResult of SqlResult | ||
* @template TStatement of SqlStatement | ||
*/ | ||
interface SqlExecutor extends SqlTransientResource | ||
{ | ||
/** | ||
* @param string $sql SQL query to execute. | ||
* | ||
* @return TResult | ||
* | ||
* @throws SqlException If the operation fails due to unexpected condition. | ||
* @throws SqlConnectionException If the connection to the database is lost. | ||
* @throws SqlQueryError If the operation fails due to an error in the query (such as a syntax error). | ||
*/ | ||
public function query(string $sql): SqlResult; | ||
|
||
/** | ||
* @param string $sql SQL query to prepare. | ||
* | ||
* @return TStatement | ||
* | ||
* @throws SqlException If the operation fails due to unexpected condition. | ||
* @throws SqlConnectionException If the connection to the database is lost. | ||
* @throws SqlQueryError If the operation fails due to an error in the query (such as a syntax error). | ||
*/ | ||
public function prepare(string $sql): SqlStatement; | ||
|
||
/** | ||
* @param string $sql SQL query to prepare and execute. | ||
* @param array<int, mixed>|array<string, mixed> $params Query parameters. | ||
* | ||
* @return TResult | ||
* | ||
* @throws SqlException If the operation fails due to unexpected condition. | ||
* @throws SqlConnectionException If the connection to the database is lost. | ||
* @throws SqlQueryError If the operation fails due to an error in the query (such as a syntax error). | ||
*/ | ||
public function execute(string $sql, array $params = []): SqlResult; | ||
} |
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,20 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Amp\Sql; | ||
|
||
/** | ||
* @template TResult of SqlResult | ||
* @template TStatement of SqlStatement<TResult> | ||
* @template TTransaction of SqlTransaction | ||
* | ||
* @extends SqlExecutor<TResult, TStatement> | ||
*/ | ||
interface SqlLink extends SqlExecutor | ||
{ | ||
/** | ||
* Starts a transaction, returning an object where all queries are executed on a single connection. | ||
* | ||
* @return TTransaction | ||
*/ | ||
public function beginTransaction(): SqlTransaction; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
namespace Amp\Sql; | ||
|
||
class TransactionError extends \Error | ||
class SqlTransactionError extends \Error | ||
{ | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.