Reset insert_id on connection sent to pool #1093

Automatically reset mysql->insert_id when a connection is sent to connection pool.
If is not reset to 0 , when a backend connections is assigned to a client, this one can potentially read the last inserted id from the previous client.
pull/1130/head
René Cannaò 9 years ago
parent 5389f445d7
commit 8ed85453b7

@ -275,6 +275,7 @@ MySQL_Session::MySQL_Session() {
init(); // we moved this out to allow CHANGE_USER
last_insert_id=0; // #1093
}
void MySQL_Session::init() {

@ -4215,6 +4215,8 @@ MySQL_Connection * MySQL_Thread::get_MyConn_local(unsigned int _hid) {
void MySQL_Thread::push_MyConn_local(MySQL_Connection *c) {
MySrvC *mysrvc=NULL;
mysrvc=(MySrvC *)c->parent;
// reset insert_id #1093
c->mysql->insert_id = 0;
if (mysrvc->status==MYSQL_SERVER_STATUS_ONLINE) {
if (c->async_state_machine==ASYNC_IDLE) {
cached_connections->add(c);

Loading…
Cancel
Save