Preparation of commit for feature #13134
authorXavier Perseguers <typo3@perseguers.ch>
Tue, 5 Jan 2010 17:05:07 +0000 (17:05 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Tue, 5 Jan 2010 17:05:07 +0000 (17:05 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6725 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_sqlparser.php

index 0ec27a8..758b7f6 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-05  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Added feature #13134: Support of SQL LOCATE function
+
 2010-01-05  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #12341: Image generation broken with PHPs safe_mode activated and GraphicsMagick (Thanks to Marcus Krause, Helmut Hummel and Bernhard Kraft)
 2010-01-05  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #12341: Image generation broken with PHPs safe_mode activated and GraphicsMagick (Thanks to Marcus Krause, Helmut Hummel and Bernhard Kraft)
index f9613a8..1b09ac1 100644 (file)
@@ -967,9 +967,9 @@ class t3lib_sqlparser {
                                $stack[$level][$pnt[$level]]['modifier'] = trim($this->nextPart($parseString, '^(!|NOT[[:space:]]+)'));
 
                                        // See if condition is EXISTS with a subquery
                                $stack[$level][$pnt[$level]]['modifier'] = trim($this->nextPart($parseString, '^(!|NOT[[:space:]]+)'));
 
                                        // See if condition is EXISTS with a subquery
-                               if (preg_match('/^EXISTS[[:space:]]*[(]/', $parseString)) {
-                                       $stack[$level][$pnt[$level]]['func']['type'] = $this->nextPart($parseString, '^(EXISTS)');
-                                       $this->nextPart($parseString, '^([(])');
+                               if (preg_match('/^EXISTS[[:space:]]*[(]/i', $parseString)) {
+                                       $stack[$level][$pnt[$level]]['func']['type'] = $this->nextPart($parseString, '^(EXISTS)[[:space:]]*');
+                                       $parseString = trim(substr($parseString, 1));   // Strip of "("
                                        $stack[$level][$pnt[$level]]['func']['subquery'] = $this->parseSELECT($parseString);
                                                // Seek to new position in parseString after parsing of the subquery
                                        $parseString = $stack[$level][$pnt[$level]]['func']['subquery']['parseString'];
                                        $stack[$level][$pnt[$level]]['func']['subquery'] = $this->parseSELECT($parseString);
                                                // Seek to new position in parseString after parsing of the subquery
                                        $parseString = $stack[$level][$pnt[$level]]['func']['subquery']['parseString'];
@@ -1756,8 +1756,8 @@ class t3lib_sqlparser {
                                        // Look for sublevel:
                                if (is_array($v['sub'])) {
                                        $output .= ' (' . trim($this->compileWhereClause($v['sub'])) . ')';
                                        // Look for sublevel:
                                if (is_array($v['sub'])) {
                                        $output .= ' (' . trim($this->compileWhereClause($v['sub'])) . ')';
-                               } elseif (isset($v['func'])) {
-                                       $output .= ' ' . trim($v['modifier']) . ' ' . $v['func']['type'] . ' (' . $this->compileSELECT($v['func']['subquery']) . ')';
+                               } elseif (isset($v['func']) && $v['func']['type'] === 'EXISTS') {
+                                       $output .= ' ' . trim($v['modifier']) . ' EXISTS (' . $this->compileSELECT($v['func']['subquery']) . ')';
                                } else {
 
                                                // Set field/table with modifying prefix if any:
                                } else {
 
                                                // Set field/table with modifying prefix if any: