Hello, I'm finding this message in a thread from February... I thought that autoincremented field would guaranty unicity in the table. I'm afraid the provided solution would allow two record to have the same autonumber field (think about an access from two users at the same time). I guess the autoincrement should be done on the DAL or database side, inside a transaction....
What do you think about it ? On 19 jan, 21:38, Thadeus Burgess <[email protected]> wrote: > max_id= db(db.table.autonumber>1).select(db.table.autonumber, # > select all records, and only pull the autonumber column > orderby=~db.table.autonumber, # > descending sort on the autonumber, (highest first) > limitby=(0,1) # limit the query and > only select the first record > ).first().autonumber # pull the first record > from the web2py rows object, and get its autonumber member > > db.table.autonumber.default = max_id + 1 # Set the table default as > the last autonumber and incremented by one. > db.table.autonumber.writable = False > > form = crud.create(db.table) > > -Thadeus > > > > On Tue, Jan 19, 2010 at 4:32 AM, ceriox <[email protected]> wrote: > > thanks for the reply but i'm not a good web2py programmer ... i > > writing my first real app > > you can write the code for my request? (i can't understand the post of > > your link) > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" 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 > > athttp://groups.google.com/group/web2py?hl=en.

