You are here

function schema_schema_type in Schema 8

Same name and namespace in other branches
  1. 5 schema.module \schema_schema_type()
  2. 6 schema.module \schema_schema_type()
  3. 7 schema.module \schema_schema_type()

Convert an engine-specific data type into a Schema type.

3 calls to schema_schema_type()
SchemaComparator::preprocessTableSchema in src/Comparison/SchemaComparator.php
Make sure the given schema is consistent.
SchemaDatabaseSchema_mysql::inspect in src/SchemaDatabaseSchema_mysql.php
SchemaDatabaseSchema_pgsql::inspect in src/SchemaDatabaseSchema_pgsql.php

File

./schema.module, line 298
The Schema module provides functionality built on the Schema API.

Code

function schema_schema_type($type, $table, $field, $engine = NULL) {
  $map = schema_dbobject()
    ->schema_type_map();
  $type = strtolower($type);
  if (isset($map[$type])) {
    return explode(':', $map[$type]);
  }
  else {
    if (!\Drupal::config('schema.settings')
      ->get('schema_suppress_type_warnings')) {
      trigger_error(t('@table.@field: no schema type for @engine type @type.', array(
        '@engine' => $engine,
        '@type' => $type,
        '@table' => $table,
        '@field' => $field,
      )), E_USER_WARNING);
    }
    return array(
      $type,
      'normal',
    );
  }
}