You are here

function schema_engine_type in Schema 6

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

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

2 calls 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.
schema_mysql_create_table_sql in engines/schema_mysql.inc

File

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

Code

function schema_engine_type($col, $table, $field, $engine = NULL) {
  $map = schema_engine_invoke($engine, 'engine_type_map');
  $size = isset($col['size']) ? $col['size'] : 'normal';
  $type = $col['type'] . ':' . $size;
  if (isset($map[$type])) {
    return $map[$type];
  }
  else {
    drupal_set_message(t('%table.%field: no %engine type for Schema type %type.', array(
      '%engine' => $engine,
      '%type' => $type,
      '%table' => $table,
      '%field' => $field,
    )), 'warning');
    return $col['type'];
  }
}