diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 0eb5005ab..01e693d43 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -1751,6 +1751,7 @@ MySQL_ResultSet::MySQL_ResultSet(MySQL_Protocol *_myprot, MYSQL_RES *_res, MYSQL unsigned int nTrx=myds->sess->NumActiveTransactions(); uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 ); if (myds->sess->autocommit) setStatus += SERVER_STATUS_AUTOCOMMIT; + setStatus |= ( mysql->server_status & ~SERVER_STATUS_AUTOCOMMIT ); // get flags from server_status but ignore autocommit // if (_stmt) { // binary protocol , we also assume we have ALL the resultset // myprot->generate_pkt_EOF(false,&pkt.ptr,&pkt.size,sid,0,mysql->server_status|setStatus); // sid++; @@ -1760,7 +1761,7 @@ MySQL_ResultSet::MySQL_ResultSet(MySQL_Protocol *_myprot, MYSQL_RES *_res, MYSQL if (RESULTSET_BUFLEN <= (buffer_used + 9)) { buffer_to_PSarrayOut(); } - myprot->generate_pkt_EOF(false, NULL, NULL, sid, 0, (mysql->server_status & SERVER_STATUS_IN_TRANS) |setStatus, this); + myprot->generate_pkt_EOF(false, NULL, NULL, sid, 0, setStatus, this); sid++; resultset_size += 9; //} @@ -1892,6 +1893,7 @@ void MySQL_ResultSet::add_eof() { unsigned int nTrx=myds->sess->NumActiveTransactions(); uint16_t setStatus = (nTrx ? SERVER_STATUS_IN_TRANS : 0 ); if (myds->sess->autocommit) setStatus += SERVER_STATUS_AUTOCOMMIT; + setStatus |= ( mysql->server_status & ~SERVER_STATUS_AUTOCOMMIT ); // get flags from server_status but ignore autocommit //myprot->generate_pkt_EOF(false,&pkt.ptr,&pkt.size,sid,0,mysql->server_status|setStatus); //PSarrayOUT->add(pkt.ptr,pkt.size); //sid++; @@ -1899,7 +1901,7 @@ void MySQL_ResultSet::add_eof() { if (RESULTSET_BUFLEN <= (buffer_used + 9)) { buffer_to_PSarrayOut(); } - myprot->generate_pkt_EOF(false, NULL, NULL, sid, 0, (mysql->server_status & SERVER_STATUS_IN_TRANS) |setStatus, this); + myprot->generate_pkt_EOF(false, NULL, NULL, sid, 0, setStatus, this); sid++; resultset_size += 9; buffer_to_PSarrayOut(true); diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index a53f189f1..68d1a2569 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -3860,7 +3860,8 @@ void MySQL_Session::MySQL_Stmt_Result_to_MySQL_wire(MYSQL_STMT *stmt, MySQL_Conn if (autocommit) setStatus += SERVER_STATUS_AUTOCOMMIT; if (mysql->server_status & SERVER_MORE_RESULTS_EXIST) setStatus += SERVER_MORE_RESULTS_EXIST; - client_myds->myprot.generate_pkt_OK(true,NULL,NULL,client_myds->pkt_sid+1,num_rows,mysql->insert_id, (mysql->server_status & SERVER_STATUS_IN_TRANS) |setStatus , mysql->warning_count,mysql->info); + setStatus |= ( mysql->server_status & ~SERVER_STATUS_AUTOCOMMIT ); // get flags from server_status but ignore autocommit + client_myds->myprot.generate_pkt_OK(true,NULL,NULL,client_myds->pkt_sid+1,num_rows,mysql->insert_id, setStatus , mysql->warning_count,mysql->info); client_myds->pkt_sid++; } else { // error @@ -3908,7 +3909,8 @@ void MySQL_Session::MySQL_Result_to_MySQL_wire(MYSQL *mysql, MySQL_ResultSet *My if (autocommit) setStatus += SERVER_STATUS_AUTOCOMMIT; if (mysql->server_status & SERVER_MORE_RESULTS_EXIST) setStatus += SERVER_MORE_RESULTS_EXIST; - client_myds->myprot.generate_pkt_OK(true,NULL,NULL,client_myds->pkt_sid+1,num_rows,mysql->insert_id, (mysql->server_status & SERVER_STATUS_IN_TRANS) |setStatus,mysql->warning_count,mysql->info); + setStatus |= ( mysql->server_status & ~SERVER_STATUS_AUTOCOMMIT ); // get flags from server_status but ignore autocommit + client_myds->myprot.generate_pkt_OK(true,NULL,NULL,client_myds->pkt_sid+1,num_rows,mysql->insert_id, setStatus, mysql->warning_count,mysql->info); client_myds->pkt_sid++; } else { // error