Page 1 of 1

LAST_INSERT_ID() and Connections not being closed?

Posted: Mon 29 Jan 2007 15:20
by LVdB
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/ ... ement.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

Posted: Tue 30 Jan 2007 12:17
by Alexey
Don't worry about that. We take care of it.

Posted: Tue 30 Jan 2007 12:27
by LVdB
Excellent! Thanks for the reply.

Posted: Tue 30 Jan 2007 12:36
by Alexey
You're welcome:)