On 6/6/06, Ian Holsman <[EMAIL PROTECTED]> wrote:
> any chance of getting a insert_or_replace function as well?
>
> to do something similar to mysql 5's
>
> INSERT INTO table (a,b,c) VALUES (1,2,3)
>   ON DUPLICATE KEY UPDATE c=c+1;
>
> http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
>
> (which is the other common pattern I'm seeing in my code)

Maybe I'm not understanding correctly, but aren't you describing what
Django already does when you call save() on an object? If the
primary-key value is already in the database, it does an UPDATE;
otherwise it does an INSERT. Or are you wanting to follow this logic
for non-primary-key fields?

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to