update changes after review
This commit is contained in:
parent
1b83852d0a
commit
27faaffc4e
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2018 amphp
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Amp\Sql;
|
|
||||||
|
|
||||||
use Amp\Promise;
|
|
||||||
|
|
||||||
interface Connector {
|
|
||||||
/**
|
|
||||||
* @param string $connectionString
|
|
||||||
*
|
|
||||||
* @return Promise<Connection>
|
|
||||||
*/
|
|
||||||
public function connect(string $connectionString): Promise;
|
|
||||||
}
|
|
@ -5,7 +5,7 @@ namespace Amp\Sql;
|
|||||||
use Amp\Iterator;
|
use Amp\Iterator;
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface ResultSet extends Iterator {
|
interface ResultSet extends Iterator, Operation {
|
||||||
const FETCH_ARRAY = 0;
|
const FETCH_ARRAY = 0;
|
||||||
const FETCH_ASSOC = 1;
|
const FETCH_ASSOC = 1;
|
||||||
const FETCH_OBJECT = 2;
|
const FETCH_OBJECT = 2;
|
||||||
|
@ -4,55 +4,22 @@ namespace Amp\Sql;
|
|||||||
|
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
|
||||||
interface Transaction extends Operation {
|
interface Transaction extends Executor, Operation {
|
||||||
const UNCOMMITTED = 0;
|
const UNCOMMITTED = 0;
|
||||||
const COMMITTED = 1;
|
const COMMITTED = 1;
|
||||||
const REPEATABLE = 2;
|
const REPEATABLE = 2;
|
||||||
const SERIALIZABLE = 4;
|
const SERIALIZABLE = 4;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* Closes and commits all changes in the transaction.
|
|
||||||
*/
|
|
||||||
public function close();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getIsolationLevel(): int;
|
public function getIsolationLevel(): int;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function isAlive(): bool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool True if the transaction is active, false if it has been committed or rolled back.
|
* @return bool True if the transaction is active, false if it has been committed or rolled back.
|
||||||
*/
|
*/
|
||||||
public function isActive(): bool;
|
public function isActive(): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* @throws \Amp\Sql\TransactionError If the transaction has been committed or rolled back.
|
|
||||||
*/
|
|
||||||
public function query(string $sql): Promise;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* @throws \Amp\Sql\TransactionError If the transaction has been committed or rolled back.
|
|
||||||
*/
|
|
||||||
public function prepare(string $sql): Promise;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*
|
|
||||||
* @throws \Amp\Sql\TransactionError If the transaction has been committed or rolled back.
|
|
||||||
*/
|
|
||||||
public function execute(string $sql, array $params = []): Promise;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commits the transaction and makes it inactive.
|
* Commits the transaction and makes it inactive.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user