summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-06-08 19:26:11 -0600
committerunknown <sasha@mysql.sashanet.com>2001-06-08 19:26:11 -0600
commit9de8ae5fd0285c3ed33c980f2275a5ac39f47f9c (patch)
tree2686922d9044bcd3e7b746e168c2560b74ed3ed3 /include
parent2db2a22cbfa92fcd38a2615762c2dea8e23c09f7 (diff)
parent26ffc5d4dec03f804ea36a2f5915acdbc9c1f705 (diff)
downloadmariadb-git-9de8ae5fd0285c3ed33c980f2275a5ac39f47f9c.tar.gz
Merge work:/home/bk/mysql-4.0
into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0 mysql-test/mysql-test-run.sh: Auto merged client/mysqltest.c: Auto merged
Diffstat (limited to 'include')
-rw-r--r--include/errmsg.h7
-rw-r--r--include/mysql.h39
2 files changed, 42 insertions, 4 deletions
diff --git a/include/errmsg.h b/include/errmsg.h
index 12a3ee5557a..427174ffa53 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -54,3 +54,10 @@ extern const char *client_errors[]; /* Error messages */
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION 2021
+#define CR_PROBE_SLAVE_STATUS 2022
+#define CR_PROBE_SLAVE_HOSTS 2023
+#define CR_PROBE_SLAVE_CONNECT 2024
+#define CR_PROBE_MASTER_CONNECT 2025
+
+
+
diff --git a/include/mysql.h b/include/mysql.h
index 5d06f96d223..4ce7e80bcb9 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -154,6 +154,14 @@ enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
MYSQL_STATUS_USE_RESULT};
+/* 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 st_mysql {
NET net; /* Communication parameters */
gptr connector_fd; /* ConnectorFd for SSL */
@@ -183,7 +191,15 @@ typedef struct st_mysql {
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
- my_bool is_slave; /* will be false for a lone connection */
+ struct st_mysql* last_used_con; /* needed for send/read/store/use
+ result to work
+ correctly with replication
+ */
+ my_bool rpl_pivot; /* 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()
+ */
} MYSQL;
@@ -261,9 +277,13 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
/* perform query on master */
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned int length);
+int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
+ unsigned int length);
/* perform query on slave */
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned int length);
+int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
+ unsigned int length);
/* enable/disable parsing of all queries to decide
if they go on master or slave */
@@ -278,11 +298,22 @@ void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */
int STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
-int STDCALL mysql_query_goes_to_master(const char* q, int len);
+enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
/* discover the master and its slaves */
-int STDCALL mysql_rpl_probe(MYSQL* mysql);
-
+int 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_create_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
int STDCALL mysql_shutdown(MYSQL *mysql);