From 82f117e32bc6da42c3c6b5ea82a6146f91698ee0 Mon Sep 17 00:00:00 2001 From: ucorina Date: Mon, 10 Oct 2011 17:00:27 +0000 Subject: [PATCH] Db Bug fix - skip condition if value is empty string. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9546 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/xml/xmlquery/argument/Argument.class.php | 6 +++++- .../db/xml_query/cubrid/CubridSelectTest.php | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/classes/xml/xmlquery/argument/Argument.class.php b/classes/xml/xmlquery/argument/Argument.class.php index 4320b6105..69d0f2800 100644 --- a/classes/xml/xmlquery/argument/Argument.class.php +++ b/classes/xml/xmlquery/argument/Argument.class.php @@ -57,7 +57,11 @@ } function toString($value){ - if(is_array($value)) return (count($value) !== 0 ? '('.implode(',', $value).')' : ''); + if(is_array($value)){ + if(count($value) === 0) return ''; + if(count($value) === 1 && $value[0] === '') return ''; + return '('.implode(',', $value).')'; + } return $value; } diff --git a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php index fb31f916c..113d9c1b0 100644 --- a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php +++ b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php @@ -358,6 +358,18 @@ $this->_test($xml_file, $argsString, $expected); } + function test_file_getFileList_Not_In_Empty_String_Value(){ + $xml_file = _XE_PATH_ . "modules/file/queries/getFileList.xml"; + $argsString = '$args->exclude_module_srl = ""; $args->s_module_srl = array(12); '; + $expected = 'select "files".* + from "xe_files" as "files" + left join "xe_member" as "member" on "files"."member_srl" = "member"."member_srl" + where "files"."module_srl" in (12) + order by "files"."file_srl" desc + limit 0, 20'; + $this->_test($xml_file, $argsString, $expected); + } + function test_document_getDeclaredList_In_Query(){ $xml_file = _XE_PATH_ . "modules/document/queries/getDeclaredList.xml"; $argsString = "\$args->list_count = 30;