public function Schema::indexExists in Drupal driver for SQL Server and SQL Azure 3.0.x
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::indexExists()
- 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::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 Schema::indexExists
2 calls to Schema::indexExists()
- Schema::addIndex in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Add an index.
- Schema::dropIndex in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Drop an index.
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 401
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
public function indexExists($table, $name) {
$prefixInfo = $this
->getPrefixInfo($table, TRUE);
return (bool) $this->connection
->query('SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID(:table) AND name = :name', [
':table' => $prefixInfo['table'],
':name' => $name . '_idx',
])
->fetchField();
}