[TYPO3-core] FYI #13463: Modfunc2 (statistics) is not compatible with DBAL [indexed_search]

Xavier Perseguers typo3 at perseguers.ch
Mon Feb 8 16:06:02 CET 2010


Hi,

FYI this patch was committed as nobrainer.

- Trunk (rev. 6885)
- 4-3 (rev. 6886)


Type: Bugfix

Branches: trunk, 4-3

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

Problem:
Statistics module always shows an empty list of queried words. In fact, the underlying DB query is not valid when using DBAL.

1st problem:

$queryParts['SELECT']= '*, COUNT(*) AS c';

cannot be parsed (could be fixed in SQL parser, I agree). I searched for columns really used and found that only 'word' column was needed. As it's always better to only retrieve really used columns 
and use column names to allow DBAL to remap it, I changed this to:

$queryParts['SELECT'] = 'word, COUNT(*) AS c';

Second problem is often seen in extensions:

$queryParts['WHERE']= '1 '.$addwhere.$secureaddwhere;

This basically creates a WHERE clause such as

WHERE 1 AND other-conditions

This works for MySQL but not for other DBMS, this should be written as:

$queryParts['WHERE'] = '1=1 ' . $addwhere . $secureaddwhere;

As this was really obvious, I committed right away.

Cheers

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 13463.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100208/b76fe9bd/attachment.asc>


More information about the TYPO3-team-core mailing list