diff --git a/classes/xml/xmlquery/argument/ConditionArgument.class.php b/classes/xml/xmlquery/argument/ConditionArgument.class.php index 421bf85a2..b5d3a280b 100644 --- a/classes/xml/xmlquery/argument/ConditionArgument.class.php +++ b/classes/xml/xmlquery/argument/ConditionArgument.class.php @@ -22,34 +22,20 @@ $value = $this->value; switch($operation) { - case 'like_prefix' : - $this->value = $value.'%'; - break; - case 'like_tail' : - $this->value = '%'.$value; - break; - case 'like' : - $this->value = '%'.$value.'%'; - break; - case 'in' : - if(is_array($value)) - { - //$value = $this->addQuotesArray($value); - if($this->getType() == 'number') - $this->value = "(" . join(',',$value) . ")"; - else - $this->value = "('". join("','",$value)."')"; - } - else - { - $this->value = $value; - } - break; + case 'like_prefix' : + $this->value = $value.'%'; + break; + case 'like_tail' : + $this->value = '%'.$value; + break; + case 'like' : + $this->value = '%'.$value.'%'; + break; } /* //if(!in_array($operation,array('in','notin','between')) && is_array($value)){ // $value = join(',', $value); - //} + //} // Daca operatia nu este in, notin, between si coloana e de tip numeric // daca valoarea e array -> concatenare // daca valoarea nu e array si nici nu contine paranteze (nu e functie) -> return (int) diff --git a/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php b/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php index 20452df0b..5b0d54d1a 100644 --- a/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php +++ b/test-phpUnit/classes/db/queryparts/condition/ConditionTest.php @@ -38,6 +38,19 @@ class ConditionTest extends CubridTest { $this->assertEquals('', $tag->toString()); } + + /** + * Checks "in" operation + */ + public function testConditionString_In_VarcharArray() { + $member_srl_argument = new ConditionArgument('"member_srl"', array('a', 'b', 'c'), 'in'); + $member_srl_argument->createConditionValue(); + $member_srl_argument->setColumnType('varchar'); + + $tag = new Condition('"member_srl"', $member_srl_argument, 'in'); + + $this->assertEquals(' "member_srl" in (\'a\',\'b\',\'c\')', $tag->toString()); + } } ?> diff --git a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php index dddef4ffa..992316a00 100644 --- a/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php +++ b/test-phpUnit/db/xml_query/cubrid/CubridSelectTest.php @@ -142,7 +142,7 @@ function test_syndication_getGrantedModules(){ $xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModules.xml"; $argsString = '$args->module_srl = 12; - $args->name = array(\'access\',\'view\',\'list\');'; + $args->name = array(\'access\',\'view\',\'list\');'; $expected = 'select "module_srl" from "xe_module_grants" as "module_grants" where "name" in (\'access\',\'view\',\'list\')