[TYPO3-core] RFC #12231: New caching framework (4.3-dev) does not work with DBAL (oracle) [nobrainer]

Xavier Perseguers typo3 at perseguers.ch
Tue Oct 27 17:56:51 CET 2009


Hi,

This is an SVN patch request.

Type: Bugfix / nobrainer (!)

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

Branches: trunk

Problem:

Do not go away! Solution is very easy :-)

When looking in the DBAL debug module, a lot of errors are produced, which all point to the new caching framework. This error message is "ORA-00904: "LIFETIME": invalid identifier".

This error is produced by t3lib/cache/backend/class.t3lib_cache_backend_dbbackend, on line 96:
. 'AND (crdate + lifetime >= ' . time() . ' OR lifetime = 0)'
and probably in the same file on line 120:
. 'AND crdate + lifetime >= ' . time()

Two fields are used in the addition; crdate + lifetime. Lifetime is not recognized as a fieldname and therefore is not quoted with double quotes (")

The query ends up like:

SELECT "content"
FROM "cache_hash"
WHERE
"identifier" = 'abbbabaf2d4b3f9a63e8dde781f1c106' AND ("crdate"+lifetime) >= 1255507193 OR "lifetime" = 0)

which should be:

SELECT "content"
FROM "cache_hash"
WHERE
"identifier" = 'abbbabaf2d4b3f9a63e8dde781f1c106' AND ("crdate"+"lifetime" >= 1255507193 OR "lifetime" = 0)

After investigation, I found that the problem relies mainly in Core SQL parser that is not able to detect that the "calc_value" (naming from parser) is a field name and as such there is no chance for 
DBAL to detect this and quote it/remap it accordingly.

Solution:
Add code in t3lib_sqlparser to detect that a field was encountered and store its information (possible table.field combination) just as the first part of the calc clause was stored, with a table 
containing the field and the table name. As remapping is only used by DBAL, do not modify existing key (=> no change when not using DBAL = _nobrainer_ and no change for those of us using DBAL until I 
commit associated patch to DBAL, which I'll do as soon as this one is in).

Thanks for taking care of getting this in. This is really a no-brainer!

-- 
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: core_12231.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091027/fbcb0c40/attachment.asc>


More information about the TYPO3-team-core mailing list