You are here

function _db_process_field in Drupal 6

Same name in this branch
  1. 6 includes/database.mysql-common.inc \_db_process_field()
  2. 6 includes/database.pgsql.inc \_db_process_field()

Set database-engine specific properties for a field.

Parameters

$field: A field description array, as specified in the schema documentation.

Related topics

5 calls to _db_process_field()
db_add_field in includes/database.mysql-common.inc
Add a new field to a table.
db_add_field in includes/database.pgsql.inc
Add a new field to a table.
db_change_field in includes/database.mysql-common.inc
Change a field definition.
db_create_table_sql in includes/database.mysql-common.inc
Generate SQL to create a new table from a Drupal schema definition.
db_create_table_sql in includes/database.pgsql.inc
Generate SQL to create a new table from a Drupal schema definition.

File

includes/database.pgsql.inc, line 563
Database interface code for PostgreSQL database servers.

Code

function _db_process_field($field) {
  if (!isset($field['size'])) {
    $field['size'] = 'normal';
  }

  // Set the correct database-engine specific datatype.
  if (!isset($field['pgsql_type'])) {
    $map = db_type_map();
    $field['pgsql_type'] = $map[$field['type'] . ':' . $field['size']];
  }
  if ($field['type'] == 'serial') {
    unset($field['not null']);
  }
  return $field;
}