function db_field_set_default
Same name in this branch
- 6.x drupal-6.x/includes/database.pgsql.inc \db_field_set_default()
- 6.x drupal-6.x/includes/database.mysql-common.inc \db_field_set_default()
Same name and namespace in other branches
- 7.x drupal-7.x/includes/database/database.inc \db_field_set_default()
Set the default value for a field.
Parameters
$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'.
Related topics
Archivo
- drupal-6.x/
includes/ database.pgsql.inc, line 716 - Database interface code for PostgreSQL database servers.
Código
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);
}