Bug #21718

Add functionality to work with caching framework

Added by Oliver Hader almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2009-11-27
Due date:
% Done:

0%

TYPO3 Version:
4.3
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

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 View (13.4 KB) Administrator Admin, 2009-11-29 13:49

12800-core.diff View (2.91 KB) Administrator Admin, 2009-11-29 13:55

12800-dbal_v2.diff View (15.1 KB) Administrator Admin, 2009-11-29 15:23


Related issues

Related to TYPO3 Core - Bug #21017: Use separate tables for tags in the caching framework Closed 2009-09-08
Related to TYPO3 Core - Feature #21688: Add support for IN and EXISTS subqueries Closed 2009-11-25

History

#1 Updated by Xavier Perseguers almost 10 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:

$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.

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.

#2 Updated by Xavier Perseguers almost 10 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...

#3 Updated by Xavier Perseguers almost 10 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.

#4 Updated by Xavier Perseguers almost 10 years ago

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

#5 Updated by Oliver Hader almost 10 years ago

Committed to SVN Trunk (rev. 6589)

#6 Updated by Xavier Perseguers almost 10 years ago

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

Also available in: Atom PDF