You are here

function schema_engine_type in Schema 7

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

Converts a column's Schema type into an engine-specific data type.

1 call to schema_engine_type()
schema_compare_table in ./schema.module
Compares a reference specification (such as one returned by a module's hook_schema) to an inspected specification from the database.

File

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

Code

function schema_engine_type($col, $table, $field, $engine = NULL) {
  $map = schema_dbobject()
    ->getFieldTypeMap();
  $size = isset($col['size']) ? $col['size'] : 'normal';
  $type = $col['type'] . ':' . $size;
  if (isset($map[$type])) {
    return $map[$type];
  }
  else {
    trigger_error(t('@table.@field: no @engine type for schema type @type.', array(
      '@engine' => $engine,
      '@type' => $type,
      '@table' => $table,
      '@field' => $field,
    )), E_USER_WARNING);
    return $col['type'];
  }
}