}
// Set any custom settings defined by site config
// (e.g. https://dev.mysql.com/doc/refman/4.1/en/innodb-parameters.html)
- foreach ( $this->sessionVars as $var => $val ) {
+ foreach ( $this->connectionVariables as $var => $val ) {
// Escape strings but not numbers to avoid MySQL complaining
if ( !is_int( $val ) && !is_float( $val ) ) {
$val = $this->addQuotes( $val );
if ( $database !== $this->getDBname() ) {
$sql = 'USE ' . $this->addIdentifierQuotes( $database );
- $ret = $this->doQuery( $sql );
- if ( $ret === false ) {
- $error = $this->lastError();
- $errno = $this->lastErrno();
- $this->reportQueryError( $error, $errno, $sql, __METHOD__ );
+ list( $res, $err, $errno ) =
+ $this->executeQuery( $sql, __METHOD__, self::QUERY_IGNORE_DBO_TRX );
+
+ if ( $res === false ) {
+ $this->reportQueryError( $err, $errno, $sql, __METHOD__ );
+ return false; // unreachable
}
}
* Fetch a result row as an associative and numeric array
*
* @param resource $res Raw result
- * @return array
+ * @return array|false
*/
abstract protected function mysqlFetchArray( $res );
$gtidArg = $this->addQuotes( implode( ',', $gtidsWait ) );
if ( strpos( $gtidArg, ':' ) !== false ) {
// MySQL GTIDs, e.g "source_id:transaction_id"
- $res = $this->doQuery( "SELECT WAIT_FOR_EXECUTED_GTID_SET($gtidArg, $timeout)" );
+ $sql = "SELECT WAIT_FOR_EXECUTED_GTID_SET($gtidArg, $timeout)";
} else {
// MariaDB GTIDs, e.g."domain:server:sequence"
- $res = $this->doQuery( "SELECT MASTER_GTID_WAIT($gtidArg, $timeout)" );
+ $sql = "SELECT MASTER_GTID_WAIT($gtidArg, $timeout)";
}
} else {
// Wait on the binlog coordinates
$encFile = $this->addQuotes( $pos->getLogFile() );
$encPos = intval( $pos->getLogPosition()[$pos::CORD_EVENT] );
- $res = $this->doQuery( "SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)" );
+ $sql = "SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)";
}
+ list( $res, $err ) = $this->executeQuery( $sql, __METHOD__, self::QUERY_IGNORE_DBO_TRX );
$row = $res ? $this->fetchRow( $res ) : false;
if ( !$row ) {
- throw new DBExpectedError( $this, "Replication wait failed: {$this->lastError()}" );
+ throw new DBExpectedError( $this, "Replication wait failed: {$err}" );
}
// Result can be NULL (error), -1 (timeout), or 0+ per the MySQL manual