Hi there.
First post here, so correct me if I use this forum in a wrong way.
I've got a question regarding the workings of the replace(...) method
of Doctrine_Connection. Apparently it implements the "REPLACE
INTO ..." functionality from MySQL (and SQLite?) in other DBMSes.
However, I think this implementation is done in a wrong way. If this
record has any foreign keys, the delete could result in unexpected
behaviors (failing constraints, etc.)
At the moment the method deletes any records with that key, and then
tries the insert. This is what I think is wrong. Instead - according
to my understanding - it should check if there are any records with
the given key, and then update those instead of doing the delete.
Basically, instead of the "DELETE", "INSERT" sequence this should - in
my opinion - be replaced by a "SELECT", "UPDATE"/"INSERT" sequence.
What do you think?