You are here

public function DatabaseSchema_sqlsrv::_ExistsIndex in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::_ExistsIndex()

Verify if a in index exists in the database.

Parameters

mixed $table:

mixed $name:

Return value

bool

2 calls to DatabaseSchema_sqlsrv::_ExistsIndex()
DatabaseSchema_sqlsrv::indexExists in sqlsrv/schema.inc
Override DatabaseSchema::indexExists().
DatabaseSchema_sqlsrv::_DropIndex in sqlsrv/schema.inc
Drop an index, nothing to to if the index does not exists.

File

sqlsrv/schema.inc, line 1753
Database schema code for Microsoft SQL Server database servers.

Class

DatabaseSchema_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();
}