diff --git a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php index e895aae95..8c2c26a2c 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php @@ -21,7 +21,7 @@ $this->operation = $condition->attrs->operation; $this->pipe = $condition->attrs->pipe; $dbParser = DB::getParser(); - $this->column_name = $dbParser->parseColumnName($condition->attrs->column); + $this->column_name = $dbParser->parseExpression($condition->attrs->column); // If default value is column name, it should be escaped if($isColumnName = strpos($condition->attrs->default, '.')){ diff --git a/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php b/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php index 773c4b990..97fc5a4b0 100644 --- a/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php +++ b/test-phpUnit/db/xml_query/mysql/MysqlSelectTest.php @@ -80,4 +80,11 @@ and `item`.`item_srl` = 10'; $this->_test($xml_file, $argsString, $expected); } + + function testSubstring(){ + $xml_file = _TEST_PATH_ . "db/xml_query/mysql/data/substring.xml"; + $argsString = '$args->var_start_mmdd = "1102"; '; + $expected = 'select * from `xe_member` as `member` where substr(`extra_vars_t1`.`value`,5,4) >= 1102'; + $this->_test($xml_file, $argsString, $expected); + } } \ No newline at end of file diff --git a/test-phpUnit/db/xml_query/mysql/data/substring.xml b/test-phpUnit/db/xml_query/mysql/data/substring.xml new file mode 100644 index 000000000..fef155bec --- /dev/null +++ b/test-phpUnit/db/xml_query/mysql/data/substring.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file