*********** REPLY SEPARATOR ***********
>Hi ...
>
>just wanted to added another question to this one...
>
>you suggested to use LAST_INSERT_ID() , but the
>question is if there are concurrent access to the
>database, how will you get the last id without locking
>the table.
Don't worry about concurrent access... the last_insert_id()
returns the last id inserted by your process (connection).
>
>Because what I've been doing is also:
>1. lock the table
>2. get the id
>3. release lock
>
>Could you further explain the LAST_INSERT_ID() a
>little more and how to complish it without using
>locks.
>
>thank you.
>
>Sukhdev.
>
>--- Michael Widenius <[EMAIL PROTECTED]> wrote:
>>
>> Hi!
>>
>> >>>>> "Lopez" == Lopez David <E-r9374c
>> <[EMAIL PROTECTED]>> writes:
>>
>> Lopez> AntiSpam - mysql, sql, query
>> Lopez> Version: 3.23.49a, MyISAM, NT, Solaris
>>
>> Lopez> My app is 150 daemons writing logs to mysql.
>> The main
>> Lopez> table is of fixed size but depends on four
>> other tables
>> Lopez> for foreign keys (hash tables). These tables
>> are uploaded
>> Lopez> once to the daemon at start-up. Occasionally,
>> a new entry
>> Lopez> must be written into these hash tables. The
>> procedure is
>> Lopez> to lock the table, insert entry, get the key
>> (auto-increment
>> Lopez> field) and release the lock.
>>
>> A better solution is to use LAST_INSERT_ID() and not
>> use any locks at all.
>>
>> Lopez> But what if the connection dies during the
>> update process.
>> Lopez> If this happens, how can I tell which
>> connection id has the
>> Lopez> lock so I can kill it?
>>
>> If a connection dies, the server will automaticly
>> delete all temporary
>> tables and all table locks.
>>
>> Regards,
>> Monty
>>
>> --
>> For technical support contracts, goto
>> https://order.mysql.com/
>> __ ___ ___ ____ __
>> / |/ /_ __/ __/ __ \/ / Mr. Michael Widenius
>> <[EMAIL PROTECTED]>
>> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, CTO
>> /_/ /_/\_, /___/\___\_\___/ Helsinki, Finland
>> <___/ www.mysql.com
>>
>>
>---------------------------------------------------------------------
>> Before posting, please check:
>> http://www.mysql.com/manual.php (the manual)
>> http://lists.mysql.com/ (the list
>> archive)
>>
>> To request this thread, e-mail
>> <[EMAIL PROTECTED]>
>> To unsubscribe, e-mail
>>
><[EMAIL PROTECTED]>
>> Trouble unsubscribing? Try:
>> http://lists.mysql.com/php/unsubscribe.php
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Games - play chess, backgammon, pool and more
>http://games.yahoo.com/
>
>---------------------------------------------------------------------
>Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
fim do besteirol todo que Sukhdev Sethi escreveu.
-------------------------------------------------------
\|/ ______ \|/
`@" / o . \ "@' Microsoft? Por acaso é alguma
/___| \____/ |___\ marca de papel higiênico?
\___U__/
.^. Luciano Barcaro - Linux User #99517
/v\ Seja também um feliz usuário de linux
// \\ Registre-se gratuitamente em
/( . )\ http://counter.li.org
^`~'^ ICQ #
-------------------------------------------------------
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php