Updated SQL generation logic in Model class.

* Found a bug with column values containing IS anywhere in the string.

 * Updated both the column check and value check to include a preceeding space (column) and trailing space (value) to correct the issue.
This commit is contained in:
Josh Sherman 2010-03-17 21:49:17 -04:00
parent a6b992014b
commit 8146c2584d

View file

@ -131,7 +131,7 @@ class Model extends Object
{
$sql .= $column . ' IN ("' . implode($value, '", "') . '") ';
}
elseif (strpos($column, 'IS') === false && strpos($value, 'IS') === false)
elseif (strpos($column, ' IS') === false && strpos($value, 'IS ') === false)
{
$sql .= $column . (preg_match('/(=|!=|<|>|LIKE)/', $column) ? ' ' : '= ') . ':';
$column = trim(str_replace(array('!', '=', '<', '>', 'LIKE'), '', $column));