Commit d5b018ce authored by Crell's avatar Crell
Browse files

Rename condition class and fix some namespace statements.

parent 05a4376f
......@@ -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 @@ protected function buildTableNameCondition($table_name, $operator = '=', $add_pr
$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;
......
......@@ -9,7 +9,7 @@
/**
* Generic class for a series of conditions in a query.
*/
class DatabaseCondition implements ConditionInterface, Countable {
class Condition implements ConditionInterface, Countable {
/**
* Array of conditions.
......
......@@ -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 @@ public function __construct(Connection $connection, $table, array $options = arr
parent::__construct($connection, $options);
$this->table = $table;
$this->condition = new DatabaseCondition('AND');
$this->condition = new Condition('AND');
}
/**
......
<?php
namespace Drupal\Database;
namespace Drupal\Database\Query;
use Exception;
......
......@@ -134,7 +134,7 @@ public function __construct(Connection $connection, $table, array $options = arr
parent::__construct($connection, $options);
$this->table = $table;
$this->conditionTable = $table;
$this->condition = new DatabaseCondition('AND');
$this->condition = new Condition('AND');
}
/**
......
<?php
namespace Drupal\Database;
namespace Drupal\Database\Query;
use Exception;
......
......@@ -67,14 +67,14 @@ class Select extends Query implements SelectInterface {
/**
* The conditional object for the WHERE clause.
*
* @var DatabaseCondition
* @var Condition
*/
protected $where;
/**
* The conditional object for the HAVING clause.
*
* @var DatabaseCondition
* @var Condition
*/
protected $having;
......@@ -119,8 +119,8 @@ class Select extends Query implements SelectInterface {
public function __construct($table, $alias = NULL, Connection $connection, $options = array()) {
$options['return'] = Database::RETURN_STATEMENT;
parent::__construct($connection, $options);
$this->where = new DatabaseCondition('AND');
$this->having = new DatabaseCondition('AND');
$this->where = new Condition('AND');
$this->having = new Condition('AND');
$this->addJoin(NULL, $table, $alias);
}
......
......@@ -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 @@ public function __construct(Connection $connection, $table, array $options = arr
parent::__construct($connection, $options);
$this->table = $table;
$this->condition = new DatabaseCondition('AND');
$this->condition = new Condition('AND');
}
/**
......
......@@ -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 @@ protected function buildTableNameCondition($table_name, $operator = '=', $add_pr
// 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);
......
<?php
use Drupal\Database\Database;
use Drupal\Database\Query\DatabaseCondition;
use Drupal\Database\Query\Condition;
/**
* @file
......@@ -530,28 +530,28 @@ function db_next_id($existing_id = 0) {
/**
* Returns a new DatabaseCondition, set to "OR" all conditions together.
*
* @return DatabaseCondition
* @return Condition
*/
function db_or() {
return new DatabaseCondition('OR');
return new Condition('OR');
}
/**
* Returns a new DatabaseCondition, set to "AND" all conditions together.
*
* @return DatabaseCondition
* @return Condition
*/
function db_and() {
return new DatabaseCondition('AND');
return new Condition('AND');
}
/**
* Returns a new DatabaseCondition, set to "XOR" all conditions together.
*
* @return DatabaseCondition
* @return Condition
*/
function db_xor() {
return new DatabaseCondition('XOR');
return new Condition('XOR');
}
/**
......@@ -562,10 +562,10 @@ function db_xor() {
*
* @param $conjunction
* The conjunction to use for query conditions (AND, OR or XOR).
* @return DatabaseCondition
* @return Condition
*/
function db_condition($conjunction) {
return new DatabaseCondition($conjunction);
return new Condition($conjunction);
}
/**
......
......@@ -92,7 +92,7 @@ public function execute() {
$this->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.
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment