You are here

public function Scheme::IndexExists in Drupal driver for SQL Server and SQL Azure 8.2

Verify if a in index exists in the database.

Parameters

string $table: Name of the table.

string $index: Name of the index.

Return value

bool

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

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Scheme.php, line 64

Class

Scheme

Namespace

Drupal\Driver\Database\sqlsrv

Code

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