Issue 344 - error occurrence when using substr() in XML Query condition.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9483 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-10-04 15:07:23 +00:00
parent 36211cb65b
commit c368fa189c
3 changed files with 19 additions and 1 deletions

View file

@ -21,7 +21,7 @@
$this->operation = $condition->attrs->operation; $this->operation = $condition->attrs->operation;
$this->pipe = $condition->attrs->pipe; $this->pipe = $condition->attrs->pipe;
$dbParser = DB::getParser(); $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 default value is column name, it should be escaped
if($isColumnName = strpos($condition->attrs->default, '.')){ if($isColumnName = strpos($condition->attrs->default, '.')){

View file

@ -80,4 +80,11 @@
and `item`.`item_srl` = 10'; and `item`.`item_srl` = 10';
$this->_test($xml_file, $argsString, $expected); $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);
}
} }

View file

@ -0,0 +1,11 @@
<query id="substringTest" action="select">
<tables>
<table name="member" alias="member" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="more" column="substr(extra_vars_t1.value,5,4)" var="var_start_mmdd" notnull="notnull" pipe="and" />
</conditions>
</query>