function db_add_index

Same name in this branch
  1. 6.x drupal-6.x/includes/database.pgsql.inc \db_add_index()
  2. 6.x drupal-6.x/includes/database.mysql-common.inc \db_add_index()
Same name and namespace in other branches
  1. 7.x drupal-7.x/includes/database/database.inc \db_add_index()

Add an index.

Parameters

$ret: Array to which query results will be added.

$table: The table to be altered.

$name: The name of the index.

$fields: An array of field names.

Related topics

20 calls to db_add_index()
comment_update_6003 in drupal-6.x/modules/comment/comment.install
Add index to parent ID field.
comment_update_6004 in drupal-6.x/modules/comment/comment.install
Add index to to node_comment_statistics on comment_count
comment_update_6005 in drupal-6.x/modules/comment/comment.install
Add indices to uid fields.
locale_update_6004 in drupal-6.x/modules/locale/locale.install
Fix remaining inconsistent indexes.
system_update_1022 in drupal-6.x/modules/system/system.install
Add index on users created column.

... See full list

Archivo

drupal-6.x/includes/database.mysql-common.inc, line 441
Functions shared between mysql and mysqli database engines.

Código

function db_add_index(&$ret, $table, $name, $fields) {
  $query = 'ALTER TABLE {' . $table . '} ADD INDEX ' . $name . ' (' . _db_create_key_sql($fields) . ')';
  $ret[] = update_sql($query);
}