You are here

public function DataTable::drop in Data 6

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

Drop a table. Does not drop a table if its defined in code.

Return value

TRUE if the table was dropped, FALSE otherwise.

File

includes/DataTable.inc, line 485
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 drop() {
  if ($this->export_type == EXPORT_IN_DATABASE) {
    if (db_table_exists($this->name)) {
      db_drop_table($ret, $this->name);
    }
    $this
      ->update(array(
      'table_schema' => array(),
    ));
    drupal_get_schema($this->name, TRUE);
    db_query('DELETE FROM {data_tables} WHERE name = "%s"', $this->name);
    $this->title = '';
    $this->table_schema = $this->meta = array();
    return TRUE;
  }
  return FALSE;
}