Upstream patch: Enable ORM to use column name in where clause

This commit is contained in:
Deon George 2011-08-24 05:36:23 +10:00
parent 27684fc865
commit f272bc254d

View File

@ -114,6 +114,11 @@ abstract class Kohana_Database_Query_Builder extends Database_Query {
{
$value = $db->quote($value);
}
elseif (is_string($value) AND preg_match('/^=/',$value))
{
// Value is a column
$value = $db->quote_column(preg_replace('/^=/','',$value));
}
elseif ((is_string($value) AND array_key_exists($value, $this->_parameters)) === FALSE)
{
// Quote the value, it is not a parameter