public function DataTable::changePrimaryKey in Data 7
Same name and namespace in other branches
- 6 includes/DataTable.inc \DataTable::changePrimaryKey()
Change the primary keys of a table.
Throws
File
- includes/
DataTable.inc, line 434 - 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 changePrimaryKey($fields) {
$schema = $this->table_schema;
if (!empty($schema['primary key'])) {
$this
->dropPrimaryKey();
}
if (!empty($fields)) {
$this
->addPrimaryKey($fields);
}
}