Bring reportQueryError back in sync and support the IGNORE option
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 30 Nov 2006 01:00:08 +0000 (01:00 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Thu, 30 Nov 2006 01:00:08 +0000 (01:00 +0000)
includes/DatabasePostgres.php

index 2adc90e..d0963af 100644 (file)
@@ -673,11 +673,21 @@ class DatabasePostgres extends Database {
 
 
        function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
-               $message = "A database error has occurred\n" .
-                       "Query: $sql\n" .
-                       "Function: $fname\n" .
-                       "Error: $errno $error\n";
-               throw new DBUnexpectedError($this, $message);
+               # Ignore errors during error handling to avoid infinite recursion
+               $ignore = $this->ignoreErrors( true );
+               ++$this->mErrorCount;
+
+               if ($ignore || $tempIgnore) {
+                       wfDebug("SQL ERROR (ignored): $error\n");
+                       $this->ignoreErrors( $ignore );
+               }
+               else {
+                       $message = "A database error has occurred\n" .
+                               "Query: $sql\n" .
+                               "Function: $fname\n" .
+                               "Error: $errno $error\n";
+                       throw new DBUnexpectedError($this, $message);
+               }
        }
 
        /**