diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index 7ec884633..3b4c2915b 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -284,7 +284,7 @@ final public function nativeQuery(#[Language('SQL')] string $sql): Result throw $e; } - $res = $this->createResultSet($res ?: new Drivers\NoDataResult(max(0, $this->driver->getAffectedRows()))); + $res = $this->createResultSet($res ?: new Drivers\Dummy\Result(max(0, $this->driver->getAffectedRows()))); if ($event) { $this->onEvent($event->done($res)); } diff --git a/src/Dibi/Drivers/NoDataResult.php b/src/Dibi/Drivers/Dummy/Result.php similarity index 90% rename from src/Dibi/Drivers/NoDataResult.php rename to src/Dibi/Drivers/Dummy/Result.php index b6f7345be..4226ebfa7 100644 --- a/src/Dibi/Drivers/NoDataResult.php +++ b/src/Dibi/Drivers/Dummy/Result.php @@ -7,14 +7,15 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\Dummy; +use Dibi\Drivers; /** * The driver for no result set. */ -class NoDataResult implements Result +class Result implements Drivers\Result { private int $rows; diff --git a/src/Dibi/Drivers/FirebirdResult.php b/src/Dibi/Drivers/Firebird/Result.php similarity index 95% rename from src/Dibi/Drivers/FirebirdResult.php rename to src/Dibi/Drivers/Firebird/Result.php index 485d07f9f..b1450467b 100644 --- a/src/Dibi/Drivers/FirebirdResult.php +++ b/src/Dibi/Drivers/Firebird/Result.php @@ -7,16 +7,18 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\Firebird; use Dibi; +use Dibi\Drivers; +use Dibi\Drivers\FirebirdDriver; use Dibi\Helpers; /** * The driver for Firebird/InterBase result set. */ -class FirebirdResult implements Result +class Result implements Drivers\Result { /** @var resource */ private $resultSet; diff --git a/src/Dibi/Drivers/FirebirdDriver.php b/src/Dibi/Drivers/FirebirdDriver.php index 7237e506d..96e5f1515 100644 --- a/src/Dibi/Drivers/FirebirdDriver.php +++ b/src/Dibi/Drivers/FirebirdDriver.php @@ -11,6 +11,7 @@ use Dibi; use Dibi\Drivers\Engines\FirebirdEngine; +use Dibi\Drivers\Firebird\Firebird; use Dibi\Helpers; @@ -210,9 +211,9 @@ public function getReflector(): Engine * Result set driver factory. * @param resource $resource */ - public function createResultDriver($resource): FirebirdResult + public function createResultDriver($resource): Firebird { - return new FirebirdResult($resource); + return new Firebird($resource); } diff --git a/src/Dibi/Drivers/MySqliResult.php b/src/Dibi/Drivers/MySQLi/Result.php similarity index 96% rename from src/Dibi/Drivers/MySqliResult.php rename to src/Dibi/Drivers/MySQLi/Result.php index da66da7d1..21e9beda4 100644 --- a/src/Dibi/Drivers/MySqliResult.php +++ b/src/Dibi/Drivers/MySQLi/Result.php @@ -7,15 +7,16 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\MySQLi; use Dibi; +use Dibi\Drivers; /** * The driver for MySQL result set. */ -class MySqliResult implements Result +class Result implements Drivers\Result { private \mysqli_result $resultSet; private bool $buffered; diff --git a/src/Dibi/Drivers/MySqliDriver.php b/src/Dibi/Drivers/MySqliDriver.php index 125be882c..e2d7a14b0 100644 --- a/src/Dibi/Drivers/MySqliDriver.php +++ b/src/Dibi/Drivers/MySqliDriver.php @@ -11,6 +11,7 @@ use Dibi; use Dibi\Drivers\Engines\MySQLEngine; +use Dibi\Drivers\MySQLi\Result; /** @@ -273,9 +274,9 @@ public function getReflector(): Engine /** * Result set driver factory. */ - public function createResultDriver(\mysqli_result $result): MySqliResult + public function createResultDriver(\mysqli_result $result): Result { - return new MySqliResult($result, $this->buffered); + return new Result($result, $this->buffered); } diff --git a/src/Dibi/Drivers/OracleResult.php b/src/Dibi/Drivers/OCI8/Result.php similarity index 96% rename from src/Dibi/Drivers/OracleResult.php rename to src/Dibi/Drivers/OCI8/Result.php index 3b7c3ddde..fa1d8009f 100644 --- a/src/Dibi/Drivers/OracleResult.php +++ b/src/Dibi/Drivers/OCI8/Result.php @@ -7,15 +7,16 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\OCI8; use Dibi; +use Dibi\Drivers; /** * The driver for Oracle result set. */ -class OracleResult implements Result +class Result implements Drivers\Result { /** @var resource */ private $resultSet; diff --git a/src/Dibi/Drivers/OdbcResult.php b/src/Dibi/Drivers/ODBC/Result.php similarity index 96% rename from src/Dibi/Drivers/OdbcResult.php rename to src/Dibi/Drivers/ODBC/Result.php index ea6a078f2..6fd51999f 100644 --- a/src/Dibi/Drivers/OdbcResult.php +++ b/src/Dibi/Drivers/ODBC/Result.php @@ -7,15 +7,16 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\ODBC; use Dibi; +use Dibi\Drivers; /** * The driver interacting with result set via ODBC connections. */ -class OdbcResult implements Result +class Result implements Drivers\Result { /** @var resource */ private $resultSet; diff --git a/src/Dibi/Drivers/OdbcDriver.php b/src/Dibi/Drivers/OdbcDriver.php index 34d0ef5e4..a51a3e6b9 100644 --- a/src/Dibi/Drivers/OdbcDriver.php +++ b/src/Dibi/Drivers/OdbcDriver.php @@ -11,6 +11,7 @@ use Dibi; use Dibi\Drivers\Engines\ODBCEngine; +use Dibi\Drivers\ODBC\Result; /** @@ -186,9 +187,9 @@ public function getReflector(): Engine * Result set driver factory. * @param resource $resource */ - public function createResultDriver($resource): OdbcResult + public function createResultDriver($resource): Result { - return new OdbcResult($resource); + return new Result($resource); } diff --git a/src/Dibi/Drivers/OracleDriver.php b/src/Dibi/Drivers/OracleDriver.php index 25948d008..ea013e92d 100644 --- a/src/Dibi/Drivers/OracleDriver.php +++ b/src/Dibi/Drivers/OracleDriver.php @@ -11,6 +11,7 @@ use Dibi; use Dibi\Drivers\Engines\OracleEngine; +use Dibi\Drivers\OCI8\Result; /** @@ -200,9 +201,9 @@ public function getReflector(): Engine * Result set driver factory. * @param resource $resource */ - public function createResultDriver($resource): OracleResult + public function createResultDriver($resource): Result { - return new OracleResult($resource); + return new Result($resource); } diff --git a/src/Dibi/Drivers/PdoResult.php b/src/Dibi/Drivers/PDO/Result.php similarity index 96% rename from src/Dibi/Drivers/PdoResult.php rename to src/Dibi/Drivers/PDO/Result.php index cc707c9f7..d263cd084 100644 --- a/src/Dibi/Drivers/PdoResult.php +++ b/src/Dibi/Drivers/PDO/Result.php @@ -7,9 +7,10 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\PDO; use Dibi; +use Dibi\Drivers; use Dibi\Helpers; use PDO; @@ -17,7 +18,7 @@ /** * The driver for PDO result set. */ -class PdoResult implements Result +class Result implements Drivers\Result { private ?\PDOStatement $resultSet; private string $driverName; diff --git a/src/Dibi/Drivers/PdoDriver.php b/src/Dibi/Drivers/PdoDriver.php index 8d1ff2fae..f9e158f92 100644 --- a/src/Dibi/Drivers/PdoDriver.php +++ b/src/Dibi/Drivers/PdoDriver.php @@ -15,6 +15,7 @@ use Dibi\Drivers\Engines\PostgreSQLEngine; use Dibi\Drivers\Engines\SQLiteEngine; use Dibi\Drivers\Engines\SQLServerEngine; +use Dibi\Drivers\PDO\Result; use Dibi\Helpers; use PDO; @@ -195,9 +196,9 @@ public function getReflector(): Engine /** * Result set driver factory. */ - public function createResultDriver(\PDOStatement $result): PdoResult + public function createResultDriver(\PDOStatement $result): Result { - return new PdoResult($result, $this->driverName); + return new Result($result, $this->driverName); } diff --git a/src/Dibi/Drivers/PostgreResult.php b/src/Dibi/Drivers/PgSQL/Result.php similarity index 96% rename from src/Dibi/Drivers/PostgreResult.php rename to src/Dibi/Drivers/PgSQL/Result.php index d5db52d60..9aba75caa 100644 --- a/src/Dibi/Drivers/PostgreResult.php +++ b/src/Dibi/Drivers/PgSQL/Result.php @@ -7,8 +7,9 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\PgSQL; +use Dibi\Drivers; use Dibi\Helpers; use PgSql; @@ -16,7 +17,7 @@ /** * The driver for PostgreSQL result set. */ -class PostgreResult implements Result +class Result implements Drivers\Result { /** @var resource|PgSql\Result */ private $resultSet; diff --git a/src/Dibi/Drivers/PostgreDriver.php b/src/Dibi/Drivers/PostgreDriver.php index b9a30b131..2081ee8e5 100644 --- a/src/Dibi/Drivers/PostgreDriver.php +++ b/src/Dibi/Drivers/PostgreDriver.php @@ -11,6 +11,7 @@ use Dibi; use Dibi\Drivers\Engines\PostgreSQLEngine; +use Dibi\Drivers\PgSQL\Result; use Dibi\Helpers; use PgSql; @@ -246,9 +247,9 @@ public function getReflector(): Engine * Result set driver factory. * @param resource $resource */ - public function createResultDriver($resource): PostgreResult + public function createResultDriver($resource): Result { - return new PostgreResult($resource); + return new Result($resource); } diff --git a/src/Dibi/Drivers/SqlsrvResult.php b/src/Dibi/Drivers/SQLSrv/Result.php similarity index 95% rename from src/Dibi/Drivers/SqlsrvResult.php rename to src/Dibi/Drivers/SQLSrv/Result.php index c9db5063c..e08c4fde6 100644 --- a/src/Dibi/Drivers/SqlsrvResult.php +++ b/src/Dibi/Drivers/SQLSrv/Result.php @@ -7,15 +7,16 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\SQLSrv; use Dibi; +use Dibi\Drivers; /** * The driver for Microsoft SQL Server and SQL Azure result set. */ -class SqlsrvResult implements Result +class Result implements Drivers\Result { /** @var resource */ private $resultSet; diff --git a/src/Dibi/Drivers/SqliteResult.php b/src/Dibi/Drivers/SQLite3/Result.php similarity index 96% rename from src/Dibi/Drivers/SqliteResult.php rename to src/Dibi/Drivers/SQLite3/Result.php index 3cec1dae2..688ea1b15 100644 --- a/src/Dibi/Drivers/SqliteResult.php +++ b/src/Dibi/Drivers/SQLite3/Result.php @@ -7,16 +7,17 @@ declare(strict_types=1); -namespace Dibi\Drivers; +namespace Dibi\Drivers\SQLite3; use Dibi; +use Dibi\Drivers; use Dibi\Helpers; /** * The driver for SQLite result set. */ -class SqliteResult implements Result +class Result implements Drivers\Result { private \SQLite3Result $resultSet; diff --git a/src/Dibi/Drivers/Sqlite3Result.php b/src/Dibi/Drivers/Sqlite3Result.php deleted file mode 100644 index 26cca51b3..000000000 --- a/src/Dibi/Drivers/Sqlite3Result.php +++ /dev/null @@ -1,18 +0,0 @@ -