apply php cs fixes
This commit is contained in:
parent
e20aa137bb
commit
81d163fb66
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
interface CommandResult {
|
interface CommandResult
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows affected by the query.
|
* Returns the number of rows affected by the query.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function affectedRows(): int;
|
public function affectedRows(): int;
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class ConnectionException extends FailureException {
|
class ConnectionException extends FailureException
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Connector {
|
interface Connector
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param ConnectionConfig $config
|
* @param ConnectionConfig $config
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Executor {
|
interface Executor
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $sql SQL query to execute.
|
* @param string $sql SQL query to execute.
|
||||||
*
|
*
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class FailureException extends \Exception {
|
class FailureException extends \Exception
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Link extends Executor {
|
interface Link extends Executor
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Starts a transaction on a single connection.
|
* Starts a transaction on a single connection.
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
interface Operation {
|
interface Operation
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param callable $onDestruct Callback executed when the operation completes or the object is destroyed.
|
* @param callable $onDestruct Callback executed when the operation completes or the object is destroyed.
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Pool extends Link {
|
interface Pool extends Link
|
||||||
|
{
|
||||||
const DEFAULT_MAX_CONNECTIONS = 100;
|
const DEFAULT_MAX_CONNECTIONS = 100;
|
||||||
const DEFAULT_IDLE_TIMEOUT = 60;
|
const DEFAULT_IDLE_TIMEOUT = 60;
|
||||||
|
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class PoolError extends \Error {
|
class PoolError extends \Error
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,25 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class QueryError extends \Error {
|
class QueryError extends \Error
|
||||||
|
{
|
||||||
protected $query = "";
|
protected $query = "";
|
||||||
|
|
||||||
public function __construct(string $message, string $query = "", \Throwable $previous = null) {
|
public function __construct(string $message, string $query = "", \Throwable $previous = null)
|
||||||
|
{
|
||||||
if ($query != "") {
|
if ($query != "") {
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
}
|
}
|
||||||
parent::__construct($message, 0, $previous);
|
parent::__construct($message, 0, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getQuery(): string {
|
final public function getQuery(): string
|
||||||
|
{
|
||||||
return $this->query;
|
return $this->query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString(): string {
|
public function __toString(): string
|
||||||
|
{
|
||||||
if ($this->query == "") {
|
if ($this->query == "") {
|
||||||
return parent::__toString();
|
return parent::__toString();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Statement {
|
interface Statement
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param mixed[] $params
|
* @param mixed[] $params
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,8 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Transaction extends Executor, Operation {
|
interface Transaction extends Executor, Operation
|
||||||
|
{
|
||||||
const ISOLATION_UNCOMMITTED = 0;
|
const ISOLATION_UNCOMMITTED = 0;
|
||||||
const ISOLATION_COMMITTED = 1;
|
const ISOLATION_COMMITTED = 1;
|
||||||
const ISOLATION_REPEATABLE = 2;
|
const ISOLATION_REPEATABLE = 2;
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
namespace Amp\Sql;
|
namespace Amp\Sql;
|
||||||
|
|
||||||
class TransactionError extends \Error {
|
class TransactionError extends \Error
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user