mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 23:29:57 +09:00
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:
parent
36211cb65b
commit
c368fa189c
3 changed files with 19 additions and 1 deletions
|
|
@ -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, '.')){
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
11
test-phpUnit/db/xml_query/mysql/data/substring.xml
Normal file
11
test-phpUnit/db/xml_query/mysql/data/substring.xml
Normal 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>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue