You are here

function data_get_index_definition in Data 6

Same name and namespace in other branches
  1. 8 data.module \data_get_index_definition()
  2. 7 data.module \data_get_index_definition()

Get a Schema API index definition for a given field type. @todo: support multiple name/type combinations.

3 calls to data_get_index_definition()
DataTable::addIndex in includes/DataTable.inc
Add an index to table.
DataTable::addUniqueKey in includes/DataTable.inc
Add a unique key to a field.
data_ui_create_form_submit in data_ui/data_ui.admin.inc
Submit handler for create table form.

File

./data.module, line 239
Hooks and API functions for data module.

Code

function data_get_index_definition($field_name, $spec) {

  // Default to 255 for now.
  if ($spec['type'] == 'text') {

    // @todo: what's the right format here? this is broken.
    return array(
      array(
        $field_name,
        255,
      ),
    );
  }
  else {
    return array(
      $field_name,
    );
  }
}