You are here

protected function Schema::processField in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\Schema::processField()
  2. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php \Drupal\Driver\Database\sqlsrv\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 drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::addField().
Schema::changeField in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Override DatabaseSchema::changeField().
Schema::createTableSql in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Generate SQL to create a new table from a Drupal schema definition.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php, line 817
Definition of Drupal\Driver\Database\sqlsrv\Schema

Class

Schema

Namespace

Drupal\Driver\Database\sqlsrv

Code

protected function processField($field) {
  if (!isset($field['size'])) {
    $field['size'] = 'normal';
  }
  $int_type = isset($field['type']) && ($field['type'] == 'serial' || $field['type'] == 'int');
  $unsigned_normal = isset($field['unsigned']) && $field['unsigned'] === TRUE && $field['size'] == 'normal';
  if ($int_type && $unsigned_normal) {
    $field['size'] = 'big';
  }

  // Set the correct database-engine specific datatype.
  if (!isset($field['sqlsrv_type'])) {
    $map = $this
      ->getFieldTypeMap();
    $field['sqlsrv_type'] = $map[$field['type'] . ':' . $field['size']];
  }
  if (isset($field['sqlsrv_type'])) {
    $field['sqlsrv_type_native'] = Utils::GetMSSQLType($field['sqlsrv_type']);
  }
  if ($field['type'] == 'serial') {
    $field['identity'] = TRUE;
  }
  return $field;
}