[TYPO3-team-templavoila] RFC: #2081: Using static DSes for Page and FCE
Xavier Perseguers
typo3 at perseguers.ch
Fri Jan 1 18:48:29 CET 2010
Hi Steffen,
First of all, happy new year to all readers!
I just had a quick look at code in order to see whether it may work with DBAL. I see two problems (example in following snippet):
On 12/30/09 6:08 PM, Steffen Kamper wrote:
> + $res = $TYPO3_DB->exec_SELECTquery (
> + '*, IF(LOCATE("(fce)", datastructure)>0,2,1) scope',
> + 'tx_templavoila_tmplobj',
> + 'pid IN ('.$this->storageFolders_pidList.') AND datastructure!=""'.
> + t3lib_BEfunc::deleteClause('tx_templavoila_tmplobj').
> + t3lib_BEfunc::versioningPlaceholderClause('tx_templavoila_tmplobj'),
> + '',
> + 'scope,title'
> + );
Problem 1: LOCATE is not (yet) supported. I may add support for it (for DBAL 1.1.x, that is TYPO3 4.4.0 and above) but I would like you to add a feature request/bug entry for project DBAL with a
relation to this RFC.
Problem 2: IF(LOCATE("(fce")"... or datastructure!="" is not using the TYPO3_DB API 100% properly as embedded strings should be quoted using $GLOBALS['TYPO3_DB']->fullQuoteStr:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*, IF(LOCATE(' . $GLOBALS['TYPO3_DB']->fullQuoteStr('(fce)', 'tx_templavoila_tmplobj') . ', datastructure)>0,2,1) scope',
'tx_templavoila_tmplobj',
'pid IN (' . $this->storageFolders_pidList . ') AND datastructure!=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('', 'tx_templavoila_tmplobj') .
t3lib_BEfunc::...
);
In addition, I found that existing code declared "global $TYPO3_DB" which should be avoided with current CGL.
Problem 3: Don't know if it's really has an impact, I guess no but as you updated class.tx_templavoila_extdeveval.php, I just discovered that this class is not DBAL compliant as queries are created
completely and executed with $GLOBALS['TYPO3_DB']->sql_query() which is not recommended (exec_* methods should be used instead) and there are a few dependencies to MySQL when methods not part of the
DB API are used:
line 229: if (mysql_num_rows($dbRes) == 1){
line 256: idem
line 268: print mysql_error();
Cheers
--
Xavier Perseguers
http://xavier.perseguers.ch/en
One contribution a day keeps the fork away
More information about the TYPO3-team-templavoila
mailing list