rdbms: move assertOpen() call near the top of Database::query
[lhc/web/wiklou.git] / includes / libs / rdbms / database / Database.php
index b395711..d7336c1 100644 (file)
@@ -1061,6 +1061,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) {
                $this->assertTransactionStatus( $sql, $fname );
 
+               # Avoid fatals if close() was called
+               $this->assertOpen();
+
                $priorWritesPending = $this->writesOrCallbacksPending();
                $this->lastQuery = $sql;
 
@@ -1111,9 +1114,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        $this->queryLogger->debug( "{$this->dbName} {$commentedSql}" );
                }
 
-               # Avoid fatals if close() was called
-               $this->assertOpen();
-
                # Send the query to the server and fetch any corresponding errors
                $ret = $this->doProfiledQuery( $sql, $commentedSql, $isNonTempWrite, $fname );
                $lastError = $this->lastError();