[TYPO3-dev] Should t3lib_db support MySQL's REPLACE INTO	statement?
    Xavier Perseguers 
    typo3 at perseguers.ch
       
    Thu Nov 13 09:51:37 CET 2008
    
    
  
Xavier Perseguers wrote:
> Hi Ingo,
> 
>> would you be interested to see a 
>> $GLOBALS['TYPO3_DB']->exec_REPLACEquery() method?
>>
>> please refer to the MySQL docs [1] for details on replace...
>>
>> As REPLACE is a MySQL addition to standard SQL DBAL would need to take 
>> care of that by splitting the call up into separate INSERT and DELETE 
>> + INSERT queries. But that's doable.
> 
> It could be very useful but support for other DBMS should be updated in 
> parallel of course.
I just reread the definition of Replace in the MySQL doc and I remember 
what I dislike about it... Unlike in Sqlite3 where you may write INSERT 
OR UPDATE, the REPLACE of MySQL actually performs a DELETE and then an 
INSERT and someone in comments just pointed out what was bad with that. 
When using integrity references, the lack of an actual UPDATE if the row 
already exists leads to removing all associated data.
-- 
Xavier Perseguers
http://xavier.perseguers.ch/en/tutorials/typo3.html
    
    
More information about the TYPO3-dev
mailing list