diff options
author | Jamie Matthews <[email protected]> | 2010-10-25 18:46:51 +0100 |
---|---|---|
committer | Jamie Matthews <[email protected]> | 2010-10-25 18:46:51 +0100 |
commit | 09a8877d6781d199af128126956d251809f574ce (patch) | |
tree | 56331426ca1824c662cf9e9b8913f2c0b0a199e7 /idiorm.php | |
parent | f2bc5aa33704b3d7f17ab905b8abfb0ec43dd76a (diff) |
Add support for unescaped string constraints
Diffstat (limited to 'idiorm.php')
-rw-r--r-- | idiorm.php | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -407,7 +407,9 @@ * * The table should be the name of the table to join to. * - * The constraint should be an array with three elements: + * The constraint may be either a string or an array with three elements. If it + * is a string, it will be compiled into the query as-is, with no escaping. The + * recommended way to supply the constraint is as an array with three elements: * * first_column, operator, second_column * @@ -432,10 +434,12 @@ } // Build the constraint - list($first_column, $operator, $second_column) = $constraint; - $first_column = $this->_quote_identifier($first_column); - $second_column = $this->_quote_identifier($second_column); - $constraint = "{$first_column} {$operator} {$second_column}"; + if (is_array($constraint)) { + list($first_column, $operator, $second_column) = $constraint; + $first_column = $this->_quote_identifier($first_column); + $second_column = $this->_quote_identifier($second_column); + $constraint = "{$first_column} {$operator} {$second_column}"; + } $this->_join_sources[] = "{$join_operator} {$table} ON {$constraint}"; return $this; |