[TYPO3-dev] Update query with increment

Steffen Kamper steffen at sk-typo3.de
Sun Dec 30 21:50:41 CET 2007


"Widmann, Manfred" <mpunktw at gmx.net> schrieb im Newsbeitrag 
news:mailman.1.1199045879.4956.typo3-dev at lists.netfielders.de...
>
> "Dmitry Dulepov [typo3]" <dmitry at typo3.org> schrieb im Newsbeitrag 
> news:mailman.1.1199035814.650.typo3-dev at lists.netfielders.de...
>> Hi!
>>
>> Steffen Kamper wrote:
>>> a while ago i thought that it is not possible to do a query like
>>>
>>> UPDATE tx_counter SET counter=counter+1
>>>
>>> with the TYPO3 DBwrapper-function. I remember i asked here in the list 
>>> for that, and because of no answer with the right usage i looked again 
>>> to the wrapper class, and it is possible.
>>
>> Just for the record: it can be done with 
>> $GLOBALS['TYPO3_DB']->sql_query() but then it needs full query.
> But isn't this "bad code"?
It's not "bad code", but you risk the compatibility to DBAL ("bad code" 
would be mysql_query in this case ;-) )
Sometimes there is no other way with building complex queries, but it's the 
best to use the db-class for building queries, when ever it's possible.

vg  Steffen 






More information about the TYPO3-dev mailing list