]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/DatabaseError.php
replace database abstraction DB with PDO
[nominatim.git] / lib / DatabaseError.php
index 2df331bf94698361a0fa72567fb374e003b9c2f2..3a53bc8ffd6f3fc4eed698d343da731a484e21d3 100644 (file)
@@ -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;
         }
     }
 }