diff --git a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php index 8c2c26a2c..d93bc58fa 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php @@ -37,10 +37,17 @@ $this->argument_name = $this->argument->getArgumentName(); } else { - if($condition->attrs->default){ - if(!$isColumnName && !is_numeric($condition->attrs->default)) - $condition->attrs->default = "\'" . $condition->attrs->default . "\'"; - $this->default_column = "'" . $condition->attrs->default . "'" ; + $default_value = $condition->attrs->default; + if($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)){ + $default_value = "\"" . $default_value . "\""; + } + $this->default_column = $default_value; } else $this->default_column = "'" . $dbParser->parseColumnName($condition->attrs->var) . "'" ; diff --git a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php index 3300bb75c..8b9978aa6 100644 --- a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php +++ b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php @@ -163,7 +163,8 @@ $args->s_member_srl = 4;'; $expected = 'select * from "xe_documents" as "documents" - where "member_srl" = 4 + where ("member_srl" = 4) + and "list_order" <= 2100000000 order by "list_order" asc limit 0, 30'; $this->_test($xml_file, $argsString, $expected); @@ -205,7 +206,9 @@ $args->sort_order = \'asc\'; $args->list_count = 40; $args->page_count = 10;'; - $expected = 'select * from "xe_member" as "member" + $expected = 'select * + from "xe_member" as "member" + where "list_order" <= 2100000000 order by "list_order" asc limit 0, 40'; $this->_test($xml_file, $argsString, $expected); diff --git a/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php b/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php index ee165efae..c33e4661e 100644 --- a/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php +++ b/test-phpUnit/db/xml_query/mssql/MssqlSelectTest.php @@ -162,12 +162,10 @@ $expected = 'select count(*) as [count] from [xe_module_grants] as [module_grants] where [module_srl] = ? - and [name] in (?,?,?) - and ( - [group_srl] >= ? - or [group_srl] = ? - or [group_srl] = ? - )'; - $this->_test($xml_file, $argsString, $expected, array(67, array('\'access\'', '\'view\'', '\'list\''), 1, -1, -2)); + and [name] in (\'access\',\'view\',\'list\') + and ([group_srl] >= 1 + or [group_srl] = -1 + or [group_srl] = -2)'; + $this->_test($xml_file, $argsString, $expected, array(67)); } } \ No newline at end of file