Skip to content

Commit

Permalink
Test unary expr
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Sep 22, 2015
1 parent b4941e0 commit 8ccbf56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/SQLBuilder/Bind.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function getMarker() {
return ':' . $this->name;
}


/**
* The compare method only compares value.
*/
public function compare(Bind $b)
{
return $this->value === $b->value;
Expand Down
16 changes: 12 additions & 4 deletions src/SQLBuilder/Universal/Syntax/Conditions.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function compare(Conditions $conditions)
if (! $b->operand2 instanceof Bind) {
return false;
}
if ($a->operand2->value !== $b->operand2->value) {
if ($a->operand2->compare($b)) {
return false;
}
} else {
Expand All @@ -262,10 +262,18 @@ public function compare(Conditions $conditions)
if ($a->op !== $b->op) {
return false;
}
if ($a->operand !== $b->operand) {
return false;
if ($a->operand instanceof Bind) {
if (! $b->operand instanceof Bind) {
return false;
}
if ($a->operand->compare($b)) {
return false;
}
} else {
if ($a->operand !== $b->operand) {
return false;
}
}

}
}

Expand Down

0 comments on commit 8ccbf56

Please sign in to comment.