Skip to content

Commit

Permalink
Better naming classes with PDO - part 1. (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Apr 5, 2023
1 parent d70a5d3 commit abf1eca
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/CommandPDO.php → src/Command.php
Expand Up @@ -23,7 +23,7 @@
* Implements a database command that can be executed against a PDO (PHP Data Object) database connection for Oracle
* Server.
*/
final class CommandPDO extends AbstractCommandPDO
final class Command extends AbstractCommandPDO
{
public function insertWithReturningPks(string $table, array $columns): bool|array
{
Expand Down
6 changes: 3 additions & 3 deletions src/ConnectionPDO.php → src/Connection.php
Expand Up @@ -21,11 +21,11 @@
*
* @link https://www.php.net/manual/en/ref.pdo-oci.php
*/
final class ConnectionPDO extends AbstractConnectionPDO
final class Connection extends AbstractConnectionPDO
{
public function createCommand(string $sql = null, array $params = []): CommandPDOInterface
{
$command = new CommandPDO($this);
$command = new Command($this);

if ($sql !== null) {
$command->setSql($sql);
Expand All @@ -44,7 +44,7 @@ public function createCommand(string $sql = null, array $params = []): CommandPD

public function createTransaction(): TransactionInterface
{
return new TransactionPDO($this);
return new Transaction($this);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PDODriver.php → src/Driver.php
Expand Up @@ -12,7 +12,7 @@
*
* @see https://www.php.net/manual/en/ref.pdo-oci.php
*/
final class PDODriver extends AbstractPDODriver
final class Driver extends AbstractPDODriver
{
public function createConnection(): PDO
{
Expand Down
2 changes: 1 addition & 1 deletion src/TransactionPDO.php → src/Transaction.php
Expand Up @@ -9,7 +9,7 @@
/**
* Implements the Oracle Server specific transaction.
*/
final class TransactionPDO extends AbstractTransactionPDO
final class Transaction extends AbstractTransactionPDO
{
public function releaseSavepoint(string $name): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/CommandTest.php
Expand Up @@ -11,9 +11,9 @@
use Yiisoft\Db\Exception\InvalidCallException;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Oracle\ConnectionPDO;
use Yiisoft\Db\Oracle\Connection;
use Yiisoft\Db\Oracle\Dsn;
use Yiisoft\Db\Oracle\PDODriver;
use Yiisoft\Db\Oracle\Driver;
use Yiisoft\Db\Oracle\Tests\Support\TestTrait;
use Yiisoft\Db\Query\Query;
use Yiisoft\Db\Schema\SchemaInterface;
Expand Down Expand Up @@ -575,7 +575,7 @@ public function testProfilerData(string $sql = null): void
public function testShowDatabases(): void
{
$dsn = new Dsn('oci', 'localhost');
$db = new ConnectionPDO(new PDODriver($dsn->asString(), 'SYSTEM', 'root'), DbHelper::getSchemaCache());
$db = new Connection(new Driver($dsn->asString(), 'SYSTEM', 'root'), DbHelper::getSchemaCache());

$command = $db->createCommand();

Expand Down
8 changes: 4 additions & 4 deletions tests/Support/TestTrait.php
Expand Up @@ -7,9 +7,9 @@
use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Oracle\ConnectionPDO;
use Yiisoft\Db\Oracle\Connection;
use Yiisoft\Db\Oracle\Dsn;
use Yiisoft\Db\Oracle\PDODriver;
use Yiisoft\Db\Oracle\Driver;
use Yiisoft\Db\Tests\Support\DbHelper;

trait TestTrait
Expand All @@ -22,7 +22,7 @@ trait TestTrait
*/
protected function getConnection(bool $fixture = false): ConnectionPDOInterface
{
$db = new ConnectionPDO(new PDODriver($this->getDsn(), 'system', 'root'), DbHelper::getSchemaCache());
$db = new Connection(new Driver($this->getDsn(), 'system', 'root'), DbHelper::getSchemaCache());

if ($fixture) {
DbHelper::loadFixture($db, __DIR__ . '/Fixture/oci.sql');
Expand All @@ -35,7 +35,7 @@ protected static function getDb(): ConnectionPDOInterface
{
$dsn = (new Dsn('oci', 'localhost', 'XE', '1521', ['charset' => 'AL32UTF8']))->asString();

return new ConnectionPDO(new PDODriver($dsn, 'system', 'root'), DbHelper::getSchemaCache());
return new Connection(new Driver($dsn, 'system', 'root'), DbHelper::getSchemaCache());
}

protected function getDsn(): string
Expand Down

0 comments on commit abf1eca

Please sign in to comment.