function data_build_field_definition in Data 6
Same name and namespace in other branches
- 8 data.module \data_build_field_definition()
- 7 data.module \data_build_field_definition()
Build a full schema api field definition.
Parameters
$stub: Array with at least one key 'type'.
2 calls to data_build_field_definition()
- data_ui_create_form_submit in data_ui/
data_ui.admin.inc - Submit handler for create table form.
- data_ui_edit_form_submit in data_ui/
data_ui.admin.inc - Submit form.
File
- ./
data.module, line 332 - Hooks and API functions for data module.
Code
function data_build_field_definition($stub) {
$spec = array();
$spec['type'] = $stub['type'];
$spec['size'] = empty($stub['size']) ? 'normal' : $stub['size'];
if ($spec['type'] == 'int') {
$spec['unsigned'] = empty($stub['unsigned']) ? FALSE : TRUE;
}
if ($spec['type'] == 'varchar') {
$spec['length'] = 255;
unset($spec['size']);
}
if ($spec['type'] == 'geometry') {
$spec['mysql_type'] = 'geometry';
$spec['pgsql_type'] = 'GEOMETRY';
}
return $spec;
}