You are here

function db_add_index in Drupal 6

Same name in this branch
  1. 6 includes/database.mysql-common.inc \db_add_index()
  2. 6 includes/database.pgsql.inc \db_add_index()
Same name and namespace in other branches
  1. 8 core/includes/database.inc \db_add_index()
  2. 7 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 modules/comment/comment.install
Add index to parent ID field.
comment_update_6004 in modules/comment/comment.install
Add index to to node_comment_statistics on comment_count
comment_update_6005 in modules/comment/comment.install
Add indices to uid fields.
locale_update_6004 in modules/locale/locale.install
Fix remaining inconsistent indexes.
system_update_1022 in modules/system/system.install
Add index on users created column.

... See full list

File

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

Code

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