SCRUM:
embedded library I decided to get rid of #define mysql_some_function in mysql.h It puzzles users and makes problems with dynamic libraries Finally, there are only two functions left, that are covered with the #define-s and it won't hurt performance at all
This commit is contained in:
parent
aa7fd6f4a3
commit
0e059dcb74
@ -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)))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user