protected function Schema::uniqueKeyExists in Drupal driver for SQL Server and SQL Azure 8
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::uniqueKeyExists()
- 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::uniqueKeyExists()
Find if an unique key exists.
@status tested
4 calls to Schema::uniqueKeyExists()
- Schema::addUniqueKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::addUniqueKey().
- Schema::changeField in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::changeField().
- Schema::dropFieldRelatedObjects in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Drop the related objects of a column (indexes, constraints, etc.).
- Schema::dropUniqueKey in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php - Override DatabaseSchema::dropUniqueKey().
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Schema.php, line 1582 - Definition of Drupal\Driver\Database\sqlsrv\Schema
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
protected function uniqueKeyExists($table, $name) {
$table = $this->connection
->prefixTables('{' . $table . '}');
return (bool) $this->connection
->query('SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID(:table) AND name = :name', array(
':table' => $table,
':name' => $name . '_unique',
))
->fetchField();
}