Fixed "IN" query issue when arguments are strings.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8798 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-08-17 17:11:34 +00:00
parent 51a1d0a37e
commit e46231ae96
2 changed files with 68 additions and 0 deletions

View file

@ -275,4 +275,71 @@
$this->_test($xml_file, $argsString, $expected);
}
function test_module_getModules_In_Single_Value(){
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
$argsString = '$args->module_srls = 12;';
$expected = 'select "modules"."site_srl" as "site_srl"
, "modules"."module_srl" as "module_srl"
, "sites"."domain" as "domain"
, "modules"."mid" as "mid"
, "modules"."module" as "module"
, "modules"."browser_title" as "browser_title"
, "modules"."description" as "description"
from "xe_sites" as "sites"
, "xe_modules" as "modules"
left join "xe_syndication_except_modules" as "except_modules"
on "modules"."module_srl" = "except_modules"."module_srl"
where "modules"."module_srl" in (12)
and "sites"."site_srl" = "modules"."site_srl"
and "except_modules"."module_srl" is null';
$this->_test($xml_file, $argsString, $expected);
}
function test_module_getModules_In_Multiple_Value_String(){
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
$argsString = '$args->module_srls = "12, 13, 14";';
$expected = 'select "modules"."site_srl" as "site_srl"
, "modules"."module_srl" as "module_srl"
, "sites"."domain" as "domain"
, "modules"."mid" as "mid"
, "modules"."module" as "module"
, "modules"."browser_title" as "browser_title"
, "modules"."description" as "description"
from "xe_sites" as "sites"
, "xe_modules" as "modules"
left join "xe_syndication_except_modules" as "except_modules"
on "modules"."module_srl" = "except_modules"."module_srl"
where "modules"."module_srl" in (12,13,14)
and "sites"."site_srl" = "modules"."site_srl"
and "except_modules"."module_srl" is null';
$this->_test($xml_file, $argsString, $expected);
}
function test_module_getModules_In_Multiple_Value_Array(){
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
$argsString = '$args->module_srls = array(12, 13, 14);';
$expected = 'select "modules"."site_srl" as "site_srl"
, "modules"."module_srl" as "module_srl"
, "sites"."domain" as "domain"
, "modules"."mid" as "mid"
, "modules"."module" as "module"
, "modules"."browser_title" as "browser_title"
, "modules"."description" as "description"
from "xe_sites" as "sites"
, "xe_modules" as "modules"
left join "xe_syndication_except_modules" as "except_modules"
on "modules"."module_srl" = "except_modules"."module_srl"
where "modules"."module_srl" in (12,13,14)
and "sites"."site_srl" = "modules"."site_srl"
and "except_modules"."module_srl" is null';
$this->_test($xml_file, $argsString, $expected);
}
function test_module_getModuleSrlByMid_In_Multiple_Value_Array_Strings(){
$xml_file = _XE_PATH_ . "modules/module/queries/getModuleSrlByMid.xml";
$argsString = '$args->mid = "\'mid1\', \'mid2\'";';
$expected = 'select "module_srl" from "xe_modules" as "modules" where "mid" in (\'mid1\',\'mid2\')';
$this->_test($xml_file, $argsString, $expected);
}
}