mirror of
https://github.com/danog/sql.git
synced 2024-11-30 04:29:18 +01:00
A few renames
This commit is contained in:
parent
25cf4d6802
commit
4f5449c828
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class ConnectionException extends FailureException
|
class ConnectionException extends SqlException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ interface Executor extends TransientResource
|
|||||||
/**
|
/**
|
||||||
* @param string $sql SQL query to execute.
|
* @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 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).
|
* @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.
|
* @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 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).
|
* @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 string $sql SQL query to prepare and execute.
|
||||||
* @param mixed[] $params Query parameters.
|
* @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 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).
|
* @throws QueryError If the operation fails due to an error in the query (such as a syntax error).
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Amp\Sql;
|
|
||||||
|
|
||||||
class FailureException extends \Exception
|
|
||||||
{
|
|
||||||
}
|
|
@ -4,12 +4,12 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
class QueryError extends \Error
|
class QueryError extends \Error
|
||||||
{
|
{
|
||||||
protected readonly string $query;
|
public function __construct(
|
||||||
|
string $message,
|
||||||
public function __construct(string $message, string $query = "", \Throwable $previous = null)
|
protected readonly string $query = "",
|
||||||
{
|
?\Throwable $previous = null,
|
||||||
|
) {
|
||||||
parent::__construct($message, 0, $previous);
|
parent::__construct($message, 0, $previous);
|
||||||
$this->query = $query;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getQuery(): string
|
final public function getQuery(): string
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
abstract class ConnectionConfig
|
abstract class SqlConfig
|
||||||
{
|
{
|
||||||
public const KEY_MAP = [
|
public const KEY_MAP = [
|
||||||
'hostname' => 'host',
|
'hostname' => 'host',
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
interface Connector
|
interface SqlConnector
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns a new database connection based on the given configuration.
|
* Returns a new database connection based on the given configuration.
|
||||||
* Implementations may provide further parameters, such as a Cancellation.
|
* Implementations may provide further parameters, such as a Cancellation.
|
||||||
*/
|
*/
|
||||||
public function connect(ConnectionConfig $config): Link;
|
public function connect(SqlConfig $config): Link;
|
||||||
}
|
}
|
7
src/SqlException.php
Normal file
7
src/SqlException.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Amp\Sql;
|
||||||
|
|
||||||
|
class SqlException extends \Exception
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user