public function DataTable::dropField in Data 6
Same name and namespace in other branches
- 7 includes/DataTable.inc \DataTable::dropField()
Delete a field.
Throws
File
- includes/
DataTable.inc, line 463 - 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 dropField($field) {
$ret = array();
db_drop_field($ret, $this->name, $field);
if ($ret[0]['success']) {
$schema = $this->table_schema;
unset($schema['fields'][$field]);
$meta = $this->meta;
unset($meta['fields'][$field]);
$this
->update(array(
'table_schema' => $schema,
), array(
'meta' => $meta,
));
drupal_get_schema($this->name, TRUE);
return;
}
throw new DataException(t('Cannot drop field.'));
}