Merge "rdbms: make Database::query() more readable and consistent"
authorKrinkle <krinklemail@gmail.com>
Fri, 15 Mar 2019 01:16:53 +0000 (01:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Mar 2019 01:16:53 +0000 (01:16 +0000)
1  2 
includes/libs/rdbms/database/Database.php
tests/phpunit/includes/db/DatabaseTestHelper.php

@@@ -1277,12 -1288,16 +1287,12 @@@ abstract class Database implements IDat
                $this->affectedRowCount = null;
                $ret = $this->doQuery( $commentedSql );
                $this->affectedRowCount = $this->affectedRows();
 -              if ( $this->profiler ) {
 -                      $this->profiler->profileOut( $queryProf );
 -              }
 +              unset( $ps ); // profile out (if set)
                $queryRuntime = max( microtime( true ) - $startTime, 0.0 );
  
 -              unset( $queryProfSection ); // profile out (if set)
 -
                if ( $ret !== false ) {
                        $this->lastPing = $startTime;
-                       if ( $isWrite && $this->trxLevel ) {
+                       if ( $isEffectiveWrite && $this->trxLevel ) {
                                $this->updateTrxWriteQueryTime( $sql, $queryRuntime, $this->affectedRows() );
                                $this->trxWriteCallers[] = $fname;
                        }