Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseSchema_mysql::getPrefixInfo

Get information about the table and database name from the prefix.

Parameters

Name of table to look prefix up for. Defaults to 'default' because thats: default key for prefix.

$add_prefix: Boolean that indicates whether the given table name should be prefixed.

Return value

A keyed array with information about the database, table name and prefix.

Overrides DatabaseSchema::getPrefixInfo

2 calls to DatabaseSchema_mysql::getPrefixInfo()
DatabaseSchema_mysql::buildTableNameCondition in includes/database/mysql/schema.inc
Build a condition to match a table name against a standard information_schema.
DatabaseSchema_mysql::renameTable in includes/database/mysql/schema.inc
Rename a table.

File

includes/database/mysql/schema.inc, line 32

Class

DatabaseSchema_mysql

Code

protected function getPrefixInfo($table = 'default', $add_prefix = TRUE) {
 $info = array(
 'prefix' => $this->connection 
 ->tablePrefix ($table),
 );
 if ($add_prefix) {
 $table = $info['prefix'] . $table;
 }
 if (($pos = strpos ($table, '.')) !== FALSE) {
 $info['database'] = substr ($table, 0, $pos);
 $info['table'] = substr ($table, ++$pos);
 }
 else {
 $db_info = $this->connection 
 ->getConnectionOptions ();
 $info['database'] = $db_info['database'];
 $info['table'] = $table;
 }
 return $info;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.