* Reverted the public -> protected changes from r90429, except for doQuery() after a review of usage:
** resultObject() is used by lots of things in core and extensions.
** makeSelectOptions() is used by SMW, and if that's going to be public, the other two probably should be too, for consistency.
** doQuery() was used by several things, but mostly by mistake. It's been marked private since r21359 which is before almost all of them. I updated the callers to use query().
* Added "protected" to doQuery() declarations in other database classes.
* @return Array
* @see DatabaseBase::select()
*/
* @return Array
* @see DatabaseBase::select()
*/
- protected function makeSelectOptions( $options ) {
+ function makeSelectOptions( $options ) {
$preLimitTail = $postLimitTail = '';
$startOpts = '';
$preLimitTail = $postLimitTail = '';
$startOpts = '';
* @param $options array
* @return string
*/
* @param $options array
* @return string
*/
- protected function makeInsertOptions( $options ) {
+ function makeInsertOptions( $options ) {
return implode( ' ', $options );
}
return implode( ' ', $options );
}
* @param $options Array: The options passed to DatabaseBase::update
* @return string
*/
* @param $options Array: The options passed to DatabaseBase::update
* @return string
*/
- protected function makeUpdateOptions( $options ) {
+ function makeUpdateOptions( $options ) {
if ( !is_array( $options ) ) {
$options = array( $options );
}
if ( !is_array( $options ) ) {
$options = array( $options );
}
/**
* Take the result from a query, and wrap it in a ResultWrapper if
* necessary. Boolean values are passed through as is, to indicate success
/**
* Take the result from a query, and wrap it in a ResultWrapper if
* necessary. Boolean values are passed through as is, to indicate success
- * of write queries or failure. ResultWrapper objects are also passed
- * through.
+ * of write queries or failure.
+ *
+ * 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.
- protected function resultObject( $result ) {
+ function resultObject( $result ) {
if ( empty( $result ) ) {
return false;
} elseif ( $result instanceof ResultWrapper ) {
if ( empty( $result ) ) {
return false;
} elseif ( $result instanceof ResultWrapper ) {
* The DBMS-dependent part of query()
* @param $sql String: SQL query.
* @return object Result object for fetch functions or false on failure
* The DBMS-dependent part of query()
* @param $sql String: SQL query.
* @return object Result object for fetch functions or false on failure
- /*private*/
- public function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
$this->applySchema();
// Needed to handle any UTF-8 encoding issues in the raw sql
$this->applySchema();
// Needed to handle any UTF-8 encoding issues in the raw sql
- function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
wfDebug( "SQL: [$sql]\n" );
$this->offset = 0;
wfDebug( "SQL: [$sql]\n" );
$this->offset = 0;
- /*private*/ function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
if( $this->bufferResults() ) {
$ret = mysql_query( $sql, $this->mConn );
} else {
if( $this->bufferResults() ) {
$ret = mysql_query( $sql, $this->mConn );
} else {
return $this->mTrxLevel ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS;
}
return $this->mTrxLevel ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS;
}
- function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
wfDebug( "SQL: [$sql]\n" );
if ( !mb_check_encoding( $sql ) ) {
throw new MWException( "SQL encoding is invalid\n$sql" );
wfDebug( "SQL: [$sql]\n" );
if ( !mb_check_encoding( $sql ) ) {
throw new MWException( "SQL encoding is invalid\n$sql" );
- function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
if ( function_exists( 'mb_convert_encoding' ) ) {
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
if ( function_exists( 'mb_convert_encoding' ) ) {
$sql = mb_convert_encoding( $sql, 'UTF-8' );
}
*
* @return ResultWrapper
*/
*
* @return ResultWrapper
*/
- function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
$res = $this->mConn->query( $sql );
if ( $res === false ) {
return false;
$res = $this->mConn->query( $sql );
if ( $res === false ) {
return false;