protected function Schema::processField

Same name in this branch
  1. 9.x drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::processField()
  2. 9.x drupal/core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php \Drupal\Core\Database\Driver\sqlite\Schema::processField()
  3. 9.x drupal/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php \Drupal\Core\Database\Driver\pgsql\Schema::processField()

Set database-engine specific properties for a field.

Parameters

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

3 calls to Schema::processField()
Schema::addField in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Add a new field to a table.
Schema::changeField in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Change a field definition.
Schema::createTableSql in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 201
Definition of Drupal\Core\Database\Driver\mysql\Schema

Class

Schema

Namespace

Drupal\Core\Database\Driver\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;
}