| Versionen | |
|---|---|
| drupal6 – drupal7 | db_field_set_default(&$ret, $table, $field, $default) |
Set the default value for a field.
$ret Array to which query results will be added.
$table The table to be altered.
$field The field to be altered.
$default Default value to be set. NULL for 'default NULL'.
includes/
<?php
function db_field_set_default(&$ret, $table, $field, $default) {
if ($default == NULL) {
$default = 'NULL';
}
else {
$default = is_string($default) ? "'$default'" : $default;
}
$ret[] = update_sql('ALTER TABLE {' . $table . '} ALTER COLUMN ' . $field . ' SET DEFAULT ' . $default);
}
?>
Kommentare
Kommentar hinzufügen