[TYPO3-core] RFC #12800: Add functionality to work with caching framework [DBAL]

Xavier Perseguers typo3 at perseguers.ch
Sun Nov 29 14:18:12 CET 2009


Hi,

This is an SVN patch request.

Type: Bugfix / cleanup for DBAL

Bugtracker reference:
http://bugs.typo3.org/view.php?id=12800

Branch: Trunk

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

Additional information:
New caching framework uses subqueries to efficiently delete caching entries in database. However subqueries were not supported by DBAL. The DBAL part of the patch (available on the bugtracker) takes 
care of this.

Enclosed is the Core-related patch only.

Analysis of why (minor) changes in Core are required:

t3lib_sqlparser:
DBAL reuses all existing parsing method for standard queries to parse subqueries (after all, that the same...). However, sql parser in Core lacks a way to give back to the caller the state of the 
parsedString after the parsing occurred. This is however a must for DBAL in order to resume parsing of the main query once the subquery has been parsed.

Changes in parsing framework:

New caching framework basically does this:

$GLOBALS['TYPO3_DB']->execDELETEquery(
     'cachingframework_cache_hash_tags',
     'identifier IN (' .
         $GLOBALS['TYPO3_DB']->SELECTquery(
             'identifier',
             'cachingframework_cache_pages',
             '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.

Best method to prevent quoting of the subquery to let it work with DBAL is to add a new method to t3lib_db that aims at creating subqueries (I called it method SELECTsubquery) which won't be overriden 
by DBAL (no need) and that will only allow what is needed in a subquery, namely a list of fields, from tables and where clauses as parameters.



How to test:
Patch your core, you don't need DBAL, and make sure new caching framework still works as expected. You'll see from patch that changes do not impact Core itself, but allow DBAL to handle queries of new 
caching framework.

I added unit tests in DBAL (present in patch for DBAL) to make sure new caching framework queries are properly parsed.


Cheers

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 12800-core.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091129/b156379b/attachment.txt>


More information about the TYPO3-team-core mailing list