You are here

function schema_schema_type in Schema 7

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

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

3 calls to schema_schema_type()
SchemaDatabaseSchema_mysql::inspect in engines/mysql.inc
Retrieves the schema for the database's actual structure.
SchemaDatabaseSchema_pgsql::inspect in engines/pgsql.inc
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 376
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 (!variable_get('schema_suppress_type_warnings', FALSE)) {
      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',
    );
  }
}