使用REPLACE INTO代替INSERT INTO将Doctrine2持续到数据库 [英] Persisting with Doctrine2 to database with REPLACE INTO instead of INSERT INTO
问题描述
Doctrine 2不支持 INSERT REPLACE
或 UPSERT
,抱歉,
I have a table where I store relations between two other table with a float indicating relevance between the two rows. I have unique key on the two reference columns. The problem is, that I have to rebuild it regularly, which is kinda lengthy. So, I can't just truncate the table while I'm doing so, but I can't insert the relevance for the same row while they would be duplicates either. That's why I thought it would be great to save the current timestamp to a variable, persist the relations with REPLACE INTO instead of INSERT INTO and then remove everything created before the saved timestamp. However, I couldn't find out how. Any idea? I'm using Doctrine 2.2.0-DEV and Symfony 2.1.0-DEV.
Doctrine 2 doesn't support INSERT REPLACE
or UPSERT
, sorry.
这篇关于使用REPLACE INTO代替INSERT INTO将Doctrine2持续到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!