public function DatabaseSchema_sqlite::indexExists

7.x schema.inc public DatabaseSchema_sqlite::indexExists($table, $name)

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-7.x/includes/database/sqlite/schema.inc
Add an index.
DatabaseSchema_sqlite::addUniqueKey in drupal-7.x/includes/database/sqlite/schema.inc
Add a unique key.
DatabaseSchema_sqlite::dropIndex in drupal-7.x/includes/database/sqlite/schema.inc
Drop an index.
DatabaseSchema_sqlite::dropUniqueKey in drupal-7.x/includes/database/sqlite/schema.inc
Drop a unique key.

File

drupal-7.x/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() != '';
}