| Versionen | |
|---|---|
| drupal6 – drupal7 | db_add_unique_key(&$ret, $table, $name, $fields) |
Add a unique key.
$ret Array to which query results will be added.
$table The table to be altered.
$name The name of the key.
$fields An array of field names.
includes/
<?php
function db_add_unique_key(&$ret, $table, $name, $fields) {
$name = '{' . $table . '}_' . $name . '_key';
$ret[] = update_sql('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' .
$name . ' UNIQUE (' . implode(',', $fields) . ')');
}
?>
Kommentare
Kommentar hinzufügen