You are here

public function Schema::indexExists in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::indexExists()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::indexExists()

Override DatabaseSchema::indexExists().

@status tested

Overrides Schema::indexExists

2 calls to Schema::indexExists()
Schema::addIndex in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::addIndex().
Schema::dropIndex in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::dropIndex().

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 1648
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function indexExists($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 . '_idx',
  ))
    ->fetchField();
}