Re: Insert vs. Update

2007-07-28 Thread Malcolm Tredinnick
On Tue, 2007-07-24 at 20:59 +0800, Russell Keith-Magee wrote: > On 7/24/07, PyMan <[EMAIL PROTECTED]> wrote: > > > > Can anyone tell me why Django do this while using save()? : > > The behavior comes from the Object relational mapping (key word - > Object). Since save() is an operation on an Obje

Re: Insert vs. Update

2007-07-24 Thread James Bennett
On 7/24/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > You're not the first to suggest insert() and update() methods that > explicity do SQL INSERT and UPDATE calls. I have a vague recollection > that a decision was made about adding these calls, but a quick search > in the ticket database d

Re: Insert vs. Update

2007-07-24 Thread Peter Melvyn
On 7/24/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > You're not the first to suggest insert() and update() methods that > explicity do SQL INSERT and UPDATE calls. FYI: both, SQLite and MySQL support REPLACE statement to do this automatically. --~--~-~--~~~--

Re: Insert vs. Update

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, PyMan <[EMAIL PROTECTED]> wrote: > > Can anyone tell me why Django do this while using save()? : The behavior comes from the Object relational mapping (key word - Object). Since save() is an operation on an Object relational mapper, it was established as an unambiguous mechanism to ge

Insert vs. Update

2007-07-23 Thread PyMan
Can anyone tell me why Django do this while using save()? : 1) do select 2) if found do update 3) else do insert In both case (insert or update) it ends in 2 steps. It could be so : 1) Do insert 2) If ok then stop (1 step) 3) else if error because of PK's dupkey then do update (2 step only in