LAST_INSERT_ID() and Connections not being closed?

LAST_INSERT_ID() and Connections not being closed?

Postby LVdB » Mon 29 Jan 2007 15:20

Hi,

I read somewhere (on the forum or in the documentation, I cannot recall) that MySQLDirect.NET keeps connections open behind the scenes, for performance reasons.

I am worried this might lead to a problem using for example LAST_INSERT_ID() (see http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html ). If one thread performs an INSERT into a table that has a AUTO_INCREMENT column, then using the still open connection calls LAST_INSERT_ID(), it will return the correct answer. But what if another thread also performs an INSERT on an AUTO_INCREMENT column in the middle of this first thread (using the same connection which was kept open by MySQLDirect.NET) - then the LAST_INSERT_ID() returned on the first thread would be wrong.

Unless, of course, you have taking this into account already, which I suppose is likely!

Luc
LVdB
 
Posts: 17
Joined: Mon 11 Sep 2006 12:53

Postby Alexey » Tue 30 Jan 2007 12:17

Don't worry about that. We take care of it.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby LVdB » Tue 30 Jan 2007 12:27

Excellent! Thanks for the reply.
LVdB
 
Posts: 17
Joined: Mon 11 Sep 2006 12:53

Postby Alexey » Tue 30 Jan 2007 12:36

You're welcome:)
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL