\OCP\DB\QueryBuilderIExpressionBuilder

This class provides a wrapper around Doctrine's ExpressionBuilder

Summary

Methods
Constants
andX()
orX()
comparison()
eq()
neq()
lt()
lte()
gt()
gte()
isNull()
isNotNull()
like()
notLike()
iLike()
in()
notIn()
literal()
castColumn()
length()
EQ
NEQ
LT
LTE
GT
GTE
No protected methods found
N/A
No private methods found
N/A

Constants

EQ

EQ

NEQ

NEQ

LT

LT

LTE

LTE

GT

GT

GTE

GTE

Methods

andX()

andX(mixed  $x = null) : \OCP\DB\QueryBuilder\ICompositeExpression

Creates a conjunction of the given boolean expressions.

Example:

[php]
// (u.type = ?) AND (u.role = ?)
$expr->andX('u.type = ?', 'u.role = ?'));

Parameters

mixed $x

Optional clause. Defaults = null, but requires at least one defined when converting to string.

Returns

\OCP\DB\QueryBuilder\ICompositeExpression

orX()

orX(mixed  $x = null) : \OCP\DB\QueryBuilder\ICompositeExpression

Creates a disjunction of the given boolean expressions.

Example:

[php]
// (u.type = ?) OR (u.role = ?)
$qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));

Parameters

mixed $x

Optional clause. Defaults = null, but requires at least one defined when converting to string.

Returns

\OCP\DB\QueryBuilder\ICompositeExpression

comparison()

comparison(mixed  $x, string  $operator, mixed  $y, mixed|null  $type = null) : string

Creates a comparison expression.

Parameters

mixed $x

The left expression.

string $operator

One of the IExpressionBuilder::* constants.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

eq()

eq(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates an equality comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a = . Example:

[php]
// u.id = ?
$expr->eq('u.id', '?');

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

neq()

neq(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates a non equality comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a <> . Example:

[php]
// u.id <> 1
$q->where($q->expr()->neq('u.id', '1'));

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

lt()

lt(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates a lower-than comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a < . Example:

[php]
// u.id < ?
$q->where($q->expr()->lt('u.id', '?'));

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

lte()

lte(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates a lower-than-equal comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a <= . Example:

[php]
// u.id <= ?
$q->where($q->expr()->lte('u.id', '?'));

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

gt()

gt(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates a greater-than comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a > . Example:

[php]
// u.id > ?
$q->where($q->expr()->gt('u.id', '?'));

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

gte()

gte(mixed  $x, mixed  $y, mixed|null  $type = null) : string

Creates a greater-than-equal comparison expression with the given arguments.

First argument is considered the left expression and the second is the right expression. When converted to string, it will generated a >= . Example:

[php]
// u.id >= ?
$q->where($q->expr()->gte('u.id', '?'));

Parameters

mixed $x

The left expression.

mixed $y

The right expression.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

isNull()

isNull(string  $x) : string

Creates an IS NULL expression with the given arguments.

Parameters

string $x

The field in string format to be restricted by IS NULL.

Returns

string

isNotNull()

isNotNull(string  $x) : string

Creates an IS NOT NULL expression with the given arguments.

Parameters

string $x

The field in string format to be restricted by IS NOT NULL.

Returns

string

like()

like(string  $x, mixed  $y, mixed|null  $type = null) : string

Creates a LIKE() comparison expression with the given arguments.

Parameters

string $x

Field in string format to be inspected by LIKE() comparison.

mixed $y

Argument to be used in LIKE() comparison.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

notLike()

notLike(string  $x, mixed  $y, mixed|null  $type = null) : string

Creates a NOT LIKE() comparison expression with the given arguments.

Parameters

string $x

Field in string format to be inspected by NOT LIKE() comparison.

mixed $y

Argument to be used in NOT LIKE() comparison.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

iLike()

iLike(string  $x, mixed  $y, mixed|null  $type = null) : string

Creates a ILIKE() comparison expression with the given arguments.

Parameters

string $x

Field in string format to be inspected by ILIKE() comparison.

mixed $y

Argument to be used in ILIKE() comparison.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

in()

in(string  $x, string|array  $y, mixed|null  $type = null) : string

Creates a IN () comparison expression with the given arguments.

Parameters

string $x

The field in string format to be inspected by IN() comparison.

string|array $y

The placeholder or the array of values to be used by IN() comparison.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

notIn()

notIn(string  $x, string|array  $y, mixed|null  $type = null) : string

Creates a NOT IN () comparison expression with the given arguments.

Parameters

string $x

The field in string format to be inspected by NOT IN() comparison.

string|array $y

The placeholder or the array of values to be used by NOT IN() comparison.

mixed|null $type

one of the IQueryBuilder::PARAM_* constants required when comparing text fields for oci compatibility

Returns

string

literal()

literal(mixed  $input, mixed|null  $type = null) : string

Quotes a given input parameter.

Parameters

mixed $input

The parameter to be quoted.

mixed|null $type

One of the IQueryBuilder::PARAM_* constants

Returns

string

castColumn()

castColumn(string  $column, mixed  $type) : string

Returns a IQueryFunction that casts the column to the given type

Parameters

string $column
mixed $type

One of IQueryBuilder::PARAM_*

Returns

string

length()

length(  $column) : string

Parameters

$column

Returns

string