X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/388c7f706d43be1e025ac9250b5a068dff3c0a01..bb6c8d45fe688b593caedf359a3c19acfec7dad1:/lib/DatabaseError.php diff --git a/lib/DatabaseError.php b/lib/DatabaseError.php index 2df331bf..3a53bc8f 100644 --- a/lib/DatabaseError.php +++ b/lib/DatabaseError.php @@ -5,10 +5,12 @@ namespace Nominatim; class DatabaseError extends \Exception { - public function __construct($message, $code = 500, Exception $previous = null, $oSql) + public function __construct($message, $code = 500, Exception $previous = null, $oPDOErr, $sSql = null) { parent::__construct($message, $code, $previous); - $this->oSql = $oSql; + // https://secure.php.net/manual/en/class.pdoexception.php + $this->oPDOErr = $oPDOErr; + $this->sSql = $sSql; } public function __toString() @@ -18,15 +20,15 @@ class DatabaseError extends \Exception public function getSqlError() { - return $this->oSql->getMessage(); + return $this->oPDOErr->getMessage(); } public function getSqlDebugDump() { if (CONST_Debug) { - return var_export($this->oSql, true); + return var_export($this->oPDOErr, true); } else { - return $this->oSql->getUserInfo(); + return $this->sSql; } } }