You are here

public function DataTable::dropIndex in Data 7

Same name and namespace in other branches
  1. 6 includes/DataTable.inc \DataTable::dropIndex()

Drop an index from a table.

Throws

DataException

2 calls to DataTable::dropIndex()
DataTable::changeField in includes/DataTable.inc
Change a field.
DataTable::changeIndex in includes/DataTable.inc
Change indexes of a table.

File

includes/DataTable.inc, line 313
Contains class definition for DataTable.

Class

DataTable
Manages data access and manipulation for a single data table. Use data_create_table() or data_get_table() to instantiate an object from this class.

Code

public function dropIndex($field) {
  $success = db_drop_index($this->name, $field);
  if ($success) {
    $schema = $this->table_schema;
    unset($schema['indexes'][$field]);
    $this
      ->update(array(
      'table_schema' => $schema,
    ));
    drupal_get_schema($this->name, TRUE);
    return;
  }
  throw new DataException(t('Error dropping index.'));
}