Hi Lloyd, it's a SQLite database, with only one app connecting, so I'm
not worried about concurrency right here, ( I think SQLite locks when
you connect anyway), but it's always good to get pointers on best
practise.


Thanks to all. 


On Tue, 22 Mar 2005 14:10:24 -0500, Lloyd Kvam <[EMAIL PROTECTED]> wrote:
> > > In the SQL books I've got, they always seem to have an optional
> select
> > > statement on the end of inserts/updates, and I was thinking maybe I
> > > could do it that way also, but I can't figure out a logical way of
> > > putting
> > >
> > > 'select primary_key from foo where primary_key value > every other
> > > primary_key value'
> > >
> >
> > select max(primary_key) from foo?
> 
> select max will NOT work reliably when you have concurrent database
> inserts.  You could obtain the number from someone else's insert.
> 
> You need to use the function provided by the RDBMS that is tied to your
> connection/cursor so that you retrieve the primary_key that was assigned
> to *your* record.
> 
> (I understood your request to be looking for the primary_key
> auto-assigned to your insert statement)
> 
> --
> Lloyd Kvam
> Venix Corp
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to