_db_create_keys_sql

  1. drupal
    1. drupal6
    2. drupal7 database.inc
Versionen
drupal6 – drupal7 _db_create_keys_sql($spec)

Verwandte Themen

▾ 3 functions call _db_create_keys_sql()

db_add_field in includes/database.mysql-common.inc
Add a new field to a table.
db_change_field in includes/database.mysql-common.inc
db_create_table_sql in includes/database.mysql-common.inc
Generate SQL to create a new table from a Drupal schema definition.

Code

includes/database.mysql-common.inc, line 96

<?php
function _db_create_keys_sql($spec) {
  $keys = array();

  if (!empty($spec['primary key'])) {
    $keys[] = 'PRIMARY KEY (' . _db_create_key_sql($spec['primary key']) . ')';
  }
  if (!empty($spec['unique keys'])) {
    foreach ($spec['unique keys'] as $key => $fields) {
      $keys[] = 'UNIQUE KEY ' . $key . ' (' . _db_create_key_sql($fields) . ')';
    }
  }
  if (!empty($spec['indexes'])) {
    foreach ($spec['indexes'] as $index => $fields) {
      $keys[] = 'INDEX ' . $index . ' (' . _db_create_key_sql($fields) . ')';
    }
  }

  return $keys;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen