[TYPO3-dev] Reserved keywords on fields and table names in the database

Ries van Twisk typo3 at rvt.dds.nl
Sun May 14 14:03:21 CEST 2006


Martin Kutschker wrote:

>Martin Kutschker schrieb:
>  
>
>>Ries van Twisk schrieb:
>>    
>>
>>>Hey All,
>>>
>>>I am heaving slowly more and more problems with reserved keywords on
>>>different databases and versions.
>>>      
>>>
>>I've argued in vain that TYPO3 should quote SQL identifiers. The best 
>>answer I got is that DBAL "takes care of that".
>>    
>>
>
>Interestingly I even had to argue with a DB programmer who normally 
>works with Oracle that it is a good idea to quote identifiers.
>
>Masi
>
>PS: I have proposed a quoteIdentifier method for t3lib_db 
>($GLOBALS['TYPO3_DB']). This function is easy enough to use in a 
>extension. But to make TYPO3 use it consistently in all DB functions is 
>a big task.
>_______________________________________________
>  
>
DBAL should take care of this, however quoting is then also up to the 
programmer in the current DBAL implementation.
DBAL 'knows' about table names, but doesn't know about field names in 
most situations, Isn't it?

For example :
$sql['SELECT'] = 'uid, pid, name, matchtype, matchtype_value, levels, 
nearby, geotarget, phrase, popuptype, content, groups, keywords';
$sql['FROM'] = 'tx_sometable_items';
$sql['WHERE'] = 'true';
$sql['WHERE'] = 'popuptype='.intval($pt);
$sql['WHERE'] .= 
$GLOBALS['TSFE']->sys_page->enableFields('tx_sometable_items',-1,array());    


There is no quoting done there on the field names, and I also suspect 
that it's time consuming to do it in DBAL (but possible).

what other options do we have?

Ries


-- 
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
=== Work:
email: ries at livetravelguides.com
web:   http://www.livetravelguides.com





More information about the TYPO3-dev mailing list