Commit fc1bd6f3 authored by alexpott's avatar alexpott

Issue #2002344 by elvis2, heddn: Rename Views method add_where_expression() to...

Issue #2002344 by elvis2, heddn: Rename Views method add_where_expression() to addWhereExpression().
parent 1ea2d228
......@@ -247,7 +247,7 @@ public function query($use_groupby = FALSE) {
else {
$langcode_fallback_candidates[] = Language::LANGCODE_NOT_SPECIFIED;
}
$this->query->add_where_expression(0, "$column IN($placeholder) OR $column IS NULL", array($placeholder => $langcode_fallback_candidates));
$this->query->addWhereExpression(0, "$column IN($placeholder) OR $column IS NULL", array($placeholder => $langcode_fallback_candidates));
}
}
}
......
......@@ -84,7 +84,7 @@ public function query() {
// NULL means a history record doesn't exist. That's clearly new content.
// Unless it's very very old content. Everything in the query is already
// type safe cause none of it is coming from outside here.
$this->query->add_where_expression($this->options['group'], "($field IS NULL AND ($node.changed > (***CURRENT_TIME*** - $limit) $clause)) OR $field < $node.changed $clause2");
$this->query->addWhereExpression($this->options['group'], "($field IS NULL AND ($node.changed > (***CURRENT_TIME*** - $limit) $clause)) OR $field < $node.changed $clause2");
}
public function adminSummary() {
......
......@@ -21,7 +21,7 @@ class UidRevision extends Uid {
public function query($group_by = FALSE) {
$this->ensureMyTable();
$placeholder = $this->placeholder();
$this->query->add_where_expression(0, "$this->tableAlias.revision_uid = $placeholder OR ((SELECT COUNT(DISTINCT vid) FROM {node_field_revision} nfr WHERE nfr.revision_uid = $placeholder AND nfr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $this->argument));
$this->query->addWhereExpression(0, "$this->tableAlias.revision_uid = $placeholder OR ((SELECT COUNT(DISTINCT vid) FROM {node_field_revision} nfr WHERE nfr.revision_uid = $placeholder AND nfr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $this->argument));
}
}
......@@ -27,7 +27,7 @@ public function canExpose() { return FALSE; }
public function query() {
$table = $this->ensureMyTable();
$this->query->add_where_expression($this->options['group'], "$table.status = 1 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***BYPASS_NODE_ACCESS*** = 1");
$this->query->addWhereExpression($this->options['group'], "$table.status = 1 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***BYPASS_NODE_ACCESS*** = 1");
}
}
......@@ -26,7 +26,7 @@ public function query($group_by = FALSE) {
$args = array_values($this->value);
$this->query->add_where_expression($this->options['group'], "$this->tableAlias.uid IN($placeholder) OR
$this->query->addWhereExpression($this->options['group'], "$this->tableAlias.uid IN($placeholder) OR
((SELECT COUNT(DISTINCT vid) FROM {node_field_revision} nfr WHERE nfr.revision_uid IN ($placeholder) AND nfr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $args),
$args);
}
......
......@@ -304,15 +304,15 @@ function add_filter() {
$placeholders = array(
$placeholder => $value,
) + $this->placeholders;
$this->handler->query->add_where_expression($options['group'], "$field $operator", $placeholders);
$this->handler->query->addWhereExpression($options['group'], "$field $operator", $placeholders);
}
else {
$placeholder = $this->placeholder();
if (count($this->handler->value) > 1) {
$this->query->add_where_expression(0, "$field $operator($placeholder)", array($placeholder => $value));
$this->query->addWhereExpression(0, "$field $operator($placeholder)", array($placeholder => $value));
}
else {
$this->handler->query->add_where_expression(0, "$field $operator $placeholder", array($placeholder => $value));
$this->handler->query->addWhereExpression(0, "$field $operator $placeholder", array($placeholder => $value));
}
}
}
......
......@@ -109,11 +109,11 @@ public function query($group_by = FALSE) {
if (count($this->value) > 1) {
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
$this->query->add_where_expression(0, "$this->tableAlias.$this->realField $operator($placeholder) $null_check", array($placeholder => $this->value));
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator($placeholder) $null_check", array($placeholder => $this->value));
}
else {
$operator = empty($this->options['not']) ? '=' : '!=';
$this->query->add_where_expression(0, "$this->tableAlias.$this->realField $operator $placeholder $null_check", array($placeholder => $this->argument));
$this->query->addWhereExpression(0, "$this->tableAlias.$this->realField $operator $placeholder $null_check", array($placeholder => $this->argument));
}
}
......
......@@ -234,7 +234,7 @@ public function query($group_by = FALSE) {
$placeholders = array(
$placeholder => $argument,
);
$this->query->add_where_expression(0, $field, $placeholders);
$this->query->addWhereExpression(0, $field, $placeholders);
}
else {
$this->query->addWhere(0, $field, $argument, $operator);
......
......@@ -93,42 +93,42 @@ public function query() {
function opEqual($expression) {
$placeholder = $this->placeholder();
$operator = $this->operator();
$this->query->add_where_expression($this->options['group'], "$expression $operator $placeholder", array($placeholder => $this->value));
$this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => $this->value));
}
protected function opContains($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
$this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
}
protected function opStartsWith($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
$this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
}
protected function opNotStartsWith($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
$this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => db_like($this->value) . '%'));
}
protected function opEndsWith($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
$this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
}
protected function opNotEnds($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
$this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value)));
}
protected function opNotLike($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
$this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . db_like($this->value) . '%'));
}
protected function opRegex($expression) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "$expression RLIKE $placeholder", array($placeholder => $this->value));
$this->query->addWhereExpression($this->options['group'], "$expression RLIKE $placeholder", array($placeholder => $this->value));
}
protected function opEmpty($expression) {
......@@ -139,7 +139,7 @@ protected function opEmpty($expression) {
$operator = "IS NOT NULL";
}
$this->query->add_where_expression($this->options['group'], "$expression $operator");
$this->query->addWhereExpression($this->options['group'], "$expression $operator");
}
}
......@@ -175,7 +175,7 @@ protected function opBetween($field) {
// This is safe because we are manually scrubbing the values.
// It is necessary to do it this way because $a and $b are formulas when using an offset.
$operator = strtoupper($this->operator);
$this->query->add_where_expression($this->options['group'], "$field $operator $a AND $b");
$this->query->addWhereExpression($this->options['group'], "$field $operator $a AND $b");
}
protected function opSimple($field) {
......@@ -185,7 +185,7 @@ protected function opSimple($field) {
}
// This is safe because we are manually scrubbing the value.
// It is necessary to do it this way because $value is a formula when using an offset.
$this->query->add_where_expression($this->options['group'], "$field $this->operator $value");
$this->query->addWhereExpression($this->options['group'], "$field $this->operator $value");
}
}
......@@ -323,12 +323,12 @@ protected function opNotLike($field) {
protected function opShorterThan($field) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "LENGTH($field) < $placeholder", array($placeholder => $this->value));
$this->query->addWhereExpression($this->options['group'], "LENGTH($field) < $placeholder", array($placeholder => $this->value));
}
protected function opLongerThan($field) {
$placeholder = $this->placeholder();
$this->query->add_where_expression($this->options['group'], "LENGTH($field) > $placeholder", array($placeholder => $this->value));
$this->query->addWhereExpression($this->options['group'], "LENGTH($field) > $placeholder", array($placeholder => $this->value));
}
protected function opRegex($field) {
......
......@@ -857,7 +857,7 @@ public function addWhere($group, $field, $value = NULL, $operator = NULL) {
*
* @see QueryConditionInterface::where()
*/
function add_where_expression($group, $snippet, $args = array()) {
public function addWhereExpression($group, $snippet, $args = array()) {
// Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
// the default group.
if (empty($group)) {
......
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