* @return string
*/
function strencode( $s ) {
- $sQuoted = $this->mysqlRealEscapeString( $s );
-
- if ( $sQuoted === false ) {
- $this->ping();
- $sQuoted = $this->mysqlRealEscapeString( $s );
- }
-
- return $sQuoted;
+ return $this->mysqlRealEscapeString( $s );
}
/**
return strlen( $name ) && $name[0] == '`' && substr( $name, -1, 1 ) == '`';
}
- /**
- * @return bool
- */
- function ping() {
- $ping = $this->mysqlPing();
- if ( $ping ) {
- // Connection was good or lost but reconnected...
- // @note: mysqlnd (php 5.6+) does not support this (PHP bug 52561)
- return true;
- }
-
- // Try a full disconnect/reconnect cycle if ping() failed
+ function reconnect() {
$this->closeConnection();
$this->mOpened = false;
$this->mConn = false;
return true;
}
- /**
- * Ping a server connection or reconnect if there is no connection
- *
- * @return bool
- */
- abstract protected function mysqlPing();
-
function getLag() {
if ( $this->getLagDetectionMethod() === 'pt-heartbeat' ) {
return $this->getLagFromPtHeartbeat();
// Call doQuery() directly, to avoid opening a transaction if DBO_TRX is set
if ( $this->useGTIDs && $pos->gtids ) {
// Wait on the GTID set (MariaDB only)
- $gtidArg = implode( ',', $pos->gtids );
+ $gtidArg = $this->addQuotes( implode( ',', $pos->gtids ) );
$res = $this->doQuery( "SELECT MASTER_GTID_WAIT($gtidArg, $timeout)" );
} else {
// Wait on the binlog coordinates
return $this->lastErrno() == 1205;
}
- /**
- * Determines if the last query error was something that should be dealt
- * with by pinging the connection and reissuing the query
- *
- * @return bool
- */
function wasErrorReissuable() {
return $this->lastErrno() == 2013 || $this->lastErrno() == 2006;
}