[KLUG Members] Sequences & MySQL

Adam Tauno Williams awilliam at whitemice.org
Wed Apr 13 07:12:03 EDT 2005


This question was asked last night by an OpenGroupware developer; and
since we have lots of MySQL users/(developers?) I thought someone here
might know an answer.
--------------
I'm currently working on an MySQL adaptor for SOPE 4.5 (no comments, 
please! ;-)
Does someone know how to 'emulate' sequences or a primary key generator 
with this high profile database system?
And no, auto-increment fields are not sufficient - we create a bunch of 
connected records in one step so we need a unique (integer) key in 
advance.
As far as I can see the only option is to create a helper table which 
contains one otherwise unused record for each unique key. Creating a 
new key would imply inserting a record in the helper and retrieving the 
auto-increment value (which is then used in the real tables).
Obviously this is kinda fragile, so maybe someone knows a better 
workaround? :-|
--------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.kalamazoolinux.org/pipermail/members/attachments/20050413/3f971a8b/attachment.bin


More information about the Members mailing list