processField

  1. drupal
    1. drupal7
Versionen
drupal7 protected DatabaseSchema_pgsql::processField($field)

Set database-engine specific properties for a field.

Übergabeparameter

$field A field description array, as specified in the schema documentation.

Verwandte Themen

Code

includes/database/pgsql/schema.inc, line 174

<?php
protected function processField($field) {
  if (!isset($field['size'])) {
    $field['size'] = 'normal';
  }
  // Set the correct database-engine specific datatype.
  if (!isset($field['pgsql_type'])) {
    $map = $this->getFieldTypeMap();
    $field['pgsql_type'] = $map[$field['type'] . ':' . $field['size']];
  }
  if (!empty($field['unsigned'])) {
    // Unsigned datatypes are not supported in PostgreSQL 8.3. In MySQL,
    // they are used to ensure a positive number is inserted and it also
    // doubles the maximum integer size that can be stored in a field.
    // The PostgreSQL schema in Drupal creates a check constraint
    // to ensure that a value inserted is >= 0. To provide the extra
    // integer capacity, here, we bump up the column field size.
    if (!isset($map)) {
      $map = $this->getFieldTypeMap();
    }
    switch ($field['pgsql_type']) {
      case 'smallint':
        $field['pgsql_type'] = $map['int:medium'];
        break;
      case 'int':
        $field['pgsql_type'] = $map['int:big'];
        break;
    }
  }
  if ($field['type'] == 'serial') {
    unset($field['not null']);
  }
  return $field;
}
?>

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