http://forge.typo3.org/http://forge.typo3.org/themes/typo3_forge/favicon/favicon.png?17058661692009-11-27T18:42:34ZTYPO3 ForgeTYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547082009-11-27T18:42:34ZXavier Perseguersxavier@typo3.org
<ul></ul><p>Using patch from <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: Add support for IN and EXISTS subqueries (Closed)" href="http://forge.typo3.org/issues/21688">#21688</a> 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:</p>
<p>$GLOBALS['TYPO3_DB']->execDELETEquery(<br /> 'cachingframework_cache_hash_tags',<br /> 'identifier IN (' .<br /> $GLOBALS['TYPO3_DB']->SELECTquery(<br /> 'identifier',<br /> 'cachingframework_cache_pages',<br /> 'crdate + lifetime < ' . time() . ' AND lifetime > 0'<br /> ) .<br /> ')'<br />);</p>
<p>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.</p>
<p>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 <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: Add support for IN and EXISTS subqueries (Closed)" href="http://forge.typo3.org/issues/21688">#21688</a> would then be able to properly parse and execute the query when using DBAL.</p> TYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547092009-11-28T07:41:07ZXavier Perseguersxavier@typo3.org
<ul></ul><p>I thought again and we have to prevent quoting to let it work with DBAL. This means 3 possibilities:</p>
<p>1) Add a parameter to method SELECTquery that is used only by DBAL to prevent quoting (something like "$noQuote = FALSE")<br />2) Rewrite the subquery without using SELECTquery, just as it's done in EXT:crawler<br />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.</p>
<p>My preferred solution is 3). This method should <em>copy</em> relevant code from SELECTquery, not calling it...</p> TYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547102009-11-29T14:06:02ZXavier Perseguersxavier@typo3.org
<ul></ul><p>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</p>
<p>Patch 12800-dbal.diff adds support for subqueries in an IN where clause in DBAL (taken and adapted from <a class="issue tracker-2 status-5 priority-3 priority-lowest closed" title="Feature: Add support for IN and EXISTS subqueries (Closed)" href="http://forge.typo3.org/issues/21688">#21688</a> with a few unit tests to ensure all is fine.</p> TYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547112009-11-29T15:23:53ZXavier Perseguersxavier@typo3.org
<ul></ul><p>Added additional unit-test in patch 12800-dbal_v2.diff to make sure subquery is properly remapped (which was the case).</p> TYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547122009-11-29T18:19:15ZOliver Haderoliver.hader@typo3.org
<ul></ul><p>Committed to SVN Trunk (rev. 6589)</p> TYPO3 Core - Bug #21718: Add functionality to work with caching frameworkhttp://forge.typo3.org/issues/21718?journal_id=547132009-11-29T18:34:54ZXavier Perseguersxavier@typo3.org
<ul></ul><p>Committed to DBAL Trunk (rev. 27125)<br />Committed to DBAL branch 1-0 (rev. 27126)</p>