Nextcloud PHP API (stable18)

IExpressionBuilder

This class provides a wrapper around Doctrine's ExpressionBuilder

Tags
since
8.2.0

Table of Contents

EQ  = DoctrineDBALQueryExpressionExpressionBuilder::EQ
GT  = DoctrineDBALQueryExpressionExpressionBuilder::GT
GTE  = DoctrineDBALQueryExpressionExpressionBuilder::GTE
LT  = DoctrineDBALQueryExpressionExpressionBuilder::LT
LTE  = DoctrineDBALQueryExpressionExpressionBuilder::LTE
NEQ  = DoctrineDBALQueryExpressionExpressionBuilder::NEQ
andX()  : ICompositeExpression
Creates a conjunction of the given boolean expressions.
bitwiseAnd()  : IQueryFunction
Creates a bitwise AND comparison
bitwiseOr()  : IQueryFunction
Creates a bitwise OR comparison
castColumn()  : string
Returns a IQueryFunction that casts the column to the given type
comparison()  : string
Creates a comparison expression.
emptyString()  : string
Creates a $x = '' statement, because Oracle needs a different check
eq()  : string
Creates an equality comparison expression with the given arguments.
gt()  : string
Creates a greater-than comparison expression with the given arguments.
gte()  : string
Creates a greater-than-equal comparison expression with the given arguments.
iLike()  : string
Creates a ILIKE() comparison expression with the given arguments.
in()  : string
Creates a IN () comparison expression with the given arguments.
isNotNull()  : string
Creates an IS NOT NULL expression with the given arguments.
isNull()  : string
Creates an IS NULL expression with the given arguments.
like()  : string
Creates a LIKE() comparison expression with the given arguments.
literal()  : string
Quotes a given input parameter.
lt()  : string
Creates a lower-than comparison expression with the given arguments.
lte()  : string
Creates a lower-than-equal comparison expression with the given arguments.
neq()  : string
Creates a non equality comparison expression with the given arguments.
nonEmptyString()  : string
Creates a `$x <> ''` statement, because Oracle needs a different check
notIn()  : string
Creates a NOT IN () comparison expression with the given arguments.
notLike()  : string
Creates a NOT LIKE() comparison expression with the given arguments.
orX()  : ICompositeExpression
Creates a disjunction of the given boolean expressions.

Constants

EQ

public mixed EQ = DoctrineDBALQueryExpressionExpressionBuilder::EQ
Tags
since
9.0.0

GT

public mixed GT = DoctrineDBALQueryExpressionExpressionBuilder::GT
Tags
since
9.0.0

GTE

public mixed GTE = DoctrineDBALQueryExpressionExpressionBuilder::GTE
Tags
since
9.0.0

LT

public mixed LT = DoctrineDBALQueryExpressionExpressionBuilder::LT
Tags
since
9.0.0

LTE

public mixed LTE = DoctrineDBALQueryExpressionExpressionBuilder::LTE
Tags
since
9.0.0

NEQ

public mixed NEQ = DoctrineDBALQueryExpressionExpressionBuilder::NEQ
Tags
since
9.0.0

Methods

andX()

Creates a conjunction of the given boolean expressions.

public andX(mixed ...$x) : ICompositeExpression

Example:

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

Parameters
$x : mixed

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

Tags
since
8.2.0
Return values
ICompositeExpression

castColumn()

Returns a IQueryFunction that casts the column to the given type

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

One of IQueryBuilder::PARAM_*

Tags
since
9.0.0
Return values
string

comparison()

Creates a comparison expression.

public comparison(mixed $x, string $operator, mixed $y[, mixed|null $type = null ]) : string
Parameters
$x : mixed

The left expression.

$operator : string

One of the IExpressionBuilder::* constants.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

emptyString()

Creates a $x = '' statement, because Oracle needs a different check

public emptyString(string $x) : string
Parameters
$x : string

The field in string format to be inspected by the comparison.

Tags
since
13.0.0
Return values
string

eq()

Creates an equality comparison expression with the given arguments.

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

gt()

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

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

gte()

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

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

iLike()

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

public iLike(string $x, mixed $y[, mixed|null $type = null ]) : string
Parameters
$x : string

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

$y : mixed

Argument to be used in ILIKE() comparison.

$type : mixed|null = null

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

Tags
since
9.0.0
Return values
string

in()

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

public in(string $x, string|array $y[, mixed|null $type = null ]) : string
Parameters
$x : string

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

$y : string|array

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

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

isNotNull()

Creates an IS NOT NULL expression with the given arguments.

public isNotNull(string $x) : string
Parameters
$x : string

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

Tags
since
8.2.0
Return values
string

isNull()

Creates an IS NULL expression with the given arguments.

public isNull(string $x) : string
Parameters
$x : string

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

Tags
since
8.2.0
Return values
string

like()

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

public like(string $x, mixed $y[, mixed|null $type = null ]) : string
Parameters
$x : string

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

$y : mixed

Argument to be used in LIKE() comparison.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

literal()

Quotes a given input parameter.

public literal(mixed $input[, mixed|null $type = null ]) : string
Parameters
$input : mixed

The parameter to be quoted.

$type : mixed|null = null

One of the IQueryBuilder::PARAM_* constants

Tags
since
8.2.0
Return values
string

lt()

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

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

lte()

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

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

neq()

Creates a non equality comparison expression with the given arguments.

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

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

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

The left expression.

$y : mixed

The right expression.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

nonEmptyString()

Creates a `$x <> ''` statement, because Oracle needs a different check

public nonEmptyString(string $x) : string
Parameters
$x : string

The field in string format to be inspected by the comparison.

Tags
since
13.0.0
Return values
string

notIn()

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

public notIn(string $x, string|array $y[, mixed|null $type = null ]) : string
Parameters
$x : string

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

$y : string|array

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

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

notLike()

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

public notLike(string $x, mixed $y[, mixed|null $type = null ]) : string
Parameters
$x : string

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

$y : mixed

Argument to be used in NOT LIKE() comparison.

$type : mixed|null = null

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

Tags
since
8.2.0
  • Parameter $type was added in 9.0.0
Return values
string

orX()

Creates a disjunction of the given boolean expressions.

public orX(mixed ...$x) : ICompositeExpression

Example:

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

Parameters
$x : mixed

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

Tags
since
8.2.0
Return values
ICompositeExpression

Search results