Skip to content

Commit

Permalink
#22 - PersistentPDO renamed to ReconnectingPDO
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbiarda committed Jun 30, 2022
1 parent 053c764 commit 05f6fd7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Engines/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface ConnectionInterface
{
public function isAvailable(): bool;

public function getConnection(): PersistentPDO;
public function getConnection(): ReconnectingPDO;

public function getDSN(): string;

Expand Down
6 changes: 3 additions & 3 deletions src/Engines/ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

trait ConnectionTrait
{
private ?PersistentPDO $connection = null;
private ?ReconnectingPDO $connection = null;

public function getConnection(): PersistentPDO
public function getConnection(): ReconnectingPDO
{
if (!$this->connection) {
$options = [
Expand All @@ -19,7 +19,7 @@ public function getConnection(): PersistentPDO
PDO::ATTR_EMULATE_PREPARES => false
];

$this->connection = new PersistentPDO($this->getDSN(), $this->getUser(), $this->getPassword(), $options);
$this->connection = new ReconnectingPDO($this->getDSN(), $this->getUser(), $this->getPassword(), $options);
}

return $this->connection;
Expand Down
4 changes: 2 additions & 2 deletions src/Engines/MySql/Transformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

use Driver\Commands\CommandInterface;
use Driver\Engines\MySql\Sandbox\Utilities;
use Driver\Engines\PersistentPDO;
use Driver\Engines\ReconnectingPDO;
use Driver\Engines\RemoteConnectionInterface;
use Driver\Pipeline\Environment\EnvironmentInterface;
use Driver\Pipeline\Transport\Status;
Expand Down Expand Up @@ -72,7 +72,7 @@ public function getProperties()
return $this->properties;
}

private function applyTransformationsTo(PersistentPDO $connection, $transformations)
private function applyTransformationsTo(ReconnectingPDO $connection, $transformations)
{
array_walk($transformations, function ($query) use ($connection) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @method array|false pgsqlGetNotify(int $fetchMode = 0, int $timeoutMilliseconds = 0)
* @method int pgsqlGetPid()
*/
class PersistentPDO
class ReconnectingPDO
{
private const MYSQL_GENERAL_ERROR_CODE = 'HY000';
private const SERVER_HAS_GONE_AWAY_ERROR_CODE = 2006;
Expand Down
4 changes: 2 additions & 2 deletions src/System/LocalConnectionLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use DI\Container;
use Driver\Engines\ConnectionInterface;
use Driver\Engines\LocalConnectionInterface;
use Driver\Engines\PersistentPDO;
use Driver\Engines\ReconnectingPDO;

class LocalConnectionLoader implements LocalConnectionInterface
{
Expand All @@ -36,7 +36,7 @@ public function __construct(
$this->container = $container;
}

public function getConnection(): PersistentPDO
public function getConnection(): ReconnectingPDO
{
return $this->get()->getConnection();
}
Expand Down

0 comments on commit 05f6fd7

Please sign in to comment.