substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
wfProfileOut( __METHOD__ );
- $this->reportConnectionError( $error );
+ return $this->reportConnectionError( $error );
}
if ( $dbName != '' ) {
"from client host " . wfHostname() . "\n" );
wfProfileOut( __METHOD__ );
- $this->reportConnectionError( "Error selecting database $dbName" );
+ return $this->reportConnectionError( "Error selecting database $dbName" );
}
}
wfSuppressWarnings();
$row = mysql_fetch_object( $res );
wfRestoreWarnings();
- if( $this->lastErrno() ) {
+
+ $errno = $this->lastErrno();
+ // Unfortunately, mysql_fetch_object does not reset the last errno.
+ // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
+ // these are the only errors mysql_fetch_object can cause.
+ // See http://dev.mysql.com/doc/refman/5.0/es/mysql-fetch-row.html.
+ if( $errno == 2000 || $errno == 2013 ) {
throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
}
return $row;
wfSuppressWarnings();
$row = mysql_fetch_array( $res );
wfRestoreWarnings();
- if ( $this->lastErrno() ) {
+
+ $errno = $this->lastErrno();
+ // Unfortunately, mysql_fetch_array does not reset the last errno.
+ // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
+ // these are the only errors mysql_fetch_object can cause.
+ // See http://dev.mysql.com/doc/refman/5.0/es/mysql-fetch-row.html.
+ if( $errno == 2000 || $errno == 2013 ) {
throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
}
return $row;
# http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html
$table = $this->tableName( $table );
$index = $this->indexName( $index );
+
$sql = 'SHOW INDEX FROM ' . $table;
$res = $this->query( $sql, $fname );
$result[] = $row;
}
}
-
return empty( $result ) ? false : $result;
}
* @param $delVar string
* @param $joinVar string
* @param $conds array|string
- * @param $fname bool
+ * @param bool|string $fname bool
+ * @throws DBUnexpectedError
* @return bool|ResultWrapper
*/
function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'DatabaseBase::deleteJoin' ) {
}
-/**
- * Legacy support: Database == DatabaseMysql
- *
- * @deprecated in 1.16
- */
-class Database extends DatabaseMysql {}
-
/**
* Utility class.
* @ingroup Database