You are here

protected function SchemaDatabaseSchema_mysql::getPrefixInfo in Schema 8

Overrides DatabaseSchema_mysql::getPrefixInfo().

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

Overrides Schema::getPrefixInfo

1 call to SchemaDatabaseSchema_mysql::getPrefixInfo()
SchemaDatabaseSchema_mysql::inspect in src/SchemaDatabaseSchema_mysql.php

File

src/SchemaDatabaseSchema_mysql.php, line 78
Schema module enhancements to DatabaseSchema_mysql

Class

SchemaDatabaseSchema_mysql

Namespace

Drupal\schema

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;
}