public function DatabaseSchema_sqlite::indexExists

Checks if an index exists in the given table.

Parameters

$table: The name of the table in drupal (no prefixing).

$name: The name of the index in drupal (no prefixing).

Return value

TRUE if the given index exists, otherwise FALSE.

Overrides DatabaseSchema::indexExists

4 calls to DatabaseSchema_sqlite::indexExists()
DatabaseSchema_sqlite::addIndex in drupal/includes/database/sqlite/schema.inc
Add an index.
DatabaseSchema_sqlite::addUniqueKey in drupal/includes/database/sqlite/schema.inc
Add a unique key.
DatabaseSchema_sqlite::dropIndex in drupal/includes/database/sqlite/schema.inc
Drop an index.
DatabaseSchema_sqlite::dropUniqueKey in drupal/includes/database/sqlite/schema.inc
Drop a unique key.

File

drupal/includes/database/sqlite/schema.inc, line 575
Database schema code for SQLite databases.

Class

DatabaseSchema_sqlite

Code

public function indexExists($table, $name) {
  $info = $this
    ->getPrefixInfo($table);
  return $this->connection
    ->query('PRAGMA ' . $info['schema'] . '.index_info(' . $info['table'] . '_' . $name . ')')
    ->fetchField() != '';
}