@@ -2132,7 +2132,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
2132
2132
buff [4 ]= (char ) stmt -> flags ;
2133
2133
int4store (buff + 5 , 1 ); /* iteration count */
2134
2134
2135
- res = MY_TEST (cli_advanced_command (mysql , COM_STMT_EXECUTE , buff , sizeof (buff ),
2135
+ res = MY_TEST (( * mysql -> methods -> advanced_command ) (mysql , COM_STMT_EXECUTE , buff , sizeof (buff ),
2136
2136
(uchar * ) packet , length , 1 , stmt ) ||
2137
2137
(* mysql -> methods -> read_query_result )(mysql ));
2138
2138
stmt -> affected_rows = mysql -> affected_rows ;
@@ -2524,9 +2524,16 @@ static void reinit_result_set_metadata(MYSQL_STMT *stmt)
2524
2524
}
2525
2525
2526
2526
2527
+ static int has_cursor (MYSQL_STMT * stmt )
2528
+ {
2529
+ return stmt -> server_status & SERVER_STATUS_CURSOR_EXISTS &&
2530
+ stmt -> flags & CURSOR_TYPE_READ_ONLY ;
2531
+ }
2532
+
2533
+
2527
2534
static void prepare_to_fetch_result (MYSQL_STMT * stmt )
2528
2535
{
2529
- if (stmt -> server_status & SERVER_STATUS_CURSOR_EXISTS )
2536
+ if (has_cursor ( stmt ) )
2530
2537
{
2531
2538
stmt -> mysql -> status = MYSQL_STATUS_READY ;
2532
2539
stmt -> read_row_func = stmt_read_row_from_cursor ;
@@ -4470,8 +4477,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
4470
4477
DBUG_RETURN (1 );
4471
4478
}
4472
4479
4473
- if (mysql -> status == MYSQL_STATUS_READY &&
4474
- stmt -> server_status & SERVER_STATUS_CURSOR_EXISTS )
4480
+ if (mysql -> status == MYSQL_STATUS_READY && has_cursor (stmt ))
4475
4481
{
4476
4482
/*
4477
4483
Server side cursor exist, tell server to start sending the rows
@@ -4483,7 +4489,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
4483
4489
/* Send row request to the server */
4484
4490
int4store (buff , stmt -> stmt_id );
4485
4491
int4store (buff + 4 , (int )~0 ); /* number of rows to fetch */
4486
- if (cli_advanced_command (mysql , COM_STMT_FETCH , buff , sizeof (buff ),
4492
+ if (( * mysql -> methods -> advanced_command ) (mysql , COM_STMT_FETCH , buff , sizeof (buff ),
4487
4493
(uchar * ) 0 , 0 , 1 , stmt ))
4488
4494
{
4489
4495
/*
0 commit comments