protected function DatabaseSchema_mysql::processField

protected DatabaseSchema_mysql::processField($field)

Set database-engine specific properties for a field.

Parameters

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

File

includes/database/mysql/schema.inc, line 200
Database schema code for MySQL database servers.

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!mysql!schema.inc/function/DatabaseSchema_mysql::processField/7.x