Merge "Remove "@author Umherirrender" annotations"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabasePostgres.php
index 57acd01..bdac06c 100644 (file)
@@ -256,7 +256,10 @@ class DatabasePostgres extends Database {
                }
                /* Transaction stays in the ERROR state until rolled back */
                if ( $this->mTrxLevel ) {
-                       $this->rollback( __METHOD__ );
+                       // Throw away the transaction state, then raise the error as normal.
+                       // Note that if this connection is managed by LBFactory, it's already expected
+                       // that the other transactions LBFactory manages will be rolled back.
+                       $this->rollback( __METHOD__, self::FLUSHING_INTERNAL );
                }
                parent::reportQueryError( $error, $errno, $sql, $fname, false );
        }
@@ -1367,6 +1370,13 @@ SQL;
                return false;
        }
 
+       public function serverIsReadOnly() {
+               $res = $this->query( "SHOW default_transaction_read_only", __METHOD__ );
+               $row = $this->fetchObject( $res );
+
+               return $row ? ( strtolower( $row->default_transaction_read_only ) === 'on' ) : false;
+       }
+
        /**
         * @param string $lockName
         * @return string Integer