mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 17:19:59 +09:00
Update to string array arguments - added format with SQLSRV_PHPTYPE_STRING.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8635 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
1a6ede2e06
commit
620b18e532
5 changed files with 39 additions and 26 deletions
|
|
@ -180,9 +180,12 @@
|
||||||
if(is_array($value)) $_param = array_merge($_param, $value);
|
if(is_array($value)) $_param = array_merge($_param, $value);
|
||||||
else $_param[] = $o->getUnescapedValue();
|
else $_param[] = $o->getUnescapedValue();
|
||||||
}else{
|
}else{
|
||||||
// TODO treat arrays here too
|
|
||||||
$value = $o->getUnescapedValue();
|
$value = $o->getUnescapedValue();
|
||||||
$_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
|
if(is_array($value)) {
|
||||||
|
foreach($value as $v)
|
||||||
|
$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
|
||||||
|
}
|
||||||
|
else $_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValue(){
|
function getValue(){
|
||||||
$value = $this->escapeValue($this->value);
|
$value = $this->getEscapedValue();
|
||||||
return $this->toString($value);
|
return $this->toString($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,6 +43,10 @@
|
||||||
return $this->column_operation;
|
return $this->column_operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEscapedValue(){
|
||||||
|
return $this->escapeValue($this->value);
|
||||||
|
}
|
||||||
|
|
||||||
function getUnescapedValue(){
|
function getUnescapedValue(){
|
||||||
return $this->value;
|
return $this->value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,7 @@
|
||||||
// Test query arguments
|
// Test query arguments
|
||||||
$argCount = count($expectedArgs);
|
$argCount = count($expectedArgs);
|
||||||
for($i = 0; $i < $argCount; $i++){
|
for($i = 0; $i < $argCount; $i++){
|
||||||
//echo "$i: $expectedArgs[$i] vs $queryArguments[$i]->getValue()";
|
$this->assertEquals($expectedArgs[$i], $queryArguments[$i]->getEscapedValue());
|
||||||
$this->assertEquals($expectedArgs[$i], $queryArguments[$i]->getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
11
test-phpUnit/db/xml_query/mssql/MssqlSelectOnlineTest.php
Normal file
11
test-phpUnit/db/xml_query/mssql/MssqlSelectOnlineTest.php
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
class MssqlSelectOnlineTest extends MssqlOnlineTest {
|
||||||
|
|
||||||
|
function test_syndication_getGrantedModule(){
|
||||||
|
$args->module_srl = 67;
|
||||||
|
$output = executeQuery("syndication.getGrantedModule", $args);
|
||||||
|
$this->assertEquals(0, $output->error, $output->error + ' ' + $output->message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
class MssqlSelectTest extends MssqlTest {
|
class MssqlSelectTest extends MssqlTest {
|
||||||
|
|
||||||
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
function _test($xml_file, $argsString, $expected, $expectedArgs = NULL){
|
||||||
$this->_testPreparedQuery($xml_file, $argsString, $expected, 'getSelectSql', $expectedArgs = NULL);
|
$this->_testPreparedQuery($xml_file, $argsString, $expected, 'getSelectSql', $expectedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSelectStar(){
|
function testSelectStar(){
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
$xml_file = _XE_PATH_ . "modules/module/queries/getModuleExtraVars.xml";
|
$xml_file = _XE_PATH_ . "modules/module/queries/getModuleExtraVars.xml";
|
||||||
$argsString = '$args->module_srl = 25;';
|
$argsString = '$args->module_srl = 25;';
|
||||||
$expected = 'SELECT * FROM [xe_module_extra_vars] as [module_extra_vars] WHERE [module_srl] in (?)';
|
$expected = 'SELECT * FROM [xe_module_extra_vars] as [module_extra_vars] WHERE [module_srl] in (?)';
|
||||||
$this->_test($xml_file, $argsString, $expected, array("25"));
|
$this->_test($xml_file, $argsString, $expected, array(array(25)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_module_getModuleSites(){
|
function test_module_getModuleSites(){
|
||||||
|
|
@ -150,25 +150,21 @@
|
||||||
//$argsString = '$args->module_srls = array(67, 65);';
|
//$argsString = '$args->module_srls = array(67, 65);';
|
||||||
$argsString = '$args->module_srls = "67, 65";';
|
$argsString = '$args->module_srls = "67, 65";';
|
||||||
$expected = 'SELECT [modules].[module_srl] as [module_srl], [sites].[domain] as [domain] FROM [xe_modules] as [modules] , [xe_sites] as [sites] WHERE [modules].[module_srl] in (?,?) and [sites].[site_srl] = [modules].[site_srl]';
|
$expected = 'SELECT [modules].[module_srl] as [module_srl], [sites].[domain] as [domain] FROM [xe_modules] as [modules] , [xe_sites] as [sites] WHERE [modules].[module_srl] in (?,?) and [sites].[site_srl] = [modules].[site_srl]';
|
||||||
$this->_test($xml_file, $argsString, $expected, array("67", "65"));
|
$this->_test($xml_file, $argsString, $expected, array(array(67, 65)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_syndication_getGrantedModule(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModule.xml";
|
||||||
// TODO Something fishy about this query - to be investigated
|
$argsString = '$args->module_srl = 67;';
|
||||||
/*
|
$expected = 'select count(*) as [count]
|
||||||
function test_syndication_getGrantedModules(){
|
from [xe_module_grants] as [module_grants]
|
||||||
$xml_file = _XE_PATH_ . "modules/syndication/queries/getGrantedModules.xml";
|
where [module_srl] = ?
|
||||||
$argsString = '$args->module_srl = 12;
|
and [name] in (?,?,?)
|
||||||
$args->name = array(\'access\',\'view\',\'list\');';
|
and (
|
||||||
$expected = 'select "module_srl"
|
[group_srl] >= ?
|
||||||
from "xe_module_grants" as "module_grants"
|
or [group_srl] = ?
|
||||||
where "name" in (?)
|
or [group_srl] = ?
|
||||||
and ("group_srl" >= -2
|
)';
|
||||||
or "group_srl" = -2
|
$this->_test($xml_file, $argsString, $expected, array(67, array('\'access\'', '\'view\'', '\'list\''), 1, -1, -2));
|
||||||
or "group_srl" = -2)
|
}
|
||||||
group by "module_srl"';
|
|
||||||
$this->_test($xml_file, $argsString, $expected);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue