diff --git a/libmariadb/ma_net.c b/libmariadb/ma_net.c index 6b370fa5..e4bce8ab 100644 --- a/libmariadb/ma_net.c +++ b/libmariadb/ma_net.c @@ -470,19 +470,7 @@ ma_real_read(NET *net, size_t *complen) if (i == 0) { /* First parts is packet length */ ulong helping; - if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr) - { - if (net->buff[net->where_b] != (uchar) 255) - { -#ifdef EXTRA_DEBUG - fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n", - (int) net->buff[net->where_b + 3], - (uint) (uchar) net->pkt_nr); -#endif - } - len= packet_error; - goto end; - } + net->pkt_nr= net->buff[net->where_b + 3]; net->compress_pkt_nr= ++net->pkt_nr; #ifdef HAVE_COMPRESS if (net->compress) diff --git a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c index 5c20381d..7a8be492 100644 --- a/libmariadb/mariadb_stmt.c +++ b/libmariadb/mariadb_stmt.c @@ -1667,22 +1667,18 @@ int stmt_read_execute_response(MYSQL_STMT *stmt) return(0); } -int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) + +int stmt_execute_send(MYSQL_STMT *stmt) { MYSQL *mysql= stmt->mysql; char *request; int ret; size_t request_len= 0; - enum mariadb_com_multi multi= MARIADB_COM_MULTI_END; - if (!stmt->mysql) { SET_CLIENT_STMT_ERROR(stmt, CR_SERVER_LOST, SQLSTATE_UNKNOWN, 0); return(1); } - - mysql_get_optionv(mysql, MARIADB_OPT_COM_MULTI, &multi); - if (stmt->state < MYSQL_STMT_PREPARED) { SET_CLIENT_ERROR(mysql, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0); @@ -1729,11 +1725,12 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) mysql->net.last_error); return(1); } + return 0; +} - if (multi == MARIADB_COM_MULTI_BEGIN) - return(0); - - return(stmt_read_execute_response(stmt)); +int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) +{ + return stmt_execute_send(stmt) || stmt_read_execute_response(stmt); } static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags) @@ -2042,7 +2039,7 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, const char *stmt_str, size_t length) { - enum mariadb_com_multi multi= MARIADB_COM_MULTI_BEGIN; + MYSQL *mysql= stmt->mysql; if (!mysql) @@ -2051,9 +2048,6 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, goto fail; } - if (mysql_optionsv(mysql, MARIADB_OPT_COM_MULTI, &multi)) - goto fail; - if (!stmt->mysql) { SET_CLIENT_STMT_ERROR(stmt, CR_SERVER_LOST, SQLSTATE_UNKNOWN, 0); @@ -2063,8 +2057,6 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, if (length == -1) length= strlen(stmt_str); - mysql_get_optionv(mysql, MARIADB_OPT_COM_MULTI, &multi); - /* clear flags */ CLEAR_CLIENT_STMT_ERROR(stmt); CLEAR_CLIENT_ERROR(stmt->mysql); @@ -2096,13 +2088,10 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt, stmt->state= MYSQL_STMT_PREPARED; /* Since we can't determine stmt_id here, we need to set it to -1, so server will know that the * execute command belongs to previous prepare */ - stmt->stmt_id= -1; - if (mysql_stmt_execute(stmt)) - goto fail; - /* flush multi buffer */ - multi= MARIADB_COM_MULTI_END; - if (mysql_optionsv(mysql, MARIADB_OPT_COM_MULTI, &multi)) + stmt->stmt_id= -1; + ma_net_clear(&mysql->net); + if (stmt_execute_send(stmt)) goto fail; /* read prepare response */