Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Doctrine_Connection::replace() workings
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
phil0  
View profile   Translate to Translated (View Original)
 More options 20 Sep, 11:35
From: phil0 <fis...@gmail.com>
Date: Sun, 20 Sep 2009 03:35:48 -0700 (PDT)
Local: Sun 20 Sep 2009 11:35
Subject: Doctrine_Connection::replace() workings
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Abdemoulaie  
View profile   Translate to Translated (View Original)
 More options 21 Sep, 17:01
From: David Abdemoulaie <d...@hobodave.com>
Date: Mon, 21 Sep 2009 11:01:14 -0500
Local: Mon 21 Sep 2009 17:01
Subject: Re: [doctrine-dev] Doctrine_Connection::replace() workings
The implementation is not done wrong. Please read the manual:

http://dev.mysql.com/doc/refman/5.0/en/replace.html

Using a REPLACE INTO statement does not magically handle foreign keys.  
If you use REPLACE on a table which is referenced with an ON DELETE  
CASCADE constraint, then the REPLACE will result in the loss of all  
your referencing rows in the foreign table.
On Sep 20, 2009, at 5:35 AM, phil0 wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google