Commit 16218fe5 authored by Konstantin Osipov's avatar Konstantin Osipov

Backport of:

------------------------------------------------------------
revno: 2476.981.1
committer: msvensson@pilot.mysql.com
timestamp: Mon 2007-11-26 19:03:23 +0100
message:
  Bug#31952 Remove undocumented mysql_rpl_* functions.
  - Functions removed + variables in st_mysql and st_mysql_options 
    renamed to "unused".
  - Code updated to work without those functions and variables
parent 93ab04da
...@@ -188,24 +188,10 @@ struct st_mysql_options { ...@@ -188,24 +188,10 @@ struct st_mysql_options {
unsigned long max_allowed_packet; unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */ my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe; my_bool compress,named_pipe;
/* my_bool unused1;
On connect, find out the replication role of the server, and my_bool unused2;
establish connections to all the peers my_bool unused3;
*/ my_bool unused4;
my_bool rpl_probe;
/*
Each call to mysql_real_query() will parse it to tell if it is a read
or a write, and direct it to the slave or the master
*/
my_bool rpl_parse;
/*
If set, never read from a master, only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
my_bool separate_thread;
#endif
enum mysql_option methods_to_use; enum mysql_option methods_to_use;
char *client_ip; char *client_ip;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
...@@ -232,15 +218,6 @@ enum mysql_protocol_type ...@@ -232,15 +218,6 @@ enum mysql_protocol_type
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
}; };
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
typedef struct character_set typedef struct character_set
{ {
...@@ -285,21 +262,8 @@ typedef struct st_mysql ...@@ -285,21 +262,8 @@ typedef struct st_mysql
/* session-wide random string */ /* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1]; char scramble[SCRAMBLE_LENGTH+1];
my_bool unused1;
/* void *unused2, *unused3, *unused4, *unused5;
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/*
Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con;
LIST *stmts; /* list of all statements */ LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods; const struct st_mysql_methods *methods;
...@@ -431,16 +395,6 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q, ...@@ -431,16 +395,6 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_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,
unsigned long length);
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
/* perform query on slave */
my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void STDCALL mysql_get_character_set_info(MYSQL *mysql, void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset); MY_CHARSET_INFO *charset);
...@@ -462,37 +416,6 @@ mysql_set_local_infile_handler(MYSQL *mysql, ...@@ -462,37 +416,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void void
mysql_set_local_infile_default(MYSQL *mysql); mysql_set_local_infile_default(MYSQL *mysql);
/*
enable/disable parsing of all queries to decide if they go on master or
slave
*/
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
/* get the value of the parse flag */
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
/* enable/disable reads from master */
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */
my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
/* discover the master and its slaves */
my_bool STDCALL mysql_rpl_probe(MYSQL* mysql);
/* set the master, close/free the old one, if it is not a pivot */
int STDCALL mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_shutdown(MYSQL *mysql, int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
shutdown_level); shutdown_level);
...@@ -807,7 +730,6 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, ...@@ -807,7 +730,6 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd); const char *user, const char *passwd);
int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#endif #endif
#define HAVE_MYSQL_REAL_CONNECT #define HAVE_MYSQL_REAL_CONNECT
......
...@@ -277,10 +277,10 @@ struct st_mysql_options { ...@@ -277,10 +277,10 @@ struct st_mysql_options {
unsigned long max_allowed_packet; unsigned long max_allowed_packet;
my_bool use_ssl; my_bool use_ssl;
my_bool compress,named_pipe; my_bool compress,named_pipe;
my_bool rpl_probe; my_bool unused1;
my_bool rpl_parse; my_bool unused2;
my_bool no_master_reads; my_bool unused3;
my_bool separate_thread; my_bool unused4;
enum mysql_option methods_to_use; enum mysql_option methods_to_use;
char *client_ip; char *client_ip;
my_bool secure_auth; my_bool secure_auth;
...@@ -301,10 +301,6 @@ enum mysql_protocol_type ...@@ -301,10 +301,6 @@ enum mysql_protocol_type
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
}; };
enum mysql_rpl_type
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
typedef struct character_set typedef struct character_set
{ {
unsigned int number; unsigned int number;
...@@ -344,10 +340,8 @@ typedef struct st_mysql ...@@ -344,10 +340,8 @@ typedef struct st_mysql
my_bool free_me; my_bool free_me;
my_bool reconnect; my_bool reconnect;
char scramble[20 +1]; char scramble[20 +1];
my_bool rpl_pivot; my_bool unused1;
struct st_mysql* master, *next_slave; void *unused2, *unused3, *unused4, *unused5;
struct st_mysql* last_used_slave;
struct st_mysql* last_used_con;
LIST *stmts; LIST *stmts;
const struct st_mysql_methods *methods; const struct st_mysql_methods *methods;
void *thd; void *thd;
...@@ -371,20 +365,6 @@ typedef struct st_mysql_res { ...@@ -371,20 +365,6 @@ typedef struct st_mysql_res {
my_bool unbuffered_fetch_cancelled; my_bool unbuffered_fetch_cancelled;
void *extension; void *extension;
} MYSQL_RES; } MYSQL_RES;
typedef struct st_mysql_manager
{
NET net;
char *host, *user, *passwd;
char *net_buf, *net_buf_pos, *net_data_end;
unsigned int port;
int cmd_status;
int last_errno;
int net_buf_size;
my_bool free_me;
my_bool eof;
char last_error[256];
void *extension;
} MYSQL_MANAGER;
typedef struct st_mysql_parameters typedef struct st_mysql_parameters
{ {
unsigned long *p_max_allowed_packet; unsigned long *p_max_allowed_packet;
...@@ -437,14 +417,6 @@ int mysql_real_query(MYSQL *mysql, const char *q, ...@@ -437,14 +417,6 @@ int mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length); unsigned long length);
MYSQL_RES * mysql_store_result(MYSQL *mysql); MYSQL_RES * mysql_store_result(MYSQL *mysql);
MYSQL_RES * mysql_use_result(MYSQL *mysql); MYSQL_RES * mysql_use_result(MYSQL *mysql);
my_bool mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void mysql_get_character_set_info(MYSQL *mysql, void mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset); MY_CHARSET_INFO *charset);
void void
...@@ -459,22 +431,6 @@ mysql_set_local_infile_handler(MYSQL *mysql, ...@@ -459,22 +431,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void *); void *);
void void
mysql_set_local_infile_default(MYSQL *mysql); mysql_set_local_infile_default(MYSQL *mysql);
void mysql_enable_rpl_parse(MYSQL* mysql);
void mysql_disable_rpl_parse(MYSQL* mysql);
int mysql_rpl_parse_enabled(MYSQL* mysql);
void mysql_enable_reads_from_master(MYSQL* mysql);
void mysql_disable_reads_from_master(MYSQL* mysql);
my_bool mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type mysql_rpl_query_type(const char* q, int len);
my_bool mysql_rpl_probe(MYSQL* mysql);
int mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int mysql_shutdown(MYSQL *mysql, int mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level enum mysql_enum_shutdown_level
shutdown_level); shutdown_level);
...@@ -521,18 +477,6 @@ void mysql_debug(const char *debug); ...@@ -521,18 +477,6 @@ void mysql_debug(const char *debug);
void myodbc_remove_escape(MYSQL *mysql,char *name); void myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int mysql_thread_safe(void); unsigned int mysql_thread_safe(void);
my_bool mysql_embedded(void); my_bool mysql_embedded(void);
MYSQL_MANAGER* mysql_manager_init(MYSQL_MANAGER* con);
MYSQL_MANAGER* mysql_manager_connect(MYSQL_MANAGER* con,
const char* host,
const char* user,
const char* passwd,
unsigned int port);
void mysql_manager_close(MYSQL_MANAGER* con);
int mysql_manager_command(MYSQL_MANAGER* con,
const char* cmd, int cmd_len);
int mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
my_bool mysql_read_query_result(MYSQL *mysql); my_bool mysql_read_query_result(MYSQL *mysql);
enum enum_mysql_stmt_state enum enum_mysql_stmt_state
{ {
......
This diff is collapsed.
...@@ -1036,7 +1036,6 @@ static const char *default_options[]= ...@@ -1036,7 +1036,6 @@ static const char *default_options[]=
"ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
"character-sets-dir", "default-character-set", "interactive-timeout", "character-sets-dir", "default-character-set", "interactive-timeout",
"connect-timeout", "local-infile", "disable-local-infile", "connect-timeout", "local-infile", "disable-local-infile",
"replication-probe", "enable-reads-from-master", "repl-parse-query",
"ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name", "ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name",
"multi-results", "multi-statements", "multi-queries", "secure-auth", "multi-results", "multi-statements", "multi-queries", "secure-auth",
"report-data-truncation", "report-data-truncation",
...@@ -1214,24 +1213,11 @@ void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1214,24 +1213,11 @@ void mysql_read_default_options(struct st_mysql_options *options,
case 22: case 22:
options->client_flag&= ~CLIENT_LOCAL_FILES; options->client_flag&= ~CLIENT_LOCAL_FILES;
break; break;
case 23: /* replication probe */ case 24: /* max-allowed-packet */
#ifndef TO_BE_DELETED
options->rpl_probe= 1;
#endif
break;
case 24: /* enable-reads-from-master */
options->no_master_reads= 0;
break;
case 25: /* repl-parse-query */
#ifndef TO_BE_DELETED
options->rpl_parse= 1;
#endif
break;
case 27:
if (opt_arg) if (opt_arg)
options->max_allowed_packet= atoi(opt_arg); options->max_allowed_packet= atoi(opt_arg);
break; break;
case 28: /* protocol */ case 25: /* protocol */
if ((options->protocol= find_type(opt_arg, if ((options->protocol= find_type(opt_arg,
&sql_protocol_typelib,0)) <= 0) &sql_protocol_typelib,0)) <= 0)
{ {
...@@ -1239,24 +1225,24 @@ void mysql_read_default_options(struct st_mysql_options *options, ...@@ -1239,24 +1225,24 @@ void mysql_read_default_options(struct st_mysql_options *options,
exit(1); exit(1);
} }
break; break;
case 29: /* shared_memory_base_name */ case 26: /* shared_memory_base_name */
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
if (options->shared_memory_base_name != def_shared_memory_base_name) if (options->shared_memory_base_name != def_shared_memory_base_name)
my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME)); options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME));
#endif #endif
break; break;
case 30: case 27: /* multi-results */
options->client_flag|= CLIENT_MULTI_RESULTS; options->client_flag|= CLIENT_MULTI_RESULTS;
break; break;
case 31: case 28: /* multi-statements */
case 32: case 29: /* multi-queries */
options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS; options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
break; break;
case 33: /* secure-auth */ case 30: /* secure-auth */
options->secure_auth= TRUE; options->secure_auth= TRUE;
break; break;
case 34: /* report-data-truncation */ case 31: /* report-data-truncation */
options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1; options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;
break; break;
default: default:
...@@ -1583,16 +1569,8 @@ mysql_init(MYSQL *mysql) ...@@ -1583,16 +1569,8 @@ mysql_init(MYSQL *mysql)
else else
bzero((char*) (mysql), sizeof(*(mysql))); bzero((char*) (mysql), sizeof(*(mysql)));
mysql->options.connect_timeout= CONNECT_TIMEOUT; mysql->options.connect_timeout= CONNECT_TIMEOUT;
mysql->last_used_con= mysql->next_slave= mysql->master = mysql;
mysql->charset=default_client_charset_info; mysql->charset=default_client_charset_info;
strmov(mysql->net.sqlstate, not_error_sqlstate); strmov(mysql->net.sqlstate, not_error_sqlstate);
/*
By default, we are a replication pivot. The caller must reset it
after we return if this is not the case.
*/
#ifndef TO_BE_DELETED
mysql->rpl_pivot = 1;
#endif
/* /*
Only enable LOAD DATA INFILE by default if configured with Only enable LOAD DATA INFILE by default if configured with
...@@ -2533,11 +2511,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2533,11 +2511,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->reconnect=reconnect; mysql->reconnect=reconnect;
} }
#ifndef TO_BE_DELETED
if (mysql->options.rpl_probe && mysql_rpl_probe(mysql))
goto error;
#endif
DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql)); DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql));
reset_sigpipe(mysql); reset_sigpipe(mysql);
DBUG_RETURN(mysql); DBUG_RETURN(mysql);
...@@ -2559,28 +2532,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2559,28 +2532,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
} }
/* needed when we move MYSQL structure to a different address */
#ifndef TO_BE_DELETED
static void mysql_fix_pointers(MYSQL* mysql, MYSQL* old_mysql)
{
MYSQL *tmp, *tmp_prev;
if (mysql->master == old_mysql)
mysql->master= mysql;
if (mysql->last_used_con == old_mysql)
mysql->last_used_con= mysql;
if (mysql->last_used_slave == old_mysql)
mysql->last_used_slave= mysql;
for (tmp_prev = mysql, tmp = mysql->next_slave;
tmp != old_mysql;tmp = tmp->next_slave)
{
tmp_prev= tmp;
}
tmp_prev->next_slave= mysql;
}
#endif
my_bool mysql_reconnect(MYSQL *mysql) my_bool mysql_reconnect(MYSQL *mysql)
{ {
MYSQL tmp_mysql; MYSQL tmp_mysql;
...@@ -2599,8 +2550,7 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2599,8 +2550,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
mysql_init(&tmp_mysql); mysql_init(&tmp_mysql);
tmp_mysql.options= mysql->options; tmp_mysql.options= mysql->options;
tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0; tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0;
tmp_mysql.rpl_pivot= mysql->rpl_pivot;
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket, mysql->db, mysql->port, mysql->unix_socket,
mysql->client_flag | CLIENT_REMEMBER_OPTIONS)) mysql->client_flag | CLIENT_REMEMBER_OPTIONS))
...@@ -2634,7 +2584,6 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2634,7 +2584,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
mysql->free_me=0; mysql->free_me=0;
mysql_close(mysql); mysql_close(mysql);
*mysql=tmp_mysql; *mysql=tmp_mysql;
mysql_fix_pointers(mysql, &tmp_mysql); /* adjust connection pointers */
net_clear(&mysql->net, 1); net_clear(&mysql->net, 1);
mysql->affected_rows= ~(my_ulonglong) 0; mysql->affected_rows= ~(my_ulonglong) 0;
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -2812,23 +2761,6 @@ void STDCALL mysql_close(MYSQL *mysql) ...@@ -2812,23 +2761,6 @@ void STDCALL mysql_close(MYSQL *mysql)
mysql_close_free_options(mysql); mysql_close_free_options(mysql);
mysql_close_free(mysql); mysql_close_free(mysql);
mysql_detach_stmt_list(&mysql->stmts, "mysql_close"); mysql_detach_stmt_list(&mysql->stmts, "mysql_close");
#ifndef TO_BE_DELETED
/* free/close slave list */
if (mysql->rpl_pivot)
{
MYSQL* tmp;
for (tmp = mysql->next_slave; tmp != mysql; )
{
/* trick to avoid following freed pointer */
MYSQL* tmp1 = tmp->next_slave;
mysql_close(tmp);
tmp = tmp1;
}
mysql->rpl_pivot=0;
}
#endif
if (mysql != mysql->master)
mysql_close(mysql->master);
#ifndef MYSQL_SERVER #ifndef MYSQL_SERVER
if (mysql->thd) if (mysql->thd)
(*mysql->methods->free_embedded_thd)(mysql); (*mysql->methods->free_embedded_thd)(mysql);
...@@ -2848,12 +2780,6 @@ static my_bool cli_read_query_result(MYSQL *mysql) ...@@ -2848,12 +2780,6 @@ static my_bool cli_read_query_result(MYSQL *mysql)
ulong length; ulong length;
DBUG_ENTER("cli_read_query_result"); DBUG_ENTER("cli_read_query_result");
/*
Read from the connection which we actually used, which
could differ from the original connection if we have slaves
*/
mysql = mysql->last_used_con;
if ((length = cli_safe_read(mysql)) == packet_error) if ((length = cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(1); DBUG_RETURN(1);
free_old_query(mysql); /* Free old result */ free_old_query(mysql); /* Free old result */
...@@ -2928,23 +2854,6 @@ int STDCALL ...@@ -2928,23 +2854,6 @@ int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length) mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{ {
DBUG_ENTER("mysql_send_query"); DBUG_ENTER("mysql_send_query");
DBUG_PRINT("enter",("rpl_parse: %d rpl_pivot: %d",
mysql->options.rpl_parse, mysql->rpl_pivot));
#ifndef TO_BE_DELETED
if (mysql->options.rpl_parse && mysql->rpl_pivot)
{
switch (mysql_rpl_query_type(query, length)) {
case MYSQL_RPL_MASTER:
DBUG_RETURN(mysql_master_send_query(mysql, query, length));
case MYSQL_RPL_SLAVE:
DBUG_RETURN(mysql_slave_send_query(mysql, query, length));
case MYSQL_RPL_ADMIN:
break; /* fall through */
}
}
mysql->last_used_con = mysql;
#endif
DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1)); DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
} }
...@@ -2971,8 +2880,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) ...@@ -2971,8 +2880,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql)
{ {
MYSQL_RES *result; MYSQL_RES *result;
DBUG_ENTER("mysql_store_result"); DBUG_ENTER("mysql_store_result");
/* read from the actually used connection */
mysql = mysql->last_used_con;
if (!mysql->fields) if (!mysql->fields)
DBUG_RETURN(0); DBUG_RETURN(0);
if (mysql->status != MYSQL_STATUS_GET_RESULT) if (mysql->status != MYSQL_STATUS_GET_RESULT)
...@@ -3027,8 +2935,6 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql) ...@@ -3027,8 +2935,6 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql)
MYSQL_RES *result; MYSQL_RES *result;
DBUG_ENTER("cli_use_result"); DBUG_ENTER("cli_use_result");
mysql = mysql->last_used_con;
if (!mysql->fields) if (!mysql->fields)
DBUG_RETURN(0); DBUG_RETURN(0);
if (mysql->status != MYSQL_STATUS_GET_RESULT) if (mysql->status != MYSQL_STATUS_GET_RESULT)
......
...@@ -2892,7 +2892,7 @@ int ha_federated::info(uint flag) ...@@ -2892,7 +2892,7 @@ int ha_federated::info(uint flag)
} }
if (flag & HA_STATUS_AUTO) if (flag & HA_STATUS_AUTO)
stats.auto_increment_value= mysql->last_used_con->insert_id; stats.auto_increment_value= mysql->insert_id;
mysql_free_result(result); mysql_free_result(result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment