[Devel] [ openser-Patches-1665077 ] insert on duplicate key update function for db, mysql

SourceForge.net noreply at sourceforge.net
Mon Apr 16 13:08:28 CEST 2007


Patches item #1665077, was opened at 2007-02-21 12:16
Message generated for change (Comment added) made by miconda
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1665077&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Henning Westerholt (henningw)
Assigned to: Nobody/Anonymous (nobody)
Summary: insert on duplicate key update function for db, mysql

Initial Comment:
Hello,

The current replace function replaces a row in the db, if it exists. Prior to the insertion the old row is deleted. 

For some situations a function that uses the INSERT, ON DUPLICATE KEY UPDATE call, thus preserving old data that is not overwritten, is very convenient. We're using this function a lot in our modules. 
This attached patch implements suchs a function, so called  "insert_update". It adds the some code to the db interface, and the mysql module. 

I know this syntax is a MySQL extension that is not present in PostgreSQL. But it is of course possible to implemented a similar feature with some SQL statements there.

Regards,

Henning

----------------------------------------------------------------------

>Comment By: Daniel-Constantin Mierla (miconda)
Date: 2007-04-16 14:08

Message:
Logged In: YES 
user_id=1246013
Originator: NO

I think mysql has a REPLACE function. Is there any difference against
"INSERT, ON DUPLICATE KEY
UPDATE"?

----------------------------------------------------------------------

Comment By: Henning Westerholt (henningw)
Date: 2007-04-16 13:35

Message:
Logged In: YES 
user_id=337916
Originator: YES

I rework the patch for svn trunk after the last_inserted_id addition.
This applies now cleanly to the repository again.

In my opionion this is a useful contribution to openser, any comments on
this?

Best regards,

Henning
File Added: db-mysql-insert-update-function-trunk.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1665077&group_id=139143



More information about the Devel mailing list