You are here

function _demo_table_is_view in Demonstration site (Sandbox / Snapshot) 8

Same name and namespace in other branches
  1. 6 database_mysql_dump.inc \_demo_table_is_view()
  2. 7 database_mysql_dump.inc \_demo_table_is_view()

Determine whether the given table is a VIEW.

1 call to _demo_table_is_view()
demo_dump_db in ./demo.module
Dump active database.

File

./demo.module, line 453

Code

function _demo_table_is_view($table) {
  static $tables = [];
  if (!isset($tables[$table])) {

    // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
    // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
    $status = \Drupal::database()
      ->query('SHOW TABLE STATUS LIKE :table', [
      ':table' => $table,
    ])
      ->fetchAssoc();
    $tables[$table] = strtoupper(substr($status['Comment'], 0, 4)) == 'VIEW';
  }
  return $tables[$table];
}