Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/includes/database/sqlite/schema.inc | ||
---|---|---|
232 | 232 |
|
233 | 233 |
public function renameTable($table, $new_name) { |
234 | 234 |
if (!$this->tableExists($table)) { |
235 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot rename %table to %table_new: table %table doesn't exist.", array('%table' => $table, '%table_new' => $new_name)));
|
|
235 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot rename @table to @table_new: table @table doesn't exist.", array('@table' => $table, '@table_new' => $new_name)));
|
|
236 | 236 |
} |
237 | 237 |
if ($this->tableExists($new_name)) { |
238 |
throw new DatabaseSchemaObjectExistsException(t("Cannot rename %table to %table_new: table %table_new already exists.", array('%table' => $table, '%table_new' => $new_name)));
|
|
238 |
throw new DatabaseSchemaObjectExistsException(t("Cannot rename @table to @table_new: table @table_new already exists.", array('@table' => $table, '@table_new' => $new_name)));
|
|
239 | 239 |
} |
240 | 240 |
|
241 | 241 |
$schema = $this->introspectSchema($table); |
... | ... | |
278 | 278 |
|
279 | 279 |
public function addField($table, $field, $specification, $keys_new = array()) { |
280 | 280 |
if (!$this->tableExists($table)) { |
281 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add field %table.%field: table doesn't exist.", array('%field' => $field, '%table' => $table)));
|
|
281 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add field @table.@field: table doesn't exist.", array('@field' => $field, '@table' => $table)));
|
|
282 | 282 |
} |
283 | 283 |
if ($this->fieldExists($table, $field)) { |
284 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add field %table.%field: field already exists.", array('%field' => $field, '%table' => $table)));
|
|
284 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add field @table.@field: field already exists.", array('@field' => $field, '@table' => $table)));
|
|
285 | 285 |
} |
286 | 286 |
|
287 | 287 |
// SQLite doesn't have a full-featured ALTER TABLE statement. It only |
... | ... | |
494 | 494 |
|
495 | 495 |
public function changeField($table, $field, $field_new, $spec, $keys_new = array()) { |
496 | 496 |
if (!$this->fieldExists($table, $field)) { |
497 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot change the definition of field %table.%name: field doesn't exist.", array('%table' => $table, '%name' => $field)));
|
|
497 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot change the definition of field @table.@name: field doesn't exist.", array('@table' => $table, '@name' => $field)));
|
|
498 | 498 |
} |
499 | 499 |
if (($field != $field_new) && $this->fieldExists($table, $field_new)) { |
500 |
throw new DatabaseSchemaObjectExistsException(t("Cannot rename field %table.%name to %name_new: target field already exists.", array('%table' => $table, '%name' => $field, '%name_new' => $field_new)));
|
|
500 |
throw new DatabaseSchemaObjectExistsException(t("Cannot rename field @table.@name to @name_new: target field already exists.", array('@table' => $table, '@name' => $field, '@name_new' => $field_new)));
|
|
501 | 501 |
} |
502 | 502 |
|
503 | 503 |
$old_schema = $this->introspectSchema($table); |
... | ... | |
559 | 559 |
|
560 | 560 |
public function addIndex($table, $name, $fields) { |
561 | 561 |
if (!$this->tableExists($table)) { |
562 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add index %name to table %table: table doesn't exist.", array('%table' => $table, '%name' => $name)));
|
|
562 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add index @name to table @table: table doesn't exist.", array('@table' => $table, '@name' => $name)));
|
|
563 | 563 |
} |
564 | 564 |
if ($this->indexExists($table, $name)) { |
565 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add index %name to table %table: index already exists.", array('%table' => $table, '%name' => $name)));
|
|
565 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add index @name to table @table: index already exists.", array('@table' => $table, '@name' => $name)));
|
|
566 | 566 |
} |
567 | 567 |
|
568 | 568 |
$schema['indexes'][$name] = $fields; |
... | ... | |
591 | 591 |
|
592 | 592 |
public function addUniqueKey($table, $name, $fields) { |
593 | 593 |
if (!$this->tableExists($table)) { |
594 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add unique key %name to table %table: table doesn't exist.", array('%table' => $table, '%name' => $name)));
|
|
594 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add unique key @name to table @table: table doesn't exist.", array('@table' => $table, '@name' => $name)));
|
|
595 | 595 |
} |
596 | 596 |
if ($this->indexExists($table, $name)) { |
597 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add unique key %name to table %table: unique key already exists.", array('%table' => $table, '%name' => $name)));
|
|
597 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add unique key @name to table @table: unique key already exists.", array('@table' => $table, '@name' => $name)));
|
|
598 | 598 |
} |
599 | 599 |
|
600 | 600 |
$schema['unique keys'][$name] = $fields; |
... | ... | |
617 | 617 |
|
618 | 618 |
public function addPrimaryKey($table, $fields) { |
619 | 619 |
if (!$this->tableExists($table)) { |
620 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add primary key to table %table: table doesn't exist.", array('%table' => $table)));
|
|
620 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot add primary key to table @table: table doesn't exist.", array('@table' => $table)));
|
|
621 | 621 |
} |
622 | 622 |
|
623 | 623 |
$old_schema = $this->introspectSchema($table); |
624 | 624 |
$new_schema = $old_schema; |
625 | 625 |
|
626 | 626 |
if (!empty($new_schema['primary key'])) { |
627 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add primary key to table %table: primary key already exists.", array('%table' => $table)));
|
|
627 |
throw new DatabaseSchemaObjectExistsException(t("Cannot add primary key to table @table: primary key already exists.", array('@table' => $table)));
|
|
628 | 628 |
} |
629 | 629 |
|
630 | 630 |
$new_schema['primary key'] = $fields; |
... | ... | |
646 | 646 |
|
647 | 647 |
public function fieldSetDefault($table, $field, $default) { |
648 | 648 |
if (!$this->fieldExists($table, $field)) { |
649 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot set default value of field %table.%field: field doesn't exist.", array('%table' => $table, '%field' => $field)));
|
|
649 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot set default value of field @table.@field: field doesn't exist.", array('@table' => $table, '@field' => $field)));
|
|
650 | 650 |
} |
651 | 651 |
|
652 | 652 |
$old_schema = $this->introspectSchema($table); |
... | ... | |
658 | 658 |
|
659 | 659 |
public function fieldSetNoDefault($table, $field) { |
660 | 660 |
if (!$this->fieldExists($table, $field)) { |
661 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot remove default value of field %table.%field: field doesn't exist.", array('%table' => $table, '%field' => $field)));
|
|
661 |
throw new DatabaseSchemaObjectDoesNotExistException(t("Cannot remove default value of field @table.@field: field doesn't exist.", array('@table' => $table, '@field' => $field)));
|
|
662 | 662 |
} |
663 | 663 |
|
664 | 664 |
$old_schema = $this->introspectSchema($table); |
Formats disponibles : Unified diff
Udpate to 7.33