DatabaseSchema_mysql::indexExists
public function DatabaseSchema_mysql::indexExists
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
File
- includes/database/mysql/schema.inc, line 393
- Database schema code for MySQL database servers.
Class
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']); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!mysql!schema.inc/function/DatabaseSchema_mysql::indexExists/7.x