No, this definetly opens up race conditions and lots of rollbacks and
reprocessing.
Eg (in pseudocode).
id = execute("SELECT MAX(id) FROM tablename") + 1;
...
result = execute("INSERT INTO tablename VALUE(id, ....)");
if (!result) { rollback(); repeat(); }
----
Either that or it would cause the database performance to slow down
whilst it holds a that table. Better just to have another unique
identifier in my reckoning.
Regards,
Michael S. E. Kraus
Software Developer/Technical Support Specialist
Wild Technology Pty Ltd
[EMAIL PROTECTED]
Direct Line 02-8306-0007
________________________________
ABN 98 091 470 692
Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia
Telephone 1300-13-9453 | Facsimile 1300-88-9453
http://www.wildtechnology.net
The information contained in this email message and any attachments may
be confidential information and may also be the subject of client legal
- legal professional privilege. If you are not the intended recipient,
any use, interference with, disclosure or copying of this material is
unauthorised and prohibited. This email and any attachments are also
subject to copyright. No part of them may be reproduced, adapted or
transmitted without the written permission of the copyright owner. If
you have received this email in error, please immediately advise the
sender by return email and delete the message from your system.
-----Original Message-----
From: Benno [mailto:[EMAIL PROTECTED]
Sent: Monday, 18 October 2004 1:09 PM
To: torquemada
Cc: Michael Kraus; [EMAIL PROTECTED]
Subject: Re: [SLUG] Maximum process ID
On Mon Oct 18, 2004 at 12:58:42 +1000, torquemada wrote:
>
>OID's, (object-ID's) are made exactly for this purpose.
>if your database vendor does not provide this feature, lobby for it.
>ie PostgreSQL supports OID's and they are pretty much guaranteed to be
>unique
Well, the better idea is to start a transaction, get the next id from a
seqeunce, and then use this as the UID. I'm not sure if MySQL has
sequences, but I'm *sure* that this is a problem that is solved in some
way in the MySQL.
Benno
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html