Project

General

Profile

Bug #23431 ยป 15535.diff

Administrator Admin, 2010-08-23 23:12

View differences:

class.ux_t3lib_sqlparser.php (working copy)
$output .= ', ' . $v['func']['default'][1] . $this->compileAddslashes($v['func']['default'][0]) . $v['func']['default'][1];
$output .= ')';
} elseif (isset($v['func']) && $v['func']['type'] === 'FIND_IN_SET') {
$output = ' ' . trim($v['modifier']) . ' ';
$output .= ' ' . trim($v['modifier']) . ' ';
if ($functionMapping) {
switch (TRUE) {
case ($GLOBALS['TYPO3_DB']->runningADOdbDriver('mssql')):
......
$output .= ' ' . $v['comparator'];
// Detecting value type; list or plain:
if (t3lib_div::inList('NOTIN,IN', strtoupper(str_replace(array(' ', "\t", "\r", "\n"), '', $v['comparator'])))) {
if (t3lib_div::inList('NOTIN,IN', strtoupper(str_replace(array(' ', TAB, CR, LF), '', $v['comparator'])))) {
if (isset($v['subquery'])) {
$output .= ' (' . $this->compileSELECT($v['subquery']) . ')';
} else {
......
}
$output .= ' (' . trim(implode(',', $valueBuffer)) . ')';
}
} else if (t3lib_div::inList('BETWEEN,NOT BETWEEN', $v['comparator'])) {
$lbound = $v['values'][0];
$ubound = $v['values'][1];
$output .= ' ' . $lbound[1] . $this->compileAddslashes($lbound[0]) . $lbound[1];
$output .= ' AND ';
$output .= $ubound[1] . $this->compileAddslashes($ubound[0]) . $ubound[1];
} else if (isset($v['value']['operator'])) {
$values = array();
foreach ($v['value']['args'] as $fieldDef) {
tests/dbOracleTest.php (working copy)
}
}
/**
* @test
* @see http://bugs.typo3.org/view.php?id=15535
*/
public function groupConditionsAreProperlyTransformed() {
$query = $this->cleanSql($GLOBALS['TYPO3_DB']->SELECTquery(
'*',
'pages',
'pid=0 AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1281620460 '
. 'AND (pages.endtime=0 OR pages.endtime>1281620460) AND NOT pages.t3ver_state>0 '
. 'AND pages.doktype<200 AND (pages.fe_group=\'\' OR pages.fe_group IS NULL OR '
. 'pages.fe_group=\'0\' OR FIND_IN_SET(\'0\',pages.fe_group) OR FIND_IN_SET(\'-1\',pages.fe_group))'
));
$expected = 'SELECT * FROM "pages" WHERE "pid" = 0 AND "pages"."deleted" = 0 AND "pages"."hidden" = 0 '
. 'AND "pages"."starttime" <= 1281620460 AND ("pages"."endtime" = 0 OR "pages"."endtime" > 1281620460) '
. 'AND NOT "pages"."t3ver_state" > 0 AND "pages"."doktype" < 200 AND ("pages"."fe_group" = \'\' '
. 'OR "pages"."fe_group" IS NULL OR "pages"."fe_group" = \'0\' OR \',\'||"pages"."fe_group"||\',\' LIKE \'%,0,%\' '
. 'OR \',\'||"pages"."fe_group"||\',\' LIKE \'%,-1,%\')';
$this->assertEquals($expected, $query);
}
///////////////////////////////////////
// Tests concerning quoting
///////////////////////////////////////
    (1-1/1)