diff --git a/src/ConnectionException.php b/src/ConnectionException.php index 36ffc29..ae4a73f 100644 --- a/src/ConnectionException.php +++ b/src/ConnectionException.php @@ -2,6 +2,6 @@ namespace Amp\Sql; -class ConnectionException extends FailureException +class ConnectionException extends SqlException { } diff --git a/src/Executor.php b/src/Executor.php index 46cec35..21c9531 100644 --- a/src/Executor.php +++ b/src/Executor.php @@ -7,7 +7,7 @@ interface Executor extends TransientResource /** * @param string $sql SQL query to execute. * - * @throws FailureException If the operation fails due to unexpected condition. + * @throws SqlException If the operation fails due to unexpected condition. * @throws ConnectionException If the connection to the database is lost. * @throws QueryError If the operation fails due to an error in the query (such as a syntax error). */ @@ -16,7 +16,7 @@ interface Executor extends TransientResource /** * @param string $sql SQL query to prepare. * - * @throws FailureException If the operation fails due to unexpected condition. + * @throws SqlException If the operation fails due to unexpected condition. * @throws ConnectionException If the connection to the database is lost. * @throws QueryError If the operation fails due to an error in the query (such as a syntax error). */ @@ -26,7 +26,7 @@ interface Executor extends TransientResource * @param string $sql SQL query to prepare and execute. * @param mixed[] $params Query parameters. * - * @throws FailureException If the operation fails due to unexpected condition. + * @throws SqlException If the operation fails due to unexpected condition. * @throws ConnectionException If the connection to the database is lost. * @throws QueryError If the operation fails due to an error in the query (such as a syntax error). */ diff --git a/src/FailureException.php b/src/FailureException.php deleted file mode 100644 index 9c66413..0000000 --- a/src/FailureException.php +++ /dev/null @@ -1,7 +0,0 @@ -query = $query; } final public function getQuery(): string diff --git a/src/ConnectionConfig.php b/src/SqlConfig.php similarity index 98% rename from src/ConnectionConfig.php rename to src/SqlConfig.php index af82c5a..f4b572b 100644 --- a/src/ConnectionConfig.php +++ b/src/SqlConfig.php @@ -2,7 +2,7 @@ namespace Amp\Sql; -abstract class ConnectionConfig +abstract class SqlConfig { public const KEY_MAP = [ 'hostname' => 'host', diff --git a/src/Connector.php b/src/SqlConnector.php similarity index 71% rename from src/Connector.php rename to src/SqlConnector.php index d8e4af0..ff72d10 100644 --- a/src/Connector.php +++ b/src/SqlConnector.php @@ -2,11 +2,11 @@ namespace Amp\Sql; -interface Connector +interface SqlConnector { /** * Returns a new database connection based on the given configuration. * Implementations may provide further parameters, such as a Cancellation. */ - public function connect(ConnectionConfig $config): Link; + public function connect(SqlConfig $config): Link; } diff --git a/src/SqlException.php b/src/SqlException.php new file mode 100644 index 0000000..c602ed7 --- /dev/null +++ b/src/SqlException.php @@ -0,0 +1,7 @@ +