You are here

public function DatabaseSchema_sqlsrv::dropIndex 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::dropIndex()
  2. 7 sqlsrv/schema.inc \DatabaseSchema_sqlsrv::dropIndex()

Override DatabaseSchema::dropIndex().

@status tested

Overrides DatabaseSchema::dropIndex

1 call to DatabaseSchema_sqlsrv::dropIndex()
DatabaseSchema_sqlsrv::cleanUpPrimaryKey in sqlsrv/schema.inc
Drop the primary key constraint.

File

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

Class

DatabaseSchema_sqlsrv

Code

public function dropIndex($table, $name) {
  if (!$this
    ->indexExists($table, $name)) {
    return FALSE;
  }
  $expand = FALSE;
  if (($index = $this
    ->tableHasXmlIndex($table)) && $index == $name . '_idx') {
    $expand = TRUE;
  }
  $this->connection
    ->query_direct('DROP INDEX ' . $name . '_idx ON [{' . $table . '}]');

  // If we just dropped an XML index, we can re-expand the original primary key index.
  if ($expand) {
    $this
      ->compressPrimaryKeyIndex($table);
  }
  $this
    ->queryColumnInformationInvalidate($table);
  return TRUE;
}