Fixed bug #15535: Error: No pages are found on the rootlevel! in Frontend when using...
authorXavier Perseguers <typo3@perseguers.ch>
Mon, 23 Aug 2010 21:13:44 +0000 (21:13 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Mon, 23 Aug 2010 21:13:44 +0000 (21:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@37143 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/class.ux_t3lib_sqlparser.php
typo3/sysext/dbal/tests/dbOracleTest.php

index 5a718c8..e94c9fb 100644 (file)
@@ -1,5 +1,6 @@
 2010-08-23  Xavier Perseguers  <typo3@perseguers.ch>
 
+       * Fixed bug #15535: Error: No pages are found on the rootlevel! in Frontend when using Oracle
        * Updated ADOdb version dependency
        * Set version to 1.2.0alpha1
 
index bbb861d..aabd173 100644 (file)
@@ -491,7 +491,7 @@ class ux_t3lib_sqlparser extends t3lib_sqlparser {
                                                                $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')):
@@ -643,7 +643,7 @@ class ux_t3lib_sqlparser extends t3lib_sqlparser {
                                                                                $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 {
@@ -653,6 +653,12 @@ class ux_t3lib_sqlparser extends t3lib_sqlparser {
                                                                                                }
                                                                                                $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) {
index a61309a..5d5c924 100644 (file)
@@ -208,6 +208,27 @@ class dbOracleTest extends BaseTestCase {
                }
        }
 
+       /**
+        * @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
        ///////////////////////////////////////