update changes after review

This commit is contained in:
prolic 2018-06-27 19:57:37 +08:00
parent 1b83852d0a
commit 27faaffc4e
No known key found for this signature in database
GPG Key ID: 29722F9F48E9DE59
4 changed files with 23 additions and 49 deletions

21
LICENSE Normal file
View 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.

View File

@ -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;
}

View File

@ -5,7 +5,7 @@ namespace Amp\Sql;
use Amp\Iterator;
use Amp\Promise;
interface ResultSet extends Iterator {
interface ResultSet extends Iterator, Operation {
const FETCH_ARRAY = 0;
const FETCH_ASSOC = 1;
const FETCH_OBJECT = 2;

View File

@ -4,55 +4,22 @@ namespace Amp\Sql;
use Amp\Promise;
interface Transaction extends Operation {
interface Transaction extends Executor, Operation {
const UNCOMMITTED = 0;
const COMMITTED = 1;
const REPEATABLE = 2;
const SERIALIZABLE = 4;
/**
* {@inheritdoc}
*
* Closes and commits all changes in the transaction.
*/
public function close();
/**
* @return 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.
*/
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.
*