1 schema.inc | protected DatabaseSchema_mysql::getPrefixInfo($table = 'default', $add_prefix = TRUE) |
Get information about the table name and schema from the prefix.
Parameters
string $table: Name of table to look prefix up for. Defaults to 'default' because thats default key for prefix.
bool $add_prefix: Boolean that indicates whether the given table name should be prefixed.
Return value
array: A keyed array with information about the schema, table name and prefix.
Overrides DatabaseSchema::getPrefixInfo
File
- core/
includes/ database/ mysql/ schema.inc, line 30 - Database schema code for MySQL database servers.
Class
- DatabaseSchema_mysql
- Class to create and manipulate MySQL tables.
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;
}