* Query whether a given table exists
*
* @param $table string
+ * @param $fname string
*
* @return bool
*/
- function tableExists( $table ) {
+ function tableExists( $table, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
$old = $this->ignoreErrors( true );
- $res = $this->query( "SELECT 1 FROM $table LIMIT 1", __METHOD__ );
+ $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname );
$this->ignoreErrors( $old );
return (bool)$res;
* @since 1.18
*/
public function dropTable( $tableName, $fName = 'DatabaseBase::dropTable' ) {
- if( !$this->tableExists( $tableName ) ) {
+ if( !$this->tableExists( $tableName, $fName ) ) {
return false;
}
$sql = "DROP TABLE " . $this->tableName( $tableName );
* Queries whether a given table exists
* @return boolean
*/
- public function tableExists( $table ) {
+ public function tableExists( $table, $fname = __METHOD__ ) {
$schema = $this->mSchema;
$sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" .
return $version;
}
- function tableExists ( $table, $schema = false ) {
+ function tableExists ( $table, , $fname = __METHOD__, $schema = false ) {
$res = sqlsrv_query( $this->mConn, "SELECT * FROM information_schema.tables
WHERE table_type='BASE TABLE' AND table_name = '$table'" );
if ( $res === false ) {
* @return bool|ResultWrapper
*/
public function dropTable( $tableName, $fName = 'DatabaseMysql::dropTable' ) {
- if( !$this->tableExists( $tableName ) ) {
+ if( !$this->tableExists( $tableName, $fName ) ) {
return false;
}
return $this->query( "DROP TABLE IF EXISTS " . $this->tableName( $tableName ), $fName );
/**
* Query whether a given table exists (in the given schema, or the default mw one if not given)
*/
- function tableExists( $table ) {
+ function tableExists( $table, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
$table = $this->addQuotes( strtoupper( $this->removeIdentifierQuotes( $table ) ) );
$owner = $this->addQuotes( strtoupper( $this->mDBname ) );
public function getSearchEngine() {
return 'SearchOracle';
}
-
+
public function getInfinity() {
return '31-12-2030 12:00:00.000000';
}
-
+
} // end DatabaseOracle class
* For backward compatibility, this function checks both tables and
* views.
*/
- function tableExists( $table, $schema = false ) {
+ function tableExists( $table, $fname = __METHOD__, $schema = false ) {
return $this->relationExists( $table, array( 'r', 'v' ), $schema );
}
}
$this->db->selectDB( $this->getVar( 'wgDBname' ) );
- if( $this->db->tableExists( 'user' ) ) {
+ if( $this->db->tableExists( 'user', __METHOD__ ) ) {
$status->warning( 'config-install-tables-exist' );
$this->enableLB();
return $status;
if ( !$this->db->selectDB( $this->getVar( 'wgDBname' ) ) ) {
return false;
}
- return $this->db->tableExists( 'cur' ) || $this->db->tableExists( 'revision' );
+ return $this->db->tableExists( 'cur', __METHOD__ ) || $this->db->tableExists( 'revision', __METHOD__ );
}
/**
* @return boolean
*/
protected function canUseNewUpdatelog() {
- return $this->db->tableExists( 'updatelog' ) &&
+ return $this->db->tableExists( 'updatelog', __METHOD__ ) &&
$this->db->fieldExists( 'updatelog', 'ul_value' );
}
* @param $fullpath Boolean Whether to treat $patch path as a relative or not
*/
protected function addTable( $name, $patch, $fullpath = false ) {
- if ( $this->db->tableExists( $name ) ) {
+ if ( $this->db->tableExists( $name, __METHOD__ ) ) {
$this->output( "...$name table already exists.\n" );
} else {
$this->output( "Creating $name table..." );
* @param $fullpath Boolean Whether to treat $patch path as a relative or not
*/
protected function addField( $table, $field, $patch, $fullpath = false ) {
- if ( !$this->db->tableExists( $table ) ) {
+ if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "...$table table does not exist, skipping new field patch\n" );
} elseif ( $this->db->fieldExists( $table, $field ) ) {
$this->output( "...have $field field in $table table.\n" );
* @param $fullpath bool
*/
protected function dropTable( $table, $patch, $fullpath = false ) {
- if ( $this->db->tableExists( $table ) ) {
+ if ( $this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "Dropping table $table... " );
$this->applyPatch( $patch, $fullpath );
$this->output( "ok\n" );
*/
public function modifyField( $table, $field, $patch, $fullpath = false ) {
$updateKey = "$table-$field-$patch";
- if ( !$this->db->tableExists( $table ) ) {
+ if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "...$table table does not exist, skipping modify field patch\n" );
} elseif ( !$this->db->fieldExists( $table, $field ) ) {
$this->output( "...$field field does not exist in $table table, skipping modify field patch\n" );
$conn->selectDB( $this->getVar( 'wgDBname' ) );
# Determine existing default character set
- if ( $conn->tableExists( "revision" ) ) {
+ if ( $conn->tableExists( "revision", __METHOD__ ) ) {
$revision = $conn->buildLike( $this->getVar( 'wgDBprefix' ) . 'revision' );
$res = $conn->query( "SHOW TABLE STATUS $revision", __METHOD__ );
$row = $conn->fetchObject( $res );
protected function doInterwikiUpdate() {
global $IP;
- if ( $this->db->tableExists( "interwiki" ) ) {
+ if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
$this->output( "...already have interwiki table\n" );
return;
}
}
function doSchemaRestructuring() {
- if ( $this->db->tableExists( 'page' ) ) {
+ if ( $this->db->tableExists( 'page', __METHOD__ ) ) {
$this->output( "...page table already exists.\n" );
return;
}
}
protected function doPagelinksUpdate() {
- if ( $this->db->tableExists( 'pagelinks' ) ) {
+ if ( $this->db->tableExists( 'pagelinks', __METHOD__ ) ) {
$this->output( "...already have pagelinks table.\n" );
return;
}
}
protected function doUserGroupsUpdate() {
- if ( $this->db->tableExists( 'user_groups' ) ) {
+ if ( $this->db->tableExists( 'user_groups', __METHOD__ ) ) {
$info = $this->db->fieldInfo( 'user_groups', 'ug_group' );
if ( $info->type() == 'int' ) {
$oldug = $this->db->tableName( 'user_groups' );
$this->applyPatch( 'patch-user_groups.sql' );
$this->output( "ok\n" );
- if ( !$this->db->tableExists( 'user_rights' ) ) {
+ if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
if ( $this->db->fieldExists( 'user', 'user_rights' ) ) {
$this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
$this->db->applyPatch( 'patch-user_rights.sql' );
}
protected function doTemplatelinksUpdate() {
- if ( $this->db->tableExists( 'templatelinks' ) ) {
+ if ( $this->db->tableExists( 'templatelinks', __METHOD__ ) ) {
$this->output( "...templatelinks table already exists\n" );
return;
}
* -- Andrew Garrett, January 2007.
*/
protected function doRestrictionsUpdate() {
- if ( $this->db->tableExists( 'page_restrictions' ) ) {
+ if ( $this->db->tableExists( 'page_restrictions', __METHOD__ ) ) {
$this->output( "...page_restrictions table already exists.\n" );
return;
}
}
protected function doMaybeProfilingMemoryUpdate() {
- if ( !$this->db->tableExists( 'profiling' ) ) {
+ if ( !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
// Simply ignore
} elseif ( $this->db->fieldExists( 'profiling', 'pf_memory' ) ) {
$this->output( "...profiling table has pf_memory field.\n" );