public function DatabaseSchema_mysql::indexExists

cis7 schema.inc public DatabaseSchema_mysql::indexExists($table, $name)
cle7 schema.inc public DatabaseSchema_mysql::indexExists($table, $name)
elmsmedia7 schema.inc public DatabaseSchema_mysql::indexExists($table, $name)
icor7 schema.inc public DatabaseSchema_mysql::indexExists($table, $name)
meedjum_blog7 schema.inc public DatabaseSchema_mysql::indexExists($table, $name)
mooc7 schema.inc public DatabaseSchema_mysql::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

6 calls to DatabaseSchema_mysql::indexExists()
DatabaseSchema_mysql::addIndex in includes/database/mysql/schema.inc
Add an index.
DatabaseSchema_mysql::addPrimaryKey in includes/database/mysql/schema.inc
Add a primary key.
DatabaseSchema_mysql::addUniqueKey in includes/database/mysql/schema.inc
Add a unique key.
DatabaseSchema_mysql::dropIndex in includes/database/mysql/schema.inc
Drop an index.
DatabaseSchema_mysql::dropPrimaryKey in includes/database/mysql/schema.inc
Drop the primary key.

... See full list

File

includes/database/mysql/schema.inc, line 385
Database schema code for MySQL database servers.

Class

DatabaseSchema_mysql

Code

public function indexExists($table, $name) {
  // Returns one row for each column in the index. Result is string or FALSE.
  // Details at http://dev.mysql.com/doc/refman/5.0/en/show-index.html
  $row = $this->connection->query('SHOW INDEX FROM {' . $table . "} WHERE key_name = '$name'")->fetchAssoc();
  return isset($row['Key_name']);
}