protected $mSchema;
protected $mFlags;
protected $mForeign;
- protected $mErrorCount = 0;
protected $mLBInfo = array();
protected $mDefaultBigSelects = null;
protected $mSchemaVars = false;
return $this->mTrxLevel ? $this->mTrxTimestamp : null;
}
- /**
- * Get/set the number of errors logged. Only useful when errors are ignored
- * @param int $count The count to set, or omitted to leave it unchanged.
- * @return int The error count
- */
- public function errorCount( $count = null ) {
- return wfSetVar( $this->mErrorCount, $count );
- }
-
/**
* Get/set the table prefix.
* @param string $prefix The table prefix to set, or omitted to leave it unchanged.
* @throws DBQueryError
*/
public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
- ++$this->mErrorCount;
-
if ( $this->ignoreErrors() || $tempIgnore ) {
wfDebug( "SQL ERROR (ignored): $error\n" );
} else {
$preLimitTail .= $this->makeOrderBy( $options );
// if (isset($options['LIMIT'])) {
- // $tailOpts .= $this->limitResult('', $options['LIMIT'],
- // isset($options['OFFSET']) ? $options['OFFSET']
- // : false);
+ // $tailOpts .= $this->limitResult('', $options['LIMIT'],
+ // isset($options['OFFSET']) ? $options['OFFSET']
+ // : false);
// }
if ( isset( $noKeyOptions['FOR UPDATE'] ) ) {
if ( !$alias || (string)$alias === (string)$name ) {
return $name;
} else {
- return $name . ' AS ' . $alias; //PostgreSQL needs AS
+ return $name . ' AS ' . $alias; // PostgreSQL needs AS
}
}
$retVal = call_user_func_array( $function, $args );
break;
} catch ( DBQueryError $e ) {
- $error = $this->lastError();
- $errno = $this->lastErrno();
- $sql = $this->lastQuery();
if ( $this->wasDeadlock() ) {
// Retry after a randomized delay
usleep( mt_rand( self::DEADLOCK_DELAY_MIN, self::DEADLOCK_DELAY_MAX ) );
* Once upon a time, DatabaseBase::query() returned a bare MySQL result
* resource, and it was necessary to call this function to convert it to
* a wrapper. Nowadays, raw database objects are never exposed to external
- * callers, so this is unnecessary in external code. For compatibility with
- * old code, ResultWrapper objects are passed through unaltered.
+ * callers, so this is unnecessary in external code.
*
- * @param bool|ResultWrapper|resource $result
+ * @param bool|ResultWrapper|resource|object $result
* @return bool|ResultWrapper
*/
- public function resultObject( $result ) {
- if ( empty( $result ) ) {
+ protected function resultObject( $result ) {
+ if ( !$result ) {
return false;
} elseif ( $result instanceof ResultWrapper ) {
return $result;