mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Fix for xml condition tag - when no "var" attribute existed, functions were not evaluated (e.g. "curdate").
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9785 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ef059ba669
commit
3928e8ec37
2 changed files with 30 additions and 11 deletions
|
|
@ -37,19 +37,29 @@
|
|||
$this->argument_name = $this->argument->getArgumentName();
|
||||
}
|
||||
else {
|
||||
$default_value = $condition->attrs->default;
|
||||
if(isset($default_value)){
|
||||
if($isColumnName){
|
||||
$default_value = "'" . $default_value . "'";
|
||||
}
|
||||
else if(in_array($this->operation, array('in', 'between', 'not in')))
|
||||
$default_value = "\"" . $default_value . "\"";
|
||||
else if(!$isColumnName && !is_numeric($default_value) && !is_array($default_value)){
|
||||
if(strpos($default_value, "'"))
|
||||
$default_value = "\"\'" . $default_value . "\"\'";
|
||||
if(isset($condition->attrs->default)){
|
||||
if(in_array($this->operation, array('in', 'between', 'not in'))){
|
||||
$default_value = $condition->attrs->default;
|
||||
if(strpos($default_value, "'") !== false)
|
||||
$default_value = "\"" . $default_value . "\"";
|
||||
else
|
||||
$default_value = "\"'" . $default_value . "'\"";
|
||||
$default_value = "'" . $default_value . "'";
|
||||
}
|
||||
else {
|
||||
$default_value_object = new DefaultValue($this->column_name, $condition->attrs->default);
|
||||
$default_value = $default_value_object->toString();
|
||||
|
||||
if($default_value_object->isStringFromFunction()){
|
||||
$default_value = '"\'".' . $default_value . '."\'"';
|
||||
}
|
||||
|
||||
if($default_value_object->isString() && !$isColumnName && !is_numeric( $condition->attrs->default)){
|
||||
if(strpos($default_value, "'") !== false)
|
||||
$default_value = "\"" . $default_value . "\"";
|
||||
else
|
||||
$default_value = "'" . $default_value . "'";
|
||||
}
|
||||
}
|
||||
$this->default_column = $default_value;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -385,4 +385,13 @@
|
|||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
function test_getExpiredSession_curdate(){
|
||||
$xml_file = _XE_PATH_ . "modules/session/queries/getExpiredSessions.xml";
|
||||
$argsString = '';
|
||||
$expected = 'select "session_key"
|
||||
from "xe_session" as "session"
|
||||
where "expired" <= ' . date("YmdHis");
|
||||
$this->_test($xml_file, $argsString, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue