SlaxWeb Framework
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SlaxWeb\Database\Query\Where\Predicate Class Reference

Public Member Functions

 convert (string $table)
 
 setColumn (string $column)
 
 setValue ($value, bool $prep=true, array $params=[])
 
 setOperator (string $operator)
 
 getParams ()
 
 _prepValues ($value)
 

Public Attributes

const OPR_EQUAL = "="
 
const OPR_DIFF = "<>"
 
const OPR_GRTR = ">"
 
const OPR_LESS = "<"
 
const OPR_GRTREQ = ">="
 
const OPR_LESSEQ = "<="
 
const OPR_IN = "IN"
 
const OPR_NOTIN = "NOT IN"
 
const OPR_LIKE = "LIKE"
 
const OPR_BTWN = "BETWEEN"
 
const OPR_NULL = "IS NULL"
 
const OPR_NOTNULL = "IS NOT NULL"
 

Protected Attributes

 $col = ""
 
 $val = null
 
 $opr = self::OPR_EQUAL
 
 $params = []
 

Member Function Documentation

SlaxWeb\Database\Query\Where\Predicate::_prepValues (   $value)

Prepare values

Prepare the values by replacing the actual value with the question mark placeholder and add the value to the 'params' array.

Parameters
mixed$valueValue to be prepared
Returns
mixed
SlaxWeb\Database\Query\Where\Predicate::convert ( string  $table)

Convert to string

Convert the Predicate to string. It checks that the value and the comparison operator are valid and an SQL DML can safely be constructed with those values. If not, an exception is thrown.

Parameters
string$tableTable name to prepend to columns
Returns
string
SlaxWeb\Database\Query\Where\Predicate::getParams ( )

Get parameters

Returns the list of parameters for this predicate.

Returns
array
SlaxWeb\Database\Query\Where\Predicate::setColumn ( string  $column)

Set column name

Sets the column name and returns itself for method call linking.

Parameters
string$columnColumn name
Returns
self
SlaxWeb\Database\Query\Where\Predicate::setOperator ( string  $operator)

Set comparison operator

Sets the comparison operator for the predicate and returns itself for method call linkint.

Parameters
string$operatorPredicate comparison operator
Returns
self
SlaxWeb\Database\Query\Where\Predicate::setValue (   $value,
bool  $prep = true,
array  $params = [] 
)

Set value

Sets the value for the predicate and returns itself for method call linking. If value is NULL or string("NULL"), it automatically sets the comparisson operator to self::OPR_NULL.

Parameters
mixed$valueValue of the predicate
bool$prepPrepare value, default bool(true)
array$paramsPredefined parameters, default []
Returns
self

Member Data Documentation

const SlaxWeb\Database\Query\Where\Predicate::OPR_EQUAL = "="

Comparison operators


The documentation for this class was generated from the following file: