If you are going to go the multi-query route, why not create a UUID,
insert that into a field dedicated for same and then query back for it
just after the insert?

cfset variables.uid=createuuid()

insert goes here

select idfield where uidfield=variables.uid

No locks or transaction blocks needed.  I do that for code that has to
run on multiple db platforms, which keeps me from doing anything
platform-specific like the currval thing.  I found over time that I
wind up using the UUID for something else later on about half the time
(like salt for a salted hash) so its often not a complete waste of a
field.  I also index this field and have never seen an issue with the
extra index becoming a resource drain, but your mileage may vary.

Finally, I've been following the various threads about this polling
app and the comments have been very helpful.  I decided that rather
than storing individual data records for the responses I would
increment a value field instead.  All I need is a total number of
votes.  Gotta watch for a race condition there, though.

--
--Matt Robertson--
MSB Designs, Inc.
mysecretbase.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to