You are here

protected function SchemaDatabaseSchema_mysql::getPrefixInfo in Schema 7

Overrides DatabaseSchema_mysql::getPrefixInfo().

@todo Remove when https://drupal.org/node/2223073 is fixed in core.

Overrides DatabaseSchema_mysql::getPrefixInfo

1 call to SchemaDatabaseSchema_mysql::getPrefixInfo()
SchemaDatabaseSchema_mysql::inspect in engines/mysql.inc
Retrieves the schema for the database's actual structure.

File

engines/mysql.inc, line 36
Schema module enhancements to DatabaseSchema_mysql

Class

SchemaDatabaseSchema_mysql
@file Schema module enhancements to 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;
}