Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Not only error case would reach here, so, check it.
  • Loading branch information
twose authored and sy-records committed May 19, 2021
1 parent b4517c6 commit 1bcc0ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/core/Database/PDOProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ public function __call(string $name, array $arguments)
$n === 0 ||
$this->__object->inTransaction()
) {
$exception = new PDOException($errorInfo[2], $errorInfo[1]);
$exception->errorInfo = $errorInfo;
throw $exception;
/* '00000' means “no error.”, as specified by ANSI SQL and ODBC. */
if (!empty($errorInfo) && $errorInfo[0] !== '00000') {
$exception = new PDOException($errorInfo[2], $errorInfo[1]);
$exception->errorInfo = $errorInfo;
throw $exception;
}
/* no error info, just return false */
break;
}
$this->reconnect();
continue;
Expand Down
6 changes: 4 additions & 2 deletions src/core/Database/PDOStatementProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ public function __call(string $name, array $arguments)
) {
$errorInfo = $this->__object->errorInfo();

// '00000' means “no error.”, as specified by ANSI SQL and ODBC.
if ($errorInfo[0] !== '00000') {
/* '00000' means “no error.”, as specified by ANSI SQL and ODBC. */
if (!empty($errorInfo) && $errorInfo[0] !== '00000') {
$exception = new PDOException($errorInfo[2], $errorInfo[1]);
$exception->errorInfo = $errorInfo;
throw $exception;
}
/* no error info, just return false */
break;
}
if ($this->parent->getRound() === $this->parentRound) {
/* if not equal, parent has reconnected */
Expand Down

0 comments on commit 1bcc0ae

Please sign in to comment.