* [refac bug #55390] Set errorInfo to PDOException.
This commit is contained in:
@@ -102,10 +102,9 @@ class dbh
|
||||
*/
|
||||
public function sqlError(object $exception)
|
||||
{
|
||||
$sql = $this->sql;
|
||||
$message = $exception->getMessage();
|
||||
$message .= " ,the sql is: '{$sql}'";
|
||||
throw new PDOException($message);
|
||||
$newException = new PDOException($exception->getMessage() . " ,the sql is: '{$this->sql}'");
|
||||
$newException->errorInfo = $exception->errorInfo;
|
||||
throw $newException;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1147,7 +1147,7 @@ class upgradeModel extends model
|
||||
static $mysqlVersion;
|
||||
if($mysqlVersion === null) $mysqlVersion = $this->loadModel('install')->getDatabaseVersion();
|
||||
|
||||
$ignoreCode = array('1050', '1054', '1060', '1091', '1061'); // Get ignore code when execing.
|
||||
$ignoreCode = '|1050|1054|1060|1091|1061|';
|
||||
$sqls = $this->parseToSqls($sqlFile); // Get sqls in the file.
|
||||
foreach($sqls as $sql)
|
||||
{
|
||||
@@ -1177,14 +1177,9 @@ class upgradeModel extends model
|
||||
}
|
||||
catch(PDOException $e)
|
||||
{
|
||||
$message = $e->getMessage();
|
||||
$isIgnore = false;
|
||||
foreach($ignoreCode as $errorCode)
|
||||
{
|
||||
if($isIgnore) break;
|
||||
if(strpos($message, $errorCode) !== false) $isIgnore = true;
|
||||
}
|
||||
if(!$isIgnore) static::$errors[] = $message;
|
||||
$errorInfo = $e->errorInfo;
|
||||
$errorCode = !empty($errorInfo) ? $errorInfo[1] : '';
|
||||
if(strpos($ignoreCode, "|$errorCode|") === false) static::$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user