lithium\data\source\Database::constraints()

public method

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 or false for no prepending. Defaults to 'ON'.

Returns

string

Returns the ON clause of an SQL query.

Source

	public function constraints($constraints, $context, array $options = array()) {
		$defaults = array('prepend' => 'ON');
		$options += $defaults;

		if (is_array($constraints)) {
			$constraints = $this->_constraints($constraints);
		}
		return $this->_conditions($constraints, $context, $options);
	}