Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions src/Pdo/PdoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,22 +448,29 @@ public function execute()
$errorMsg = (string) implode(', ', $this->statement->errorInfo());

// Check if the server was disconnected.
if (!$this->connected())
try
{
try
if (!$this->connected())
{
// Attempt to reconnect.
$this->connection = null;
$this->connect();
}
catch (ConnectionFailureException $e)
{
// If connect fails, ignore that exception and throw the normal exception.
throw new ExecutionFailureException($sql, $errorMsg, $errorNum);
}
try
{
// Attempt to reconnect.
$this->connection = null;
$this->connect();
}
catch (ConnectionFailureException $e)
{
// If connect fails, ignore that exception and throw the normal exception.
throw new ExecutionFailureException($sql, $errorMsg, $errorNum);
}

// Since we were able to reconnect, run the query again.
return $this->execute();
// Since we were able to reconnect, run the query again.
return $this->execute();
}
}
catch (\LogicException $e)
{
throw new ExecutionFailureException($sql, $errorMsg, $errorNum, $e);
}

// Throw the normal query exception.
Expand Down Expand Up @@ -557,6 +564,7 @@ public static function isSupported()
* @return boolean True if connected to the database engine.
*
* @since 1.0
* @throws \LogicException
*/
public function connected()
{
Expand All @@ -566,8 +574,9 @@ public function connected()
if ($checkingConnected)
{
// Reset this flag and throw an exception.
$checkingConnected = true;
die('Recursion trying to check if connected.');
$checkingConnected = false;

throw new \LogicException('Recursion trying to check if connected.');
}

// Backup the query state.
Expand Down