Example #1
0
 public function testIgnoresOtherPdoExceptions()
 {
     $code = 2002;
     $message = "SQLSTATE[HY000] [2002] Connection reset by peer";
     $pdoException = new \PDOException($message, $code);
     $this->assertFalse(RuntimeException::hasServerGoneAway($pdoException));
 }
Example #2
0
File: Adapter.php Project: phlib/db
 /**
  * @param bool $hasCaughtException
  * @return bool
  */
 protected function doBeginTransaction($hasCaughtException = false)
 {
     try {
         return $this->getConnection()->beginTransaction();
     } catch (\PDOException $exception) {
         if (RuntimeException::hasServerGoneAway($exception) && !$hasCaughtException) {
             $this->reconnect();
             return $this->doBeginTransaction(true);
         }
         throw RuntimeException::createFromException($exception);
     }
 }