You are here

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

Verify if a in index exists in the database.

Parameters

mixed $table:

mixed $name:

Return value

bool

1 call to Schema::_ExistsIndex()
Schema::_DropIndex in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Drop an index, nothing to to if the index does not exists.

File

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

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function _ExistsIndex($table, $index) {
  $table = $this->connection
    ->prefixTables('{' . $table . '}');
  return (bool) $this->connection
    ->query_direct('SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID(:table) AND name = :name', array(
    ':table' => $table,
    ':name' => $index,
  ))
    ->fetchField();
}