changeField

  1. drupal
    1. drupal7
Versionen
drupal7 public DatabaseSchema_sqlite::changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array())

Change a field definition.

This implementation can't use ALTER TABLE directly, because SQLite only supports a limited subset of that command.

Übergabeparameter

$ret Array to which query results will be added.

$table Name of the table.

$field Name of the field to change.

$field_new New name for the field (set to the same as $field if you don't want to change the name).

$spec The field specification for the new field.

$keys_new Optional keys and indexes specification to be created on the table along with changing the field. The format is the same as a table specification but without the 'fields' element.

Verwandte Themen

Code

includes/database/sqlite/schema.inc, line 403

<?php
public function changeField(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) {
  $new_schema = $this->introspectSchema($table);
  unset($new_schema['fields'][$field]);
  $new_schema['fields'][$field_new] = $spec;
  if (isset($keys_new['primary keys'])) {
    $new_schema['primary keys'] = $keys_new['primary keys'];
    $keys_new['primary keys'];
  }
  foreach (array('unique keys', 'indexes') as $k) {
    if (!empty($keys_new[$k])) {
      $new_schema[$k] = $keys_new[$k] + $new_schema[$k];
    }
  }
  $this->alterTable($ret, $table, $new_schema);
}
?>

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