Um... just be careful. This won't scale to several simultaneous requests. You might want to be concerned about duplicate keys, conflict errors, and other such problems. Have you considered a random number and a check to see if it is in the db? Sean -----Original Message----- From: Micheál Healy [mailto:michael.healy@engitech.ie] Sent: Tuesday, November 05, 2002 8:23 AM To: zope@zope.org Subject: Re: [Zope] Trigger/Auto ID on Gadfly DB Thanks - I guess I'll just do a select and increment the thing myself. Sorry about the double post. for some reason, it took ages for the original one to appear on the list. Micheál ----- Original Message ----- From: "Matthew T. Kromer" <matt@zope.com> To: "Micheál Healy" <michael.healy@engitech.ie> Cc: <zope@zope.org> Sent: Tuesday, November 05, 2002 4:02 PM Subject: Re: [Zope] Trigger/Auto ID on Gadfly DB
Micheál Healy wrote:
Hi all,
Is it possible to set a trigger on a gadfly database table? I would like to automatically generate an Id on a table each time I insert. In Oracle, I would create a sequence and then create a trigger on the table in question based on the sequence. I something similar possible with Gadfly?
TIA,
Micheál
Erm.
No.
Gadfly is a very light-weight database. It accepts SQL commands, but it isn't a "full" database like you might think.
I dont know if it has automatic sequence numbers -- that's your real question. Each RDBMS tends to do automatic sequence number differently. Oracle actually does it the most awkward way, by requiring you to set a trigger on inserts. Most other RDBMS will let you specific an auto-increment column some way.
Granted, I could be wrong about Gadfly -- I only spent about 90 seconds grepping the source for a likely auto-increment column operator. But I do not believe Gadfly does this for you.
-- Matt Kromer Zope Corporation http://www.zope.com/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
sean.upton@uniontrib.com