substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
wfProfileOut( __METHOD__ );
+
return $this->reportConnectionError( $error );
}
"from client host " . wfHostname() . "\n" );
wfProfileOut( __METHOD__ );
+
return $this->reportConnectionError( "Error selecting database $dbName" );
}
}
$this->mOpened = true;
wfProfileOut( __METHOD__ );
+
return true;
}
if ( $errno == 2000 || $errno == 2013 ) {
throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
}
+
return $row;
}
if ( $errno == 2000 || $errno == 2013 ) {
throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
}
+
return $row;
}
wfSuppressWarnings();
$n = $this->mysqlNumRows( $res );
wfRestoreWarnings();
+
// Unfortunately, mysql_num_rows does not reset the last errno.
// We are not checking for any errors here, since
// these are no errors mysql_num_rows can cause.
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
+
return $this->mysqlNumFields( $res );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
+
return $this->mysqlFieldName( $res, $n );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
+
return $this->mysqlDataSeek( $res, $row );
}
if ( $error ) {
$error .= ' (' . $this->mServer . ')';
}
+
return $error;
}
foreach ( $res as $plan ) {
$rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero
}
+
return $rows;
}
return new MySQLField( $meta );
}
}
+
return false;
}
$result[] = $row;
}
}
+
return empty( $result ) ? false : $result;
}
$this->ping();
$sQuoted = $this->mysqlRealEscapeString( $s );
}
+
return $sQuoted;
}
$this->mOpened = false;
$this->mConn = false;
$this->open( $this->mServer, $this->mUser, $this->mPassword, $this->mDBname );
+
return true;
}
function getLag() {
if ( !is_null( $this->mFakeSlaveLag ) ) {
wfDebug( "getLag: fake slave lagged {$this->mFakeSlaveLag} seconds\n" );
+
return $this->mFakeSlaveLag;
}
$row->State != 'Waiting to reconnect after a failed master event read' &&
$row->State != 'Reconnecting after a failed master event read' &&
$row->State != 'Registering slave on master'
- ) {
+ ) {
# This is it, return the time (except -ve)
if ( $row->Time > 0x7fffffff ) {
return false;
}
}
}
+
return false;
}
if ( !is_null( $this->mFakeSlaveLag ) ) {
$status = parent::masterPosWait( $pos, $timeout );
wfProfileOut( __METHOD__ );
+
return $status;
}
}
wfProfileOut( __METHOD__ );
+
return $status;
}
if ( $row ) {
$pos = isset( $row->Exec_master_log_pos ) ? $row->Exec_master_log_pos : $row->Exec_Master_Log_Pos;
+
return new MySQLMasterPos( $row->Relay_Master_Log_File, $pos );
} else {
return false;
$this->delimiter = $m[1];
$newLine = '';
}
+
return parent::streamStatementEnd( $sql, $newLine );
}
$lockName = $this->addQuotes( $lockName );
$result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method );
$row = $this->fetchObject( $result );
+
return ( $row->lockstatus == 1 );
}
return true;
} else {
wfDebug( __METHOD__ . " failed to acquire lock\n" );
+
return false;
}
}
$lockName = $this->addQuotes( $lockName );
$result = $this->query( "SELECT RELEASE_LOCK($lockName) as lockstatus", $method );
$row = $this->fetchObject( $result );
+
return ( $row->lockstatus == 1 );
}
foreach ( $write as $table ) {
$tbl = $this->tableName( $table ) .
- ( $lowPriority ? ' LOW_PRIORITY' : '' ) .
- ' WRITE';
+ ( $lowPriority ? ' LOW_PRIORITY' : '' ) .
+ ' WRITE';
$items[] = $tbl;
}
foreach ( $read as $table ) {
}
$sql = "LOCK TABLES " . implode( ',', $items );
$this->query( $sql, $method );
+
return true;
}
*/
public function unlockTables( $method ) {
$this->query( "UNLOCK TABLES", $method );
+
return true;
}
*/
function getServerUptime() {
$vars = $this->getMysqlStatus( 'Uptime' );
+
return (int)$vars['Uptime'];
}
if ( !$this->tableExists( $tableName, $fName ) ) {
return false;
}
+
return $this->query( "DROP TABLE IF EXISTS " . $this->tableName( $tableName ), $fName );
}
$vars = parent::getDefaultSchemaVars();
$vars['wgDBTableOptions'] = str_replace( 'TYPE', 'ENGINE', $GLOBALS['wgDBTableOptions'] );
$vars['wgDBTableOptions'] = str_replace( 'CHARSET=mysql4', 'CHARSET=binary', $vars['wgDBTableOptions'] );
+
return $vars;
}
/**
* Lists VIEWs in the database
*
- * @param string $prefix Only show VIEWs with this prefix, eg.
+ * @param string $prefix Only show VIEWs with this prefix, eg.
* unit_test_, or $wgDBprefix. Default: null, would return all views.
- * @param string $fname Name of calling function
+ * @param string $fname Name of calling function
* @return array
* @since 1.22
*/
array_push( $filteredViews, $viewName );
}
}
+
return $filteredViews;
}
public function isView( $name, $prefix = null ) {
return in_array( $name, $this->listViews( $prefix ) );
}
-
}
-
-
/**
* Utility class.
* @ingroup Database
if ( preg_match( '!\.(\d+)/(\d+)$!', (string)$this, $m ) ) {
return array( (int)$m[1], (int)$m[2] );
}
+
return false;
}
function hasReached( MySQLMasterPos $pos ) {
$thisPos = $this->getCoordinates();
$thatPos = $pos->getCoordinates();
+
return ( $thisPos && $thatPos && $thisPos >= $thatPos );
}
}