diff options
-rw-r--r-- | client/mysqltest.c | 2 | ||||
-rw-r--r-- | include/mysql.h | 5 | ||||
-rw-r--r-- | libmysql/libmysql.c | 19 | ||||
-rw-r--r-- | libmysqld/libmysqld.c | 2 | ||||
-rw-r--r-- | sql-common/client.c | 8 |
5 files changed, 23 insertions, 13 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 92ed47221bd..04278bce834 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2178,7 +2178,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) if (!(flags & QUERY_REAP)) DBUG_RETURN(0); - if (mysql_read_query_result(mysql) || + if ((*mysql->methods->read_query_result)(mysql) || (!(last_result = res = mysql_store_result(mysql)) && mysql_field_count(mysql))) { diff --git a/include/mysql.h b/include/mysql.h index a2da4f353f7..2feed6da1f9 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -359,6 +359,7 @@ int STDCALL mysql_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); /* perform query on master */ my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, @@ -460,6 +461,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con, int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, char* res_buf, int res_buf_size); +my_bool STDCALL mysql_read_query_result(MYSQL *mysql); /* @@ -540,9 +542,6 @@ typedef struct st_mysql_stmt } MYSQL_STMT; -#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) -#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql) - typedef struct st_mysql_methods { my_bool (STDCALL *read_query_result)(MYSQL *mysql); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 954eae89a2b..c3592844024 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -279,7 +279,7 @@ my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, DBUG_ENTER("mysql_master_query"); if (mysql_master_send_query(mysql, q, length)) DBUG_RETURN(1); - DBUG_RETURN(mysql_read_query_result(mysql)); + DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); } my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, @@ -301,7 +301,7 @@ my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q, DBUG_ENTER("mysql_slave_query"); if (mysql_slave_send_query(mysql, q, length)) DBUG_RETURN(1); - DBUG_RETURN(mysql_read_query_result(mysql)); + DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); } @@ -1982,7 +1982,7 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length) if (cli_advanced_command(mysql, COM_EXECUTE, buff, MYSQL_STMT_HEADER, packet, length, 1) || - mysql_read_query_result(mysql)) + (*mysql->methods->read_query_result)(mysql)) { set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); DBUG_RETURN(1); @@ -3480,7 +3480,18 @@ my_bool STDCALL mysql_next_result(MYSQL *mysql) mysql->affected_rows= ~(my_ulonglong) 0; if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) - DBUG_RETURN(mysql_read_query_result(mysql)); + DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); DBUG_RETURN(0); } + +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql) +{ + return (*mysql->methods->use_result)(mysql); +} + +my_bool STDCALL mysql_read_query_result(MYSQL *mysql) +{ + return (*mysql->methods->read_query_result)(mysql); +} + diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 67dc00e4c1b..4862800f0a2 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -221,7 +221,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, goto error; if (mysql->fields) { - if (!(res= mysql_use_result(mysql))) + if (!(res= (*mysql->methods->use_result)(mysql))) goto error; mysql_free_result(res); } diff --git a/sql-common/client.c b/sql-common/client.c index 508ebef2e1e..c0514203ab3 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1998,7 +1998,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, goto error; if (mysql->fields) { - if (!(res= mysql_use_result(mysql))) + if (!(res= cli_mysql_use_result(mysql))) goto error; mysql_free_result(res); } @@ -2217,7 +2217,7 @@ static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql) ulong field_count; MYSQL_DATA *fields; ulong length; - DBUG_ENTER("mysql_read_query_result"); + DBUG_ENTER("cli_mysql_read_query_result"); /* Read from the connection which we actually used, which @@ -2320,7 +2320,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length) if (mysql_send_query(mysql,query,length)) DBUG_RETURN(1); - DBUG_RETURN((int) mysql_read_query_result(mysql)); + DBUG_RETURN((int) (*mysql->methods->read_query_result)(mysql)); } @@ -2389,7 +2389,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql) { MYSQL_RES *result; - DBUG_ENTER("mysql_use_result"); + DBUG_ENTER("cli_mysql_use_result"); mysql = mysql->last_used_con; |