Merge "Clean up lock name in lock messages in DatabaseMysqlBase"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 21 Sep 2016 21:13:36 +0000 (21:13 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 21 Sep 2016 21:13:36 +0000 (21:13 +0000)
1  2 
includes/libs/rdbms/database/DatabaseMysqlBase.php

@@@ -519,11 -519,6 +519,11 @@@ abstract class DatabaseMysqlBase extend
        }
  
        function tableExists( $table, $fname = __METHOD__ ) {
 +              $table = $this->tableName( $table, 'raw' );
 +              if ( isset( $this->mSessionTempTables[$table] ) ) {
 +                      return true; // already known to exist and won't show in SHOW TABLES anyway
 +              }
 +
                $encLike = $this->buildLike( $table );
  
                return $this->query( "SHOW TABLES $encLike", $fname )->numRows() > 0;
         * @since 1.20
         */
        public function lockIsFree( $lockName, $method ) {
-               $lockName = $this->addQuotes( $this->makeLockName( $lockName ) );
-               $result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method );
+               $encName = $this->addQuotes( $this->makeLockName( $lockName ) );
+               $result = $this->query( "SELECT IS_FREE_LOCK($encName) AS lockstatus", $method );
                $row = $this->fetchObject( $result );
  
                return ( $row->lockstatus == 1 );
         * @return bool
         */
        public function lock( $lockName, $method, $timeout = 5 ) {
-               $lockName = $this->addQuotes( $this->makeLockName( $lockName ) );
-               $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method );
+               $encName = $this->addQuotes( $this->makeLockName( $lockName ) );
+               $result = $this->query( "SELECT GET_LOCK($encName, $timeout) AS lockstatus", $method );
                $row = $this->fetchObject( $result );
  
                if ( $row->lockstatus == 1 ) {
         * @return bool
         */
        public function unlock( $lockName, $method ) {
-               $lockName = $this->addQuotes( $this->makeLockName( $lockName ) );
-               $result = $this->query( "SELECT RELEASE_LOCK($lockName) as lockstatus", $method );
+               $encName = $this->addQuotes( $this->makeLockName( $lockName ) );
+               $result = $this->query( "SELECT RELEASE_LOCK($encName) as lockstatus", $method );
                $row = $this->fetchObject( $result );
  
                if ( $row->lockstatus == 1 ) {