From d5b018ce691f09c2ddd15233fb6d918b820cfd7f Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Mon, 2 Jan 2012 18:25:54 -0600 Subject: [PATCH] Rename condition class and fix some namespace statements. --- .../Drupal/Database/Driver/mysql/Schema.php | 4 ++-- .../{DatabaseCondition.php => Condition.php} | 2 +- core/includes/Drupal/Database/Query/Delete.php | 4 ++-- .../Query/InvalidMergeQueryException.php | 2 +- core/includes/Drupal/Database/Query/Merge.php | 2 +- .../Database/Query/NoFieldsException.php | 2 +- core/includes/Drupal/Database/Query/Select.php | 8 ++++---- core/includes/Drupal/Database/Query/Update.php | 4 ++-- core/includes/Drupal/Database/Schema.php | 6 +++--- core/includes/database/database.inc | 18 +++++++++--------- core/includes/database/sqlite/query.inc | 2 +- .../simpletest/tests/database_test.test | 1 + 12 files changed, 28 insertions(+), 27 deletions(-) rename core/includes/Drupal/Database/Query/{DatabaseCondition.php => Condition.php} (99%) diff --git a/core/includes/Drupal/Database/Driver/mysql/Schema.php b/core/includes/Drupal/Database/Driver/mysql/Schema.php index 0de3787ab13f..6c9e060f82b7 100644 --- a/core/includes/Drupal/Database/Driver/mysql/Schema.php +++ b/core/includes/Drupal/Database/Driver/mysql/Schema.php @@ -3,7 +3,7 @@ namespace Drupal\Database\Driver\mysql; use Drupal\Database\Database; -use Drupal\Database\Query\DatabaseCondition; +use Drupal\Database\Query\Condition; use Drupal\Database\SchemaObjectExistsException; use Drupal\Database\SchemaObjectDoesNotExistException; use Drupal\Database\Schema as DatabaseSchema; @@ -63,7 +63,7 @@ class Schema extends DatabaseSchema { $table_info = $this->getPrefixInfo($table_name, $add_prefix); - $condition = new DatabaseCondition('AND'); + $condition = new Condition('AND'); $condition->condition('table_schema', $table_info['database']); $condition->condition('table_name', $table_info['table'], $operator); return $condition; diff --git a/core/includes/Drupal/Database/Query/DatabaseCondition.php b/core/includes/Drupal/Database/Query/Condition.php similarity index 99% rename from core/includes/Drupal/Database/Query/DatabaseCondition.php rename to core/includes/Drupal/Database/Query/Condition.php index 5200fd2676a9..b636d76408ee 100644 --- a/core/includes/Drupal/Database/Query/DatabaseCondition.php +++ b/core/includes/Drupal/Database/Query/Condition.php @@ -9,7 +9,7 @@ use Countable; /** * Generic class for a series of conditions in a query. */ -class DatabaseCondition implements ConditionInterface, Countable { +class Condition implements ConditionInterface, Countable { /** * Array of conditions. diff --git a/core/includes/Drupal/Database/Query/Delete.php b/core/includes/Drupal/Database/Query/Delete.php index 2ff7267d9a49..81a8b942e4c9 100644 --- a/core/includes/Drupal/Database/Query/Delete.php +++ b/core/includes/Drupal/Database/Query/Delete.php @@ -22,7 +22,7 @@ class Delete extends Query implements ConditionInterface { * * Condition handling is handled via composition. * - * @var DatabaseCondition + * @var Condition */ protected $condition; @@ -41,7 +41,7 @@ class Delete extends Query implements ConditionInterface { parent::__construct($connection, $options); $this->table = $table; - $this->condition = new DatabaseCondition('AND'); + $this->condition = new Condition('AND'); } /** diff --git a/core/includes/Drupal/Database/Query/InvalidMergeQueryException.php b/core/includes/Drupal/Database/Query/InvalidMergeQueryException.php index c7b14c99aa78..3bc24bb96f0a 100644 --- a/core/includes/Drupal/Database/Query/InvalidMergeQueryException.php +++ b/core/includes/Drupal/Database/Query/InvalidMergeQueryException.php @@ -1,6 +1,6 @@ table = $table; $this->conditionTable = $table; - $this->condition = new DatabaseCondition('AND'); + $this->condition = new Condition('AND'); } /** diff --git a/core/includes/Drupal/Database/Query/NoFieldsException.php b/core/includes/Drupal/Database/Query/NoFieldsException.php index 1864841e4c0e..0b1728239c44 100644 --- a/core/includes/Drupal/Database/Query/NoFieldsException.php +++ b/core/includes/Drupal/Database/Query/NoFieldsException.php @@ -1,6 +1,6 @@ where = new DatabaseCondition('AND'); - $this->having = new DatabaseCondition('AND'); + $this->where = new Condition('AND'); + $this->having = new Condition('AND'); $this->addJoin(NULL, $table, $alias); } diff --git a/core/includes/Drupal/Database/Query/Update.php b/core/includes/Drupal/Database/Query/Update.php index f1d32ab6a3d8..2a8315af4ef7 100644 --- a/core/includes/Drupal/Database/Query/Update.php +++ b/core/includes/Drupal/Database/Query/Update.php @@ -36,7 +36,7 @@ class Update extends Query implements ConditionInterface { * * Condition handling is handled via composition. * - * @var DatabaseCondition + * @var Condition */ protected $condition; @@ -70,7 +70,7 @@ class Update extends Query implements ConditionInterface { parent::__construct($connection, $options); $this->table = $table; - $this->condition = new DatabaseCondition('AND'); + $this->condition = new Condition('AND'); } /** diff --git a/core/includes/Drupal/Database/Schema.php b/core/includes/Drupal/Database/Schema.php index 25d63e56292e..acbc0461c9ab 100644 --- a/core/includes/Drupal/Database/Schema.php +++ b/core/includes/Drupal/Database/Schema.php @@ -2,8 +2,8 @@ namespace Drupal\Database; -use Drupal\Database\DatabaseSchemaObjectExistsException; -use Drupal\Database\Query\DatabaseCondition; +use Drupal\Database\SchemaObjectExistsException; +use Drupal\Database\Query\Condition; use Drupal\Database\Query\PlaceholderInterface; /** @@ -286,7 +286,7 @@ abstract class Schema implements PlaceholderInterface { // Retrive the table name and schema $table_info = $this->getPrefixInfo($table_name, $add_prefix); - $condition = new DatabaseCondition('AND'); + $condition = new Condition('AND'); $condition->condition('table_catalog', $info['database']); $condition->condition('table_schema', $table_info['schema']); $condition->condition('table_name', $table_info['table'], $operator); diff --git a/core/includes/database/database.inc b/core/includes/database/database.inc index aa1f44487c10..60b0d3b9748b 100644 --- a/core/includes/database/database.inc +++ b/core/includes/database/database.inc @@ -1,7 +1,7 @@ removeFieldsInCondition($fields, $this->condition); // Add the inverse of the fields to the condition. - $condition = new DatabaseCondition('OR'); + $condition = new Condition('OR'); foreach ($fields as $field => $data) { if (is_array($data)) { // The field is an expression. diff --git a/core/modules/simpletest/tests/database_test.test b/core/modules/simpletest/tests/database_test.test index 2bedf1d9e087..c034972f5f4e 100644 --- a/core/modules/simpletest/tests/database_test.test +++ b/core/modules/simpletest/tests/database_test.test @@ -4,6 +4,7 @@ use Drupal\Database\Database; use Drupal\Database\StatementEmpty; use Drupal\Database\StatementInterface; use Drupal\Database\TransactionOutOfOrderException; +use Drupal\Database\TransactionNoActiveException; use Drupal\Database\Query\Merge; use Drupal\Database\Query\InvalidMergeQueryException; use Drupal\Database\Query\NoFieldsException;