function DatabaseSchema_mysql::processField

Set database-engine specific properties for a field.

Parameters

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

3 calls to DatabaseSchema_mysql::processField()
DatabaseSchema_mysql::addField in includes/database/mysql/schema.inc
Add a new field to a table.
DatabaseSchema_mysql::changeField in includes/database/mysql/schema.inc
Change a field definition.
DatabaseSchema_mysql::createTableSql in includes/database/mysql/schema.inc
Generate SQL to create a new table from a Drupal schema definition.

File

includes/database/mysql/schema.inc, line 205

Class

DatabaseSchema_mysql

Code

protected function processField($field) {
    if (!isset($field['size'])) {
        $field['size'] = 'normal';
    }
    // Set the correct database-engine specific datatype.
    // In case one is already provided, force it to uppercase.
    if (isset($field['mysql_type'])) {
        $field['mysql_type'] = drupal_strtoupper($field['mysql_type']);
    }
    else {
        $map = $this->getFieldTypeMap();
        $field['mysql_type'] = $map[$field['type'] . ':' . $field['size']];
    }
    if (isset($field['type']) && $field['type'] == 'serial') {
        $field['auto_increment'] = TRUE;
    }
    return $field;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.