83 if (is_array(
$y) && count(
$y) === 1) {
98 foreach ((array)
$y as $val) {
101 $val =
"BINARY $val";
103 $parts[] = $qb->expr()->$func(
$x, $val);
106 return $qb->
merge($parts, $boolean);
109 switch (strtolower($this->comparison)) {
114 $x =
"CAST($x as BINARY)";
119 $match_expr = $qb->expr()->in(
$x, $param);
121 }
else if (isset(
$y)) {
123 $match_expr = $qb->expr()->eq(
$x, $param);
133 $x =
"CAST($x as BINARY)";
138 $match_expr = $qb->expr()->notIn(
$x, $param);
140 }
else if (isset(
$y)) {
142 $match_expr = $qb->expr()->neq(
$x, $param);
148 return $compare_with(
'like');
151 return $compare_with(
'notLike',
'AND');
155 return $compare_with(
'gt');
159 return $compare_with(
'lt');
163 return $compare_with(
'gte');
167 return $compare_with(
'lte');
170 return $qb->expr()->isNull(
$x);
173 return $qb->expr()->isNotNull(
$x);
176 return "EXISTS ($y)";
179 return "NOT EXISTS ($y)";
182 throw new \InvalidParameterException(
"'{$this->comparison}' is not a supported comparison operator");
Utility class for building composite comparison expression.
static normalizeGuids(...$args)
Flatten an array of data into an array of GUIDs.
const ELGG_VALUE_INTEGER
Value types.
Database abstraction query builder.
__construct($x, $comparison, $y=null, $type=null, $case_sensitive=null)
Constructor.
static normalizeTimestamp($time)
Returns timestamp value of the time representation.
static normalizeIds(...$args)
Prepare IDs.
param($value, $type=null, $key=null)
Sets a new parameter assigning it a unique parameter key/name if none provided Returns the name of th...
const ELGG_VALUE_TIMESTAMP
prepare(QueryBuilder $qb, $table_alias=null)
{Build an expression and/or apply it to an instance of query builder.Query builder Table aliasComposi...
Interface that allows resolving statements and/or extending query builder.
merge($parts=null, $boolean= 'AND')
Merges multiple composite expressions with a boolean.