mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
Bug fix: "Not in" query was not properly displaying arguments.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8724 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f94ab07b93
commit
f64e950463
2 changed files with 69 additions and 1 deletions
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
|
|
||||||
function ConditionArgument($name, $value, $operation){
|
function ConditionArgument($name, $value, $operation){
|
||||||
if(isset($value) && in_array($operation, array('in', 'not in', 'between')) && !is_array($value)){
|
if(isset($value) && in_array($operation, array('in', 'notin', 'between')) && !is_array($value)){
|
||||||
|
$value = str_replace(' ', '', $value);
|
||||||
$value = explode(',', $value);
|
$value = explode(',', $value);
|
||||||
}
|
}
|
||||||
parent::Argument($name, $value);
|
parent::Argument($name, $value);
|
||||||
|
|
@ -37,6 +38,9 @@
|
||||||
case 'in':
|
case 'in':
|
||||||
if(!is_array($value)) $this->value = array($value);
|
if(!is_array($value)) $this->value = array($value);
|
||||||
break;
|
break;
|
||||||
|
case 'notin':
|
||||||
|
if(!is_array($value)) $this->value = array($value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,68 @@
|
||||||
$this->_test($xml_file, $argsString, $expected);
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests "not in" query condition
|
||||||
|
* Query argument is a single value - not in (12)
|
||||||
|
*/
|
||||||
|
function test_module_getModules_Notin_Single_Value(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
|
||||||
|
$argsString = '$args->except_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" not 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_Notin_Multiple_Value_String(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
|
||||||
|
$argsString = '$args->except_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" not 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_Notin_Multiple_Value_Array(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/syndication/queries/getModules.xml";
|
||||||
|
$argsString = '$args->except_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" not in (12,13,14)
|
||||||
|
and "sites"."site_srl" = "modules"."site_srl"
|
||||||
|
and "except_modules"."module_srl" is null';
|
||||||
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue