Permalink
Browse files

When field not exists in ->where clause it will not use . and tablena…

…me so you can mock other commands in where such as LOWER and others
  • Loading branch information...
1 parent b473860 commit dca48983b9144dc8782ce3c1610346dce09be886 @klederson klederson committed Jun 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/libs/Dialect/Dialect.php
View
3 app/libs/Dialect/Dialect.php
@@ -282,8 +282,9 @@ public function getWhereString($pk, $pkField) {
$value['end'] = is_numeric($value['end']) || strpos($value['end'], 'LIKE (') !== false ? $value['end'] : sprintf("'%s'", $value['end']);
$value['end'] = strpos($value['end'], 'LIKE (') !== FALSE ? stripslashes($value['end']) : $value['end'];
+ $fieldName = $fieldInfo['field']['tableReference'] != NULL ? sprintf("%s.%s",$fieldInfo['field']['tableReference'],$value['start']) : $value['start'];
$whereConditions[$value['group']] .= empty($whereConditions[$value['group']]) ? "" : sprintf(" %s ", $value['condition']);
- $whereConditions[$value['group']] .= sprintf(' %s.%s %s %s ', $fieldInfo['field']['tableReference'], $value['start'], $value['operator'], ($value['end']));
+ $whereConditions[$value['group']] .= sprintf(' %s %s %s ', $fieldName, $value['operator'], ($value['end']));
}
}
} else {

0 comments on commit dca4898

Please sign in to comment.