Merge remote-tracking branch 'origin' into dev-sql-escape

This commit is contained in:
Dave Mc Nicoll committed 2020-04-09 10:00:48 -04:00
commit def8decb4e
18 files changed
+246 -26

No files matched your search

+15 -5
View File
@@ -143,7 +143,13 @@ class QueryBuilder
public function open(string $condition = Query\Where::CONDITION_AND) : self
{
if ( null !== ($this->where ?? false) ) {
if ( null !== ($this->where ?? null) ) {
$this->where->conditionList[] = $new = new Query\Where($this, $condition);
$this->where = $new;
}
else {
$this->where = new Query\Where($this, $condition);
$this->push($this->where);
$this->where->conditionList[] = $new = new Query\Where($this, $condition);
$this->where = $new;
}
@@ -153,7 +159,13 @@ class QueryBuilder
public function close() : self
{
if ( null !== ($this->where ?? false) && $this->where->parent ) {
if ( null !== ($this->where ?? null) && $this->where->parent ) {
# if an enclosure was opened, and nothing done, we must remove the unused node
if ( empty($this->where->conditionList) && (count($this->where->parent->conditionList) === 1) ) {
unset($this->where->parent->conditionList);
}
$this->where = $this->where->parent;
}
@@ -171,6 +183,7 @@ class QueryBuilder
}
$this->whereConditionOperator = $operator;
$where->add($field, $value, $operator, $condition, $not);
return $this;
@@ -200,7 +213,6 @@ class QueryBuilder
public function groupBy() : self
{
return $this;
}
@@ -242,8 +254,6 @@ class QueryBuilder
public function join(string $type, /*string | QueryBuilder*/ $table, $field, $value, bool $outer = false) : self
{
#if ( null === $join = $this->getFragment(Query\Join::class) ) {#}
$join = new Query\Join($this);
$this->push($join);
$join->set($type, $table, $field, $value);