Index: t3lib/class.t3lib_db.php =================================================================== --- t3lib/class.t3lib_db.php (revision 6571) +++ t3lib/class.t3lib_db.php (working copy) @@ -514,6 +514,29 @@ } /** + * Creates a SELECT SQL-statement to be used as subquery within another query. + * BEWARE: This method should not be overriden within DBAL to prevent quoting from happening. + * + * @param string $select_fields + * @param string $from_table + * @param string $where_clause + * @return string Full SQL query for SELECT + */ + public function SELECTsubquery($select_fields, $from_table, $where_clause) { + + // Table and fieldnames should be "SQL-injection-safe" when supplied to this function + // Build basic query: + $query = 'SELECT ' . $select_fields . ' FROM ' . $from_table . + (strlen($where_clause) > 0 ? ' WHERE ' . $where_clause : ''); + + // Return query: + if ($this->debugOutput || $this->store_lastBuiltQuery) { + $this->debug_lastBuiltQuery = $query; + } + return $query; + } + + /** * Returns a WHERE clause that can find a value ($value) in a list field ($field) * For instance a record in the database might contain a list of numbers, * "34,234,5" (with no spaces between). This query would be able to select that Index: t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php =================================================================== --- t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (revision 6571) +++ t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (working copy) @@ -292,7 +292,7 @@ $GLOBALS['TYPO3_DB']->exec_DELETEquery( $this->cacheTable, 'identifier IN (' . - $GLOBALS['TYPO3_DB']->SELECTquery( + $GLOBALS['TYPO3_DB']->SELECTsubquery( 'identifier', $this->tagsTable, $this->getQueryForTag($tag) @@ -322,7 +322,7 @@ $GLOBALS['TYPO3_DB']->exec_DELETEquery( $this->cacheTable, 'identifier IN (' . - $GLOBALS['TYPO3_DB']->SELECTquery( + $GLOBALS['TYPO3_DB']->SELECTsubquery( 'identifier', $this->tagsTable, implode(' OR ', $listQueryConditions) @@ -347,7 +347,7 @@ $GLOBALS['TYPO3_DB']->exec_DELETEquery( $this->tagsTable, 'identifier IN (' . - $GLOBALS['TYPO3_DB']->SELECTquery( + $GLOBALS['TYPO3_DB']->SELECTsubquery( 'identifier', $this->cacheTable, 'crdate + lifetime < ' . $GLOBALS['EXEC_TIME'] . ' AND lifetime > 0' Index: t3lib/class.t3lib_sqlparser.php =================================================================== --- t3lib/class.t3lib_sqlparser.php (revision 6574) +++ t3lib/class.t3lib_sqlparser.php (working copy) @@ -247,6 +247,9 @@ } } else return $this->parseError('No table to select from!',$parseString); + // Store current parseString in the result array for possible further processing (e.g., subquery support by DBAL) + $result['parseString'] = $parseString; + // Return result: return $result; }