Bug #21718

Add functionality to work with caching framework

Added by Oliver Hader over 11 years ago. Updated over 11 years ago.

Should have
Database API (Doctrine DBAL)
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


DBAL currently misses functionalities to work properly with the caching framework. Besides that maybe also some changes in the caching framework are required.

(issue imported from #M12800)


12800-dbal.diff (13.4 KB) 12800-dbal.diff Administrator Admin, 2009-11-29 13:49
12800-core.diff (2.91 KB) 12800-core.diff Administrator Admin, 2009-11-29 13:55
12800-dbal_v2.diff (15.1 KB) 12800-dbal_v2.diff Administrator Admin, 2009-11-29 15:23

Related issues

Related to TYPO3 Core - Bug #21017: Use separate tables for tags in the caching frameworkClosedOliver Hader2009-09-08

Related to TYPO3 Core - Feature #21688: Add support for IN and EXISTS subqueriesClosedXavier Perseguers2009-11-25


Updated by Xavier Perseguers over 11 years ago

Using patch from #21688 which seems to add missing support for subqueries in an IN where clause, I found a problem when trying to use either v1 or v2 of the patch with new caching framework... New caching framework basically does this:

'identifier IN (' .
'crdate + lifetime < ' . time() . ' AND lifetime > 0'
) .

Problem is that this creates a SELECT statement that is already quoted (when using PostgreSQL or Oracle) and puts this into a DELETE statement which is not yet quoted. This seems to be a good way to generate a SUBQUERY but actually leads to something that is not consistent for parsing.

Moreover, this quotes the fields but does not do any remapping of field or table names. When using DBAL, the remapping is performed BEFORE quoting, that is before calling method SELECTquery. As such, the subquery should be hard-coded, without using ->SELECTquery and patch from #21688 would then be able to properly parse and execute the query when using DBAL.


Updated by Xavier Perseguers over 11 years ago

I thought again and we have to prevent quoting to let it work with DBAL. This means 3 possibilities:

1) Add a parameter to method SELECTquery that is used only by DBAL to prevent quoting (something like "$noQuote = FALSE")
2) Rewrite the subquery without using SELECTquery, just as it's done in EXT:crawler
3) Add a new method to t3lib_db that aims at creating subqueries, typically something like SELECTsubquery() which would not be overriden by DBAL (no need) and that would only allow list of fields, from tables and where clause as parameters.

My preferred solution is 3). This method should copy relevant code from SELECTquery, not calling it...


Updated by Xavier Perseguers over 11 years ago

Patch 12800-core.diff adds new method SELECTsubquery to t3lib_db, just as discussed above. And adds the additional field to the sql parser to allow just any subquery to be parsed from within DBAL. As this just adds a fields, this has no side-effect

Patch 12800-dbal.diff adds support for subqueries in an IN where clause in DBAL (taken and adapted from #21688 with a few unit tests to ensure all is fine.


Updated by Xavier Perseguers over 11 years ago

Added additional unit-test in patch 12800-dbal_v2.diff to make sure subquery is properly remapped (which was the case).


Updated by Oliver Hader over 11 years ago

Committed to SVN Trunk (rev. 6589)


Updated by Xavier Perseguers over 11 years ago

Committed to DBAL Trunk (rev. 27125)
Committed to DBAL branch 1-0 (rev. 27126)

Also available in: Atom PDF