Database: Avoid internal use of ignoreErrors()
authorKevin Israel <pleasestand@live.com>
Tue, 27 Dec 2016 10:20:30 +0000 (05:20 -0500)
committerKevin Israel <pleasestand@live.com>
Tue, 27 Dec 2016 10:20:30 +0000 (05:20 -0500)
* Use $tempIgnore in DatabaseBase::tableExists() instead of ignoreErrors().
* DatabasePostgres::reportQueryError(), since 419221e4a71b, calls
  ignoreErrors() before and after rollback(). This is probably not effective
  as a recursion guard (reportQueryError() would be called regardless), and
  for suppressing any log entry or exception, it is redundant (doRollback()
  already sets $tempIgnore when calling query()).
* ignoreErrors(), now unused, can be removed in a separate change set.

Change-Id: Iee768abf996ece213146ab8f64a15a2b407a2e5e

includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabasePostgres.php

index b9beac8..69cf1ac 100644 (file)
@@ -1419,9 +1419,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                }
 
                $table = $this->tableName( $table );
-               $old = $this->ignoreErrors( true );
-               $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname );
-               $this->ignoreErrors( $old );
+               $ignoreErrors = true;
+               $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname, $ignoreErrors );
 
                return (bool)$res;
        }
index cd02177..42113b0 100644 (file)
@@ -243,9 +243,7 @@ class DatabasePostgres extends Database {
                }
                /* Transaction stays in the ERROR state until rolled back */
                if ( $this->mTrxLevel ) {
-                       $ignore = $this->ignoreErrors( true );
                        $this->rollback( __METHOD__ );
-                       $this->ignoreErrors( $ignore );
                }
                parent::reportQueryError( $error, $errno, $sql, $fname, false );
        }