ComparisonTrait
+ Inheritance diagram for ComparisonTrait:

Description

Comparative functions.

Because SQLite doesn't have the ANY/ALL comparison operators, subqueries are instead nested and correlated using EXISTS or NOT EXISTS, which requires the first column of the subquery to have a name or alias so it's referable.

Public Methods

Predicate is ($arg)
 Null-safe type-strict equality. More...
 
Predicate isBetween ($min, $max)
 $this BETWEEN $min AND $max (inclusive) More...
 
Predicate isEqual ($arg)
 See Predicate::match(). More...
 
Predicate isFalse ()
 $this IS FALSE More...
 
Predicate isGt ($arg)
 $this > $arg, or driver-appropriate $this > ALL (SELECT ...) More...
 
Predicate isGtAny (Select $select)
 Driver-appropriate $this > ANY (SELECT ...) More...
 
Predicate isGte ($arg)
 $this >= $arg, or driver-appropriate $this >= ALL (SELECT ...) More...
 
Predicate isGteAny (Select $select)
 Driver-appropriate $this >= ANY (SELECT ...) More...
 
Predicate isLike (string $pattern)
 $this LIKE $pattern More...
 
Predicate isLt ($arg)
 $this < $arg, or driver-appropriate $this < ALL (SELECT ...) More...
 
Predicate isLtAny (Select $select)
 Driver-appropriate $this < ANY (SELECT ...) More...
 
Predicate isLte ($arg)
 $this <= $arg, or driver-appropriate $this <= ALL (SELECT ...) More...
 
Predicate isLteAny (Select $select)
 Driver-appropriate $this <= ANY (SELECT ...) More...
 
Predicate isNot ($arg)
 Null-safe type-strict inequality. More...
 
Predicate isNotBetween ($min, $max)
 $this NOT BETWEEN $min AND $max (inclusive) More...
 
Predicate isNotEqual ($arg)
 $this <> $arg or $this NOT IN ($arg) More...
 
Predicate isNotLike (string $pattern)
 $this NOT LIKE $pattern More...
 
Predicate isNotNull ()
 $this IS NOT NULL More...
 
Predicate isNotRegExp (string $pattern)
 $this NOT REGEXP $pattern More...
 
Predicate isNull ()
 $this IS NULL More...
 
Predicate isRegExp (string $pattern)
 $this REGEXP $pattern More...
 
Branch switch (array $values=[])
 CASE $this ... More...
 

Methods

◆ is()

Predicate is (   $arg)

Null-safe type-strict equality.

  • Mysql: $this <=> $arg, or $this <=> ANY ($arg)
  • SQLite: $this IS $arg, or EXISTS (... WHERE $this IS $arg[0])
Parameters
null | scalar | EntityInterface | Select | ValueInterface$arg
Returns
Predicate

◆ isBetween()

Predicate isBetween (   $min,
  $max 
)

$this BETWEEN $min AND $max (inclusive)

Parameters
number$min
number$max
Returns
Predicate

◆ isEqual()

Predicate isEqual (   $arg)

See Predicate::match().

Parameters
null | scalar | array | Closure | EntityInterface | Select | ValueInterface$arg
Returns
Predicate

◆ isFalse()

Predicate isFalse ( )

$this IS FALSE

Returns
Predicate

◆ isGt()

Predicate isGt (   $arg)

$this > $arg, or driver-appropriate $this > ALL (SELECT ...)

Parameters
number | string | Select$arg
Returns
Predicate

◆ isGtAny()

Predicate isGtAny ( Select  $select)

Driver-appropriate $this > ANY (SELECT ...)

Parameters
Select$select
Returns
Predicate

◆ isGte()

Predicate isGte (   $arg)

$this >= $arg, or driver-appropriate $this >= ALL (SELECT ...)

Parameters
number | string | Select$arg
Returns
Predicate

◆ isGteAny()

Predicate isGteAny ( Select  $select)

Driver-appropriate $this >= ANY (SELECT ...)

Parameters
Select$select
Returns
Predicate

◆ isLike()

Predicate isLike ( string  $pattern)

$this LIKE $pattern

Parameters
string$pattern
Returns
Predicate

◆ isLt()

Predicate isLt (   $arg)

$this < $arg, or driver-appropriate $this < ALL (SELECT ...)

Parameters
number | string | Select$arg
Returns
Predicate

◆ isLtAny()

Predicate isLtAny ( Select  $select)

Driver-appropriate $this < ANY (SELECT ...)

Parameters
Select$select
Returns
Predicate

◆ isLte()

Predicate isLte (   $arg)

$this <= $arg, or driver-appropriate $this <= ALL (SELECT ...)

Parameters
number | string | Select$arg
Returns
Predicate

◆ isLteAny()

Predicate isLteAny ( Select  $select)

Driver-appropriate $this <= ANY (SELECT ...)

Parameters
Select$select
Returns
Predicate

◆ isNot()

Predicate isNot (   $arg)

Null-safe type-strict inequality.

Parameters
null | scalar | EntityInterface | Select | ValueInterface$arg
Returns
Predicate

◆ isNotBetween()

Predicate isNotBetween (   $min,
  $max 
)

$this NOT BETWEEN $min AND $max (inclusive)

Parameters
number$min
number$max
Returns
Predicate

◆ isNotEqual()

Predicate isNotEqual (   $arg)

$this <> $arg or $this NOT IN ($arg)

Parameters
null | scalar | array | EntityInterface | Select | ValueInterface$arg
Returns
Predicate

◆ isNotLike()

Predicate isNotLike ( string  $pattern)

$this NOT LIKE $pattern

Parameters
string$pattern
Returns
Predicate

◆ isNotNull()

Predicate isNotNull ( )

$this IS NOT NULL

Returns
Predicate

◆ isNotRegExp()

Predicate isNotRegExp ( string  $pattern)

$this NOT REGEXP $pattern

Parameters
string$pattern
Returns
Predicate

◆ isNull()

Predicate isNull ( )

$this IS NULL

Returns
Predicate

◆ isRegExp()

Predicate isRegExp ( string  $pattern)

$this REGEXP $pattern

Parameters
string$pattern
Returns
Predicate

◆ switch()

Branch switch ( array  $values = [])

CASE $this ...

END

If $values are given, the keys are quoted as literal values.

Omit $values and use Branch::when() if you need expressions for the WHEN clause.

Parameters
array$values[when => then]
Returns
Branch