From: Holden Glova Date: 2003-01-03T14:35:37+09:00 Subject: Re: Ruby DBI -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 03 Jan 2003 17:46, Tom Sawyer wrote: > continuing on with the variaous DBI questions, now i'm stuck on a > cross-database issue and would like recommendations. > > as it stands when i insert a new record into a table, i then do: "SELECT > currval('table_idfield_seq') as recid;" to get the latest automatically > generated record id. and thus know which record i just inserted. but this > seems to me like a jerry-rig. i don't like it and i doubt it works on > anything but postgresql. what's the best way to deal with this? how does > one get auto generated id fields in such a way as to be cross-compatible? > or am i mistaken in using auto generated id feilds in the first place? > > thanks, > transami AFAIK there isn't a database independent way of doing what you want. Scott Ambler has written a paper describing some approaches that you might find useful. The part about OIDs is the bit I am referring to. http://www.ambysoft.com/mappingObjects.html - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+FSDP0X8w8X71zPcRAtgVAJ9NTGupQoFppEdUxvL0bR5iiKer1wCeP6TD aPRJUiacVnTX/d47QvSoxjI= =4Wnm -----END PGP SIGNATURE-----