diff --git a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php index 236a6ba3a..32d872d9f 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php @@ -59,7 +59,7 @@ if($isColumnName = (strpos($condition->attrs->default, '.') !== false && strpos($condition->attrs->default, '%') === false )) { - $condition->attrs->default = $dbParser->parseColumnName($condition->attrs->default); + $condition->attrs->default = $dbParser->parseExpression($condition->attrs->default); } if($condition->node_name == 'query') diff --git a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php b/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php index 667458ef2..b74266cdc 100644 --- a/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php +++ b/tests/classes/db/db/xml_query/mysql/MysqlSelectTest.php @@ -342,4 +342,22 @@ class MysqlSelectTest extends MysqlTest { $this->_test($xml_file, $argsString, $expected); } + + /** + * Issue 2213 + * http://code.google.com/p/xe-core/issues/detail?id=2213 + * + * @author Corina Udrescu (dev@xpressengine.org) + */ + function testSumInCondition() + { + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/sumInCondition.xml"; + $argsString = ''; + $expected = 'select * + from `xe_test11` as `a` + where `site_srl` = 0 + and `price` <= `a`.`pa_1`+`a`.`pa_2`'; + $this->_test($xml_file, $argsString, $expected); + + } } \ No newline at end of file diff --git a/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml b/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml new file mode 100644 index 000000000..b5353f374 --- /dev/null +++ b/tests/classes/db/db/xml_query/mysql/data/sumInCondition.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +