Posted by Tony Marston on 10/24/05 05:56
"J.O. Aho" <user@example.net> wrote in message
news:3s1l8jFln4j6U1@individual.net...
> Tony Marston wrote:
>
>> You should be using 'select max(msg_id) from messagesdb;' instead of
>> 'select
>> count(*) from messagesdb'. In this way it will not matter if any previous
>> entries get deleted.
Not if you lock the table bfeore performing the 'select max(id)' and the
'insert'.
--
Tony Marston
http://www.tonymarston.net
> This can still generate doublets of msgid as the select statment can be
> trigged by two different people trying to add something,
> AUTO_INCREMENT UNIQUE should in most cases be used for ID (numerial)
> columns.
>
>
> //Aho
[Back to original message]
|