diff options
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r-- | libmysql/libmysql.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6a592f64e49..304c20132ff 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -175,6 +175,9 @@ void STDCALL mysql_server_end() #ifdef EMBEDDED_LIBRARY end_embedded_server(); #endif + finish_client_errs(); + vio_end(); + /* If library called my_init(), free memory allocated by it */ if (!org_my_init_done) { @@ -185,10 +188,11 @@ void STDCALL mysql_server_end() #endif } else + { + free_charsets(); mysql_thread_end(); - finish_client_errs(); - free_charsets(); - vio_end(); + } + mysql_client_init= org_my_init_done= 0; #ifdef EMBEDDED_SERVER if (stderror_file) @@ -2478,6 +2482,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) NET *net= &mysql->net; char buff[4 /* size of stmt id */ + 5 /* execution flags */]; + my_bool res; + DBUG_ENTER("execute"); DBUG_DUMP("packet", packet, length); @@ -2485,16 +2491,18 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) int4store(buff, stmt->stmt_id); /* Send stmt id to server */ buff[4]= (char) stmt->flags; int4store(buff+5, 1); /* iteration count */ - if (cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), - packet, length, 1, NULL) || - (*mysql->methods->read_query_result)(mysql)) + + res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), + packet, length, 1, NULL) || + (*mysql->methods->read_query_result)(mysql)); + stmt->affected_rows= mysql->affected_rows; + stmt->server_status= mysql->server_status; + stmt->insert_id= mysql->insert_id; + if (res) { set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); DBUG_RETURN(1); } - stmt->affected_rows= mysql->affected_rows; - stmt->server_status= mysql->server_status; - stmt->insert_id= mysql->insert_id; DBUG_RETURN(0); } |