Skip to content

Commit

Permalink
Fix multiresult in 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Jan 13, 2019
1 parent ef49b25 commit 169478d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/MySQL_Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class MySQL_ResultSet {
public:
bool transfer_started;
bool resultset_completed;
bool reset_pid;
uint8_t sid;
MySQL_Data_Stream *myds;
MySQL_Protocol *myprot;
Expand Down
10 changes: 8 additions & 2 deletions lib/MySQL_Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,7 @@ stmt_execute_metadata_t * MySQL_Protocol::get_binds_from_pkt(void *ptr, unsigned

MySQL_ResultSet::MySQL_ResultSet() {
buffer = NULL;
reset_pid = true;
}
void MySQL_ResultSet::init(MySQL_Protocol *_myprot, MYSQL_RES *_res, MYSQL *_my, MYSQL_STMT *_stmt) {
transfer_started=false;
Expand All @@ -2080,13 +2081,18 @@ void MySQL_ResultSet::init(MySQL_Protocol *_myprot, MYSQL_RES *_res, MYSQL *_my,
}
buffer_used=0;
myds=NULL;
if (myprot) { // if myprot = NULL , this is a mirror
myds=myprot->get_myds();
}
if (reset_pid==true) {
sid=0;
//PSarrayOUT = NULL;
if (myprot) { // if myprot = NULL , this is a mirror
myds=myprot->get_myds();
sid=myds->pkt_sid+1;
//PSarrayOUT = new PtrSizeArray(8);
}
}
reset_pid=true;
result=_res;
resultset_size=0;
num_rows=0;
Expand Down Expand Up @@ -2186,7 +2192,7 @@ MySQL_ResultSet::~MySQL_ResultSet() {
free(buffer);
buffer=NULL;
}
if (myds) myds->pkt_sid=sid-1;
//if (myds) myds->pkt_sid=sid-1;
}

unsigned int MySQL_ResultSet::add_row(MYSQL_ROW row) {
Expand Down
1 change: 1 addition & 0 deletions lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3279,6 +3279,7 @@ int MySQL_Session::handler() {
if (myconn->MyRS_reuse) {
delete myconn->MyRS_reuse;
}
myconn->MyRS->reset_pid = false;
myconn->MyRS_reuse = myconn->MyRS;
myconn->MyRS=NULL;
}
Expand Down

0 comments on commit 169478d

Please sign in to comment.