diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c7a8e0 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/src/Connector.php b/src/Connector.php deleted file mode 100644 index 33354d7..0000000 --- a/src/Connector.php +++ /dev/null @@ -1,14 +0,0 @@ - - */ - public function connect(string $connectionString): Promise; -} diff --git a/src/ResultSet.php b/src/ResultSet.php index 8f14ba7..e70295b 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -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; diff --git a/src/Transaction.php b/src/Transaction.php index 5a800cb..b73da74 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -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. *