lithium\data\source\Database::constraints()
Returns a string of formatted constraints to be inserted into the query statement.
If the query constraints are defined as an array, key pairs are converted to SQL
strings. If $key
is numeric and $value
is a string, $value
is treated as a literal
SQL fragment and returned.
Parameters
-
string|array
$constraints
The constraints for a
ON
clause. -
\lithium\data\model\Query
$context
-
array
$options
Available options are:
'prepend'
boolean|string: The string to prepend orfalse
for no prepending. Defaults to'ON'
.
Returns
stringReturns the ON
clause of an SQL query.
Source
public function constraints($constraints, $context, array $options = []) {
$defaults = ['prepend' => 'ON'];
$options += $defaults;
if (is_array($constraints)) {
$constraints = $this->_constraints($constraints);
}
return $this->_conditions($constraints, $context, $options);
}