really sorry to bother you with my connections problems.....
I've made a test using select connection_id(), to see what was the current identifier for my connection.
Each time I change of page, the connection_id is different, I suppose that is because I require my connection file at the beginning of each script.


This seems fine to me as I don't want to lock the tables, and the last_insert_id is performed in the same file than the insert, so on the per connection basis it's perfect (thank you very much for your help!!).

But it seems a bit strange to me to open so many connections. I know there is a limit somewhere, at the moment it is not a problem I don't have a lot of users and they are not coming often, but can it become one in the future?

I tried to find in the documentation some information on when is a connection open or if it is possible to keep one connection per user, but found nothing.

In addition I don't think it is possible because for the mysql server only one user gets connected, it doesn't care about the users I have in my authentication table.

If I misunderstood something please point me to some doc or give me some advice...



From: Philippe Poelvoorde <[EMAIL PROTECTED]>
Reply-To: "'mysql@lists.mysql.com '" <mysql@lists.mysql.com>
To: mel list_php <[EMAIL PROTECTED]>
CC: mysql@lists.mysql.com
Subject: Re: last_insert_id
Date: Tue, 15 Feb 2005 10:50:40 +0000

mel list_php wrote:
Hi!

I have a database where several users can connect and input data.

I managed to have my insert queries as atomic, but I was wondering about one special case: I make one insert, and retrieve the last id inserted by mysql because I need to update an other table with that id.

- if one user inserts and retrieves the id, but between both one other has inserted something the id returned will be the right one?

Last_insert_id() is consistent on a per-connection basis, meaning you don't need to use lock (hopefullly !)
http://dev.mysql.com/doc/mysql/en/getting-unique-id.html


btw, what do you mean by : "I managed to have my insert queries as atomic". Because if you do : INSERT .... it's already suppose to be atomic.

HIMH.

--
Philippe Poelvoorde
COS Trading Ltd.

_________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to