You are here

function apdqc_get_cache_table_indexes in Asynchronous Prefetch Database Query Cache 7

Get all database indexes for the cache tables.

Return value

array Returns an array of tables and index names.

3 calls to apdqc_get_cache_table_indexes()
apdqc_admin_convert_tables_indexes in ./apdqc.admin.inc
Convert table indexes to expire, created.
apdqc_admin_operations_form in ./apdqc.admin.inc
Form builder; perform apdqc operations.
apdqc_convert_cache_index in ./apdqc.admin.inc
Converts a database index from one form to another.

File

./apdqc.admin.inc, line 1217
Admin page callbacks for the apdqc module.

Code

function apdqc_get_cache_table_indexes(array $cache_tables = array()) {
  if (empty($cache_tables)) {
    $cache_tables = apdqc_get_cache_tables();
  }
  $results = array();
  foreach ($cache_tables as $table_name) {
    if (!db_table_exists($table_name)) {
      continue;
    }
    $table_name = Database::getConnection()
      ->prefixTables('{' . db_escape_table($table_name) . '}');
    $result = db_query("SHOW INDEX IN {$table_name}")
      ->fetchAll();
    foreach ($result as $row) {
      $results[$table_name][$row->Key_name][] = $row->Column_name;
    }
  }
  return $results;
}