Demon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/62433
Change subject: Use __METHOD__ for default $fname params to database functions
......................................................................
Use __METHOD__ for default $fname params to database functions
Change-Id: I86cbdeabee9709cde15a6b7bd47a53229c2e3f92
---
M includes/db/Database.php
M includes/db/DatabaseMssql.php
M includes/db/DatabaseMysql.php
M includes/db/DatabaseOracle.php
M includes/db/DatabasePostgres.php
M includes/db/DatabaseSqlite.php
6 files changed, 71 insertions(+), 71 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/33/62433/1
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 9a239ae..3072bfd 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -158,7 +158,7 @@
* @param string $fname Calling function name
* @return Mixed: Database-specific index description class or false if
the index does not exist
*/
- function indexInfo( $table, $index, $fname = 'Database::indexInfo' );
+ function indexInfo( $table, $index, $fname = __METHOD__ );
/**
* Get the number of rows affected by the last write query
@@ -870,7 +870,7 @@
* @return boolean|ResultWrapper. true for a successful write query,
ResultWrapper object
* for a successful read query, or false on failure if $tempIgnore
set
*/
- public function query( $sql, $fname = '', $tempIgnore = false ) {
+ public function query( $sql, $fname = __METHOD__, $tempIgnore = false )
{
$isMaster = !is_null( $this->getLBInfo( 'master' ) );
if ( !Profiler::instance()->isStub() ) {
# generalizeSQL will probably cut down the query to
reasonable
@@ -1147,7 +1147,7 @@
*
* @return bool|mixed The value from the field, or false on failure.
*/
- public function selectField( $table, $var, $cond = '', $fname =
'DatabaseBase::selectField',
+ public function selectField( $table, $var, $cond = '', $fname =
__METHOD__,
$options = array()
) {
if ( !is_array( $options ) ) {
@@ -1438,7 +1438,7 @@
* DBQueryError exception will be thrown, except if the "ignore
errors"
* option was set, in which case false will be returned.
*/
- public function select( $table, $vars, $conds = '', $fname =
'DatabaseBase::select',
+ public function select( $table, $vars, $conds = '', $fname = __METHOD__,
$options = array(), $join_conds = array() ) {
$sql = $this->selectSQLText( $table, $vars, $conds, $fname,
$options, $join_conds );
@@ -1461,7 +1461,7 @@
* @return string SQL query string.
* @see DatabaseBase::select()
*/
- public function selectSQLText( $table, $vars, $conds = '', $fname =
'DatabaseBase::select',
+ public function selectSQLText( $table, $vars, $conds = '', $fname =
__METHOD__,
$options = array(), $join_conds = array() )
{
if ( is_array( $vars ) ) {
@@ -1528,7 +1528,7 @@
*
* @return object|bool
*/
- public function selectRow( $table, $vars, $conds, $fname =
'DatabaseBase::selectRow',
+ public function selectRow( $table, $vars, $conds, $fname = __METHOD__,
$options = array(), $join_conds = array() )
{
$options = (array)$options;
@@ -1569,7 +1569,7 @@
* @return Integer: row count
*/
public function estimateRowCount( $table, $vars = '*', $conds = '',
- $fname = 'DatabaseBase::estimateRowCount', $options = array() )
+ $fname = __METHOD__, $options = array() )
{
$rows = 0;
$res = $this->select( $table, array( 'rowcount' => 'COUNT(*)'
), $conds, $fname, $options );
@@ -1618,7 +1618,7 @@
* @param string $fname calling function name (optional)
* @return Boolean: whether $table has filed $field
*/
- public function fieldExists( $table, $field, $fname =
'DatabaseBase::fieldExists' ) {
+ public function fieldExists( $table, $field, $fname = __METHOD__ ) {
$info = $this->fieldInfo( $table, $field );
return (bool)$info;
@@ -1635,7 +1635,7 @@
*
* @return bool|null
*/
- public function indexExists( $table, $index, $fname =
'DatabaseBase::indexExists' ) {
+ public function indexExists( $table, $index, $fname = __METHOD__ ) {
if ( !$this->tableExists( $table ) ) {
return null;
}
@@ -1740,7 +1740,7 @@
*
* @return bool
*/
- public function insert( $table, $a, $fname = 'DatabaseBase::insert',
$options = array() ) {
+ public function insert( $table, $a, $fname = __METHOD__, $options =
array() ) {
# No rows to insert, easy just return now
if ( !count( $a ) ) {
return true;
@@ -1839,7 +1839,7 @@
* - LOW_PRIORITY: MySQL-specific, see MySQL manual.
* @return Boolean
*/
- function update( $table, $values, $conds, $fname =
'DatabaseBase::update', $options = array() ) {
+ function update( $table, $values, $conds, $fname = __METHOD__, $options
= array() ) {
$table = $this->tableName( $table );
$opts = $this->makeUpdateOptions( $options );
$sql = "UPDATE $opts $table SET " . $this->makeList( $values,
LIST_SET );
@@ -2456,7 +2456,7 @@
* a field name or an array of field names
* @param string $fname Calling function name (use __METHOD__) for
logs/profiling
*/
- public function replace( $table, $uniqueIndexes, $rows, $fname =
'DatabaseBase::replace' ) {
+ public function replace( $table, $uniqueIndexes, $rows, $fname =
__METHOD__ ) {
$quotedTable = $this->tableName( $table );
if ( count( $rows ) == 0 ) {
@@ -2559,7 +2559,7 @@
* @throws DBUnexpectedError
*/
public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar,
$conds,
- $fname = 'DatabaseBase::deleteJoin' )
+ $fname = __METHOD__ )
{
if ( !$conds ) {
throw new DBUnexpectedError( $this,
@@ -2625,7 +2625,7 @@
* @throws DBUnexpectedError
* @return bool|ResultWrapper
*/
- public function delete( $table, $conds, $fname = 'DatabaseBase::delete'
) {
+ public function delete( $table, $conds, $fname = __METHOD__ ) {
if ( !$conds ) {
throw new DBUnexpectedError( $this,
'DatabaseBase::delete() called with no conditions' );
}
@@ -2667,7 +2667,7 @@
* @return ResultWrapper
*/
public function insertSelect( $destTable, $srcTable, $varMap, $conds,
- $fname = 'DatabaseBase::insertSelect',
+ $fname = __METHOD__,
$insertOptions = array(), $selectOptions = array() )
{
$destTable = $this->tableName( $destTable );
@@ -3064,7 +3064,7 @@
*
* @param $fname string
*/
- final public function begin( $fname = 'DatabaseBase::begin' ) {
+ final public function begin( $fname = __METHOD__ ) {
global $wgDebugDBTransactions;
if ( $this->mTrxLevel ) { // implicit commit
@@ -3119,7 +3119,7 @@
* This will silently break any ongoing explicit transaction.
Only set the flush flag if you are sure
* that it is safe to ignore these warnings in your context.
*/
- final public function commit( $fname = 'DatabaseBase::commit', $flush =
'' ) {
+ final public function commit( $fname = __METHOD__, $flush = '' ) {
if ( $flush != 'flush' ) {
if ( !$this->mTrxLevel ) {
wfWarn( "$fname: No transaction to commit,
something got out of sync!" );
@@ -3160,7 +3160,7 @@
*
* @param $fname string
*/
- final public function rollback( $fname = 'DatabaseBase::rollback' ) {
+ final public function rollback( $fname = __METHOD__ ) {
if ( !$this->mTrxLevel ) {
wfWarn( "$fname: No transaction to rollback, something
got out of sync!" );
}
@@ -3198,7 +3198,7 @@
* @return Boolean: true if operation was successful
*/
public function duplicateTableStructure( $oldName, $newName, $temporary
= false,
- $fname = 'DatabaseBase::duplicateTableStructure'
+ $fname = __METHOD__
) {
throw new MWException(
'DatabaseBase::duplicateTableStructure is not
implemented in descendant class' );
@@ -3211,7 +3211,7 @@
* @param string $fname calling function name
* @throws MWException
*/
- function listTables( $prefix = null, $fname =
'DatabaseBase::listTables' ) {
+ function listTables( $prefix = null, $fname = __METHOD__ ) {
throw new MWException( 'DatabaseBase::listTables is not
implemented in descendant class' );
}
@@ -3435,7 +3435,7 @@
* @return bool|string
*/
public function sourceStream( $fp, $lineCallback = false,
$resultCallback = false,
- $fname = 'DatabaseBase::sourceStream', $inputCallback = false )
+ $fname = __METHOD__, $inputCallback = false )
{
$cmd = '';
@@ -3674,7 +3674,7 @@
* @return bool|ResultWrapper
* @since 1.18
*/
- public function dropTable( $tableName, $fName =
'DatabaseBase::dropTable' ) {
+ public function dropTable( $tableName, $fName = __METHOD__ ) {
if ( !$this->tableExists( $tableName, $fName ) ) {
return false;
}
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index da719be..293557f 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -297,7 +297,7 @@
* (e.g. array( 'page'
=> array('LEFT JOIN','page_latest=rev_id') )
* @return Mixed: database result resource (feed to
Database::fetchObject or whatever), or false on failure
*/
- function select( $table, $vars, $conds = '', $fname =
'DatabaseMssql::select', $options = array(), $join_conds = array() )
+ function select( $table, $vars, $conds = '', $fname = __METHOD__,
$options = array(), $join_conds = array() )
{
$sql = $this->selectSQLText( $table, $vars, $conds, $fname,
$options, $join_conds );
if ( isset( $options['EXPLAIN'] ) ) {
@@ -322,7 +322,7 @@
* (e.g. array( 'page' => array('LEFT
JOIN','page_latest=rev_id') )
* @return string, the SQL text
*/
- function selectSQLText( $table, $vars, $conds = '', $fname =
'DatabaseMssql::select', $options = array(), $join_conds = array() ) {
+ function selectSQLText( $table, $vars, $conds = '', $fname =
__METHOD__, $options = array(), $join_conds = array() ) {
if ( isset( $options['EXPLAIN'] ) ) {
unset( $options['EXPLAIN'] );
}
@@ -337,7 +337,7 @@
* Takes same arguments as Database::select()
* @return int
*/
- function estimateRowCount( $table, $vars = '*', $conds = '', $fname =
'DatabaseMssql::estimateRowCount', $options = array() ) {
+ function estimateRowCount( $table, $vars = '*', $conds = '', $fname =
__METHOD__, $options = array() ) {
$options['EXPLAIN'] = true;//
http://msdn2.microsoft.com/en-us/library/aa259203.aspx
$res = $this->select( $table, $vars, $conds, $fname, $options );
@@ -356,7 +356,7 @@
* If errors are explicitly ignored, returns NULL on failure
* @return array|bool|null
*/
- function indexInfo( $table, $index, $fname =
'DatabaseMssql::indexExists' ) {
+ function indexInfo( $table, $index, $fname = __METHOD__ ) {
# This does not return the same info as MYSQL would, but that's
OK because MediaWiki never uses the
# returned value except to check for the existance of indexes.
$sql = "sp_helpindex '" . $table . "'";
@@ -401,7 +401,7 @@
* @throws DBQueryError
* @return bool
*/
- function insert( $table, $arrToInsert, $fname =
'DatabaseMssql::insert', $options = array() ) {
+ function insert( $table, $arrToInsert, $fname = __METHOD__, $options =
array() ) {
# No rows to insert, easy just return now
if ( !count( $arrToInsert ) ) {
return true;
@@ -539,7 +539,7 @@
* @throws DBQueryError
* @return null|ResultWrapper
*/
- function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
'DatabaseMssql::insertSelect',
+ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
__METHOD__,
$insertOptions = array(), $selectOptions = array() ) {
$ret = parent::insertSelect( $destTable, $srcTable, $varMap,
$conds, $fname, $insertOptions, $selectOptions );
@@ -688,7 +688,7 @@
* Query whether a given column exists in the mediawiki schema
* @return bool
*/
- function fieldExists( $table, $field, $fname =
'DatabaseMssql::fieldExists' ) {
+ function fieldExists( $table, $field, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
$res = sqlsrv_query( $this->mConn, "SELECT DATA_TYPE FROM
INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'"
);
@@ -721,7 +721,7 @@
/**
* Begin a transaction, committing any previously open transaction
*/
- protected function doBegin( $fname = 'DatabaseMssql::begin' ) {
+ protected function doBegin( $fname = __METHOD__ ) {
sqlsrv_begin_transaction( $this->mConn );
$this->mTrxLevel = 1;
}
@@ -729,7 +729,7 @@
/**
* End a transaction
*/
- protected function doCommit( $fname = 'DatabaseMssql::commit' ) {
+ protected function doCommit( $fname = __METHOD__ ) {
sqlsrv_commit( $this->mConn );
$this->mTrxLevel = 0;
}
@@ -738,7 +738,7 @@
* Rollback a transaction.
* No-op on non-transactional databases.
*/
- protected function doRollback( $fname = 'DatabaseMssql::rollback' ) {
+ protected function doRollback( $fname = __METHOD__ ) {
sqlsrv_rollback( $this->mConn );
$this->mTrxLevel = 0;
}
diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php
index 4105ee1..d8a3723 100644
--- a/includes/db/DatabaseMysql.php
+++ b/includes/db/DatabaseMysql.php
@@ -348,7 +348,7 @@
* @param $fname string
* @return ResultWrapper
*/
- function replace( $table, $uniqueIndexes, $rows, $fname =
'DatabaseMysql::replace' ) {
+ function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
return $this->nativeReplace( $table, $rows, $fname );
}
@@ -364,7 +364,7 @@
* @param $options string|array
* @return int
*/
- public function estimateRowCount( $table, $vars = '*', $conds = '',
$fname = 'DatabaseMysql::estimateRowCount', $options = array() ) {
+ public function estimateRowCount( $table, $vars = '*', $conds = '',
$fname = __METHOD__, $options = array() ) {
$options['EXPLAIN'] = true;
$res = $this->select( $table, $vars, $conds, $fname, $options );
if ( $res === false ) {
@@ -411,7 +411,7 @@
* @param $fname string
* @return bool|array|null False or null on failure
*/
- function indexInfo( $table, $index, $fname = 'DatabaseMysql::indexInfo'
) {
+ function indexInfo( $table, $index, $fname = __METHOD__ ) {
# SHOW INDEX works in MySQL 3.23.58, but SHOW INDEXES does not.
# SHOW INDEX should work for 3.x and up:
# http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html
@@ -577,12 +577,12 @@
* @return bool|string
*/
function masterPosWait( DBMasterPos $pos, $timeout ) {
- $fname = 'DatabaseBase::masterPosWait';
+ $fname = __METHOD__;
wfProfileIn( $fname );
# Commit any open transactions
if ( $this->mTrxLevel ) {
- $this->commit( __METHOD__ );
+ $this->commit( $fname );
}
if ( !is_null( $this->mFakeSlaveLag ) ) {
@@ -815,7 +815,7 @@
* @throws DBUnexpectedError
* @return bool|ResultWrapper
*/
- function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
$fname = 'DatabaseBase::deleteJoin' ) {
+ function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
$fname = __METHOD__ ) {
if ( !$conds ) {
throw new DBUnexpectedError( $this,
'DatabaseBase::deleteJoin() called with empty $conds' );
}
@@ -885,7 +885,7 @@
* @param $temporary bool
* @param $fname string
*/
- function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = 'DatabaseMysql::duplicateTableStructure' ) {
+ function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = __METHOD__ ) {
$tmp = $temporary ? 'TEMPORARY ' : '';
$newName = $this->addIdentifierQuotes( $newName );
$oldName = $this->addIdentifierQuotes( $oldName );
@@ -900,7 +900,7 @@
* @param string $fname calling function name
* @return array
*/
- function listTables( $prefix = null, $fname =
'DatabaseMysql::listTables' ) {
+ function listTables( $prefix = null, $fname = __METHOD__ ) {
$result = $this->query( "SHOW TABLES", $fname );
$endArray = array();
@@ -922,7 +922,7 @@
* @param $fName string
* @return bool|ResultWrapper
*/
- public function dropTable( $tableName, $fName =
'DatabaseMysql::dropTable' ) {
+ public function dropTable( $tableName, $fName = __METHOD__ ) {
if ( !$this->tableExists( $tableName, $fName ) ) {
return false;
}
diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php
index 34305f7..c197d91 100644
--- a/includes/db/DatabaseOracle.php
+++ b/includes/db/DatabaseOracle.php
@@ -456,15 +456,15 @@
* If errors are explicitly ignored, returns NULL on failure
* @return bool
*/
- function indexInfo( $table, $index, $fname =
'DatabaseOracle::indexExists' ) {
+ function indexInfo( $table, $index, $fname = __METHOD__ ) {
return false;
}
- function indexUnique( $table, $index, $fname =
'DatabaseOracle::indexUnique' ) {
+ function indexUnique( $table, $index, $fname = __METHOD__ ) {
return false;
}
- function insert( $table, $a, $fname = 'DatabaseOracle::insert',
$options = array() ) {
+ function insert( $table, $a, $fname = __METHOD__, $options = array() ) {
if ( !count( $a ) ) {
return true;
}
@@ -624,7 +624,7 @@
oci_free_statement( $stmt );
}
- function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
'DatabaseOracle::insertSelect',
+ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
__METHOD__,
$insertOptions = array(), $selectOptions = array() )
{
$destTable = $this->tableName( $destTable );
@@ -763,7 +763,7 @@
return $this->lastErrno() == 'OCI-00060';
}
- function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = 'DatabaseOracle::duplicateTableStructure' ) {
+ function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = __METHOD__ ) {
$temporary = $temporary ? 'TRUE' : 'FALSE';
$newName = strtoupper( $newName );
@@ -776,7 +776,7 @@
return $this->doQuery( "BEGIN DUPLICATE_TABLE( '$tabName',
'$oldPrefix', '$newPrefix', $temporary ); END;" );
}
- function listTables( $prefix = null, $fname =
'DatabaseOracle::listTables' ) {
+ function listTables( $prefix = null, $fname = __METHOD__ ) {
$listWhere = '';
if ( !empty( $prefix ) ) {
$listWhere = ' AND table_name LIKE \'' . strtoupper(
$prefix ) . '%\'';
@@ -800,7 +800,7 @@
return $endArray;
}
- public function dropTable( $tableName, $fName =
'DatabaseOracle::dropTable' ) {
+ public function dropTable( $tableName, $fName = __METHOD__ ) {
$tableName = $this->tableName( $tableName );
if ( !$this->tableExists( $tableName ) ) {
return false;
@@ -857,7 +857,7 @@
* Query whether a given index exists
* @return bool
*/
- function indexExists( $table, $index, $fname =
'DatabaseOracle::indexExists' ) {
+ function indexExists( $table, $index, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
$table = strtoupper( $this->removeIdentifierQuotes( $table ) );
$index = strtoupper( $index );
@@ -961,12 +961,12 @@
return $this->fieldInfoMulti( $table, $field );
}
- protected function doBegin( $fname = 'DatabaseOracle::begin' ) {
+ protected function doBegin( $fname = __METHOD__ ) {
$this->mTrxLevel = 1;
$this->doQuery( 'SET CONSTRAINTS ALL DEFERRED' );
}
- protected function doCommit( $fname = 'DatabaseOracle::commit' ) {
+ protected function doCommit( $fname = __METHOD__ ) {
if ( $this->mTrxLevel ) {
$ret = oci_commit( $this->mConn );
if ( !$ret ) {
@@ -977,7 +977,7 @@
}
}
- protected function doRollback( $fname = 'DatabaseOracle::rollback' ) {
+ protected function doRollback( $fname = __METHOD__ ) {
if ( $this->mTrxLevel ) {
oci_rollback( $this->mConn );
$this->mTrxLevel = 0;
@@ -987,7 +987,7 @@
/* defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
*/
function sourceStream( $fp, $lineCallback = false, $resultCallback =
false,
- $fname = 'DatabaseOracle::sourceStream', $inputCallback = false
) {
+ $fname = __METHOD__, $inputCallback = false ) {
$cmd = '';
$done = false;
$dollarquote = false;
@@ -1139,7 +1139,7 @@
return $conds2;
}
- function selectRow( $table, $vars, $conds, $fname =
'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) {
+ function selectRow( $table, $vars, $conds, $fname = __METHOD__,
$options = array(), $join_conds = array() ) {
if ( is_array( $conds ) ) {
$conds = $this->wrapConditionsForWhere( $table, $conds
);
}
@@ -1188,7 +1188,7 @@
return array( $startOpts, $useIndex, $preLimitTail,
$postLimitTail );
}
- public function delete( $table, $conds, $fname =
'DatabaseOracle::delete' ) {
+ public function delete( $table, $conds, $fname = __METHOD__ ) {
if ( is_array( $conds ) ) {
$conds = $this->wrapConditionsForWhere( $table, $conds
);
}
@@ -1211,7 +1211,7 @@
return parent::delete( $table, $conds, $fname );
}
- function update( $table, $values, $conds, $fname =
'DatabaseOracle::update', $options = array() ) {
+ function update( $table, $values, $conds, $fname = __METHOD__, $options
= array() ) {
global $wgContLang;
$table = $this->tableName( $table );
diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index e12175f..b5ac5cb 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -482,7 +482,7 @@
parent::reportQueryError( $error, $errno, $sql, $fname, false );
}
- function queryIgnore( $sql, $fname = 'DatabasePostgres::queryIgnore' ) {
+ function queryIgnore( $sql, $fname = __METHOD__ ) {
return $this->query( $sql, $fname, true );
}
@@ -610,7 +610,7 @@
* Takes same arguments as Database::select()
* @return int
*/
- function estimateRowCount( $table, $vars = '*', $conds = '', $fname =
'DatabasePostgres::estimateRowCount', $options = array() ) {
+ function estimateRowCount( $table, $vars = '*', $conds = '', $fname =
__METHOD__, $options = array() ) {
$options['EXPLAIN'] = true;
$res = $this->select( $table, $vars, $conds, $fname, $options );
$rows = -1;
@@ -629,7 +629,7 @@
* If errors are explicitly ignored, returns NULL on failure
* @return bool|null
*/
- function indexInfo( $table, $index, $fname =
'DatabasePostgres::indexInfo' ) {
+ function indexInfo( $table, $index, $fname = __METHOD__ ) {
$sql = "SELECT indexname FROM pg_indexes WHERE
tablename='$table'";
$res = $this->query( $sql, $fname );
if ( !$res ) {
@@ -705,7 +705,7 @@
return $a;
}
- function indexUnique( $table, $index, $fname =
'DatabasePostgres::indexUnique' ) {
+ function indexUnique( $table, $index, $fname = __METHOD__ ) {
$sql = "SELECT indexname FROM pg_indexes WHERE
tablename='{$table}'" .
" AND indexdef LIKE 'CREATE UNIQUE%(" .
$this->strencode( $this->indexName( $index ) ) .
@@ -733,7 +733,7 @@
*
* @return bool Success of insert operation. IGNORE always returns true.
*/
- function insert( $table, $args, $fname = 'DatabasePostgres::insert',
$options = array() ) {
+ function insert( $table, $args, $fname = __METHOD__, $options = array()
) {
if ( !count( $args ) ) {
return true;
}
@@ -850,7 +850,7 @@
* @todo FIXME: Implement this a little better (seperate select/insert)?
* @return bool
*/
- function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
'DatabasePostgres::insertSelect',
+ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname =
__METHOD__,
$insertOptions = array(), $selectOptions = array() )
{
$destTable = $this->tableName( $destTable );
@@ -979,13 +979,13 @@
return $this->lastErrno() == '40P01';
}
- function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = 'DatabasePostgres::duplicateTableStructure' ) {
+ function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = __METHOD__ ) {
$newName = $this->addIdentifierQuotes( $newName );
$oldName = $this->addIdentifierQuotes( $oldName );
return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' :
'' ) . " TABLE $newName (LIKE $oldName INCLUDING DEFAULTS)", $fname );
}
- function listTables( $prefix = null, $fname =
'DatabasePostgres::listTables' ) {
+ function listTables( $prefix = null, $fname = __METHOD__ ) {
$eschema = $this->addQuotes( $this->getCoreSchema() );
$result = $this->query( "SELECT tablename FROM pg_tables WHERE
schemaname = $eschema", $fname );
$endArray = array();
diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php
index 80341b0..53a4dcf 100644
--- a/includes/db/DatabaseSqlite.php
+++ b/includes/db/DatabaseSqlite.php
@@ -200,7 +200,7 @@
*
* @return ResultWrapper
*/
- function attachDatabase( $name, $file = false, $fname =
'DatabaseSqlite::attachDatabase' ) {
+ function attachDatabase( $name, $file = false, $fname = __METHOD__ ) {
global $wgSQLiteDataDir;
if ( !$file ) {
$file = self::generateFileName( $wgSQLiteDataDir, $name
);
@@ -420,7 +420,7 @@
*
* @return array
*/
- function indexInfo( $table, $index, $fname =
'DatabaseSqlite::indexExists' ) {
+ function indexInfo( $table, $index, $fname = __METHOD__ ) {
$sql = 'PRAGMA index_info(' . $this->addQuotes(
$this->indexName( $index ) ) . ')';
$res = $this->query( $sql, $fname );
if ( !$res ) {
@@ -442,7 +442,7 @@
* @param $fname string
* @return bool|null
*/
- function indexUnique( $table, $index, $fname =
'DatabaseSqlite::indexUnique' ) {
+ function indexUnique( $table, $index, $fname = __METHOD__ ) {
$row = $this->selectRow( 'sqlite_master', '*',
array(
'type' => 'index',
@@ -514,7 +514,7 @@
* Based on generic method (parent) with some prior SQLite-sepcific
adjustments
* @return bool
*/
- function insert( $table, $a, $fname = 'DatabaseSqlite::insert',
$options = array() ) {
+ function insert( $table, $a, $fname = __METHOD__, $options = array() ) {
if ( !count( $a ) ) {
return true;
}
@@ -541,7 +541,7 @@
* @param $fname string
* @return bool|ResultWrapper
*/
- function replace( $table, $uniqueIndexes, $rows, $fname =
'DatabaseSqlite::replace' ) {
+ function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
if ( !count( $rows ) ) {
return true;
}
@@ -815,7 +815,7 @@
* @param $fname string
* @return bool|ResultWrapper
*/
- function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = 'DatabaseSqlite::duplicateTableStructure' ) {
+ function duplicateTableStructure( $oldName, $newName, $temporary =
false, $fname = __METHOD__ ) {
$res = $this->query( "SELECT sql FROM sqlite_master WHERE
tbl_name=" . $this->addQuotes( $oldName ) . " AND type='table'", $fname );
$obj = $this->fetchObject( $res );
if ( !$obj ) {
@@ -841,7 +841,7 @@
*
* @return array
*/
- function listTables( $prefix = null, $fname =
'DatabaseSqlite::listTables' ) {
+ function listTables( $prefix = null, $fname = __METHOD__ ) {
$result = $this->select(
'sqlite_master',
'name',
--
To view, visit https://gerrit.wikimedia.org/r/62433
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I86cbdeabee9709cde15a6b7bd47a53229c2e3f92
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits