[TYPO3-english] ke_stats AND dbal

Xavier Perseguers typo3 at perseguers.ch
Sun Jun 20 00:50:28 CEST 2010


Hi,

Gulay Boris wrote:
> I have installed typo3 (4.3.3) with dbal (I use Postgres as database
> storage). Also I have installed ke_stats extension. When I click
> "Statistics" menu item in BE I see an error:
>
> "Could not parse where clause in
> /usr/share/typo3/typo3/sysext/dbal/class.ux_t3lib_db.php : 1073"
>
> Where clause that ke_stats passes to dbal really seems incorrect:
>
> "whereclause='type=''pages'' AND category=''pages'' AND year=2009 AND
> month=6 AND tx_kestats_statdata.element_uid IN (2,4,5,6,7,8)' AND
> groupby='' AND orderby='counter DESC'"
>
> What is wrong with ke_stats extension?

I don't know this extension but as you pointed out the query seems to be 
completely broken. I just had a look at mod1/index.php from TER as you 
said it is a BE problem which redirected me to lib/class.tx_kestats_lib.php.

Problem is located with the method getStatResults which takes an 
optional argument $orderBy (e.g.) which defaults to

$orderBy='counter DESC'

and this is used as this:

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','tx_kestats_cache',
					'whereclause=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($where_clause, 
'tx_kestats_cache')
					. ' AND groupby=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($groupBy, 
'tx_kestats_cache')
					. ' AND orderby=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($orderBy, 
'tx_kestats_cache') );

which means the whole argument is quoted (including the DESC part). The 
author wanted to make it well for DBAL but had no real clue what was 
going on. With MySQL nothing is quoted in fact and it works but this 
extension is not really DBAL-compliant, that's all.

Regards

-- 
Xavier Perseguers


More information about the TYPO3-english mailing list