summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsasha@mysql.sashanet.com <>2001-10-04 15:46:04 -0600
committersasha@mysql.sashanet.com <>2001-10-04 15:46:04 -0600
commita71f818aa221e698e4fbe106139509bb6225a8ff (patch)
treef15f127921d230171bb0ac60a5a854a61af3b185 /include
parentc3bab1c7be28984eda03699c2550fc477cec3fd9 (diff)
parentf0ae1dbb70cdf908aea201d56ee9bf0e10062a78 (diff)
downloadmariadb-git-a71f818aa221e698e4fbe106139509bb6225a8ff.tar.gz
Merge
Diffstat (limited to 'include')
-rw-r--r--include/mysql.h73
-rw-r--r--include/mysql_com.h9
2 files changed, 46 insertions, 36 deletions
diff --git a/include/mysql.h b/include/mysql.h
index 8b5fc22de8f..09c49592270 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -72,11 +72,11 @@ typedef struct st_mysql_field {
char *name; /* Name of column */
char *table; /* Table of column if column was a field */
char *def; /* Default value (set by mysql_list_fields) */
- enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
- unsigned int length; /* Width of column */
- unsigned int max_length; /* Max width of selected set */
+ unsigned long length; /* Width of column */
+ unsigned long max_length; /* Max width of selected set */
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
+ enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
@@ -175,25 +175,30 @@ typedef struct st_mysql {
gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,
*info,*db;
- unsigned int port,client_flag,server_capabilities;
- unsigned int protocol_version;
- unsigned int field_count;
- unsigned int server_status;
- unsigned long thread_id; /* Id for connection in server */
+ struct charset_info_st *charset;
+ MYSQL_FIELD *fields;
+ MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
+ unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
+ unsigned int port,client_flag,server_capabilities;
+ unsigned int protocol_version;
+ unsigned int field_count;
+ unsigned int server_status;
+ unsigned int server_language;
+ struct st_mysql_options options;
enum mysql_status status;
- MYSQL_FIELD *fields;
- MEM_ROOT field_alloc;
my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */
- struct st_mysql_options options;
char scramble_buff[9];
- struct charset_info_st *charset;
- unsigned int server_language;
+ /*
+ 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;
@@ -201,26 +206,21 @@ typedef struct st_mysql {
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;
- /*
- 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;
} MYSQL;
typedef struct st_mysql_res {
my_ulonglong row_count;
- unsigned int field_count, current_field;
MYSQL_FIELD *fields;
MYSQL_DATA *data;
MYSQL_ROWS *data_cursor;
+ unsigned long *lengths; /* column lengths of current row */
+ MYSQL *handle; /* for unbuffered reads */
MEM_ROOT field_alloc;
+ unsigned int field_count, current_field;
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
- unsigned long *lengths; /* column lengths of current row */
- MYSQL *handle; /* for unbuffered reads */
- my_bool eof; /* Used my mysql_fetch_row */
+ my_bool eof; /* Used by mysql_fetch_row */
} MYSQL_RES;
#define MAX_MYSQL_MANAGER_ERR 256
@@ -252,14 +252,14 @@ typedef struct st_mysql_manager
* work when linked against either the standard client library or the
* embedded server library, these functions should be called. */
int mysql_server_init(int argc, const char **argv, const char **groups);
-void mysql_server_end();
+void mysql_server_end(void);
/* Set up and bring down a thread; these function should be called
* for each thread in an application which opens at least one MySQL
* connection. All uses of the connection(s) should be between these
* function calls. */
-my_bool mysql_thread_init();
-void mysql_thread_end();
+my_bool mysql_thread_init(void);
+void mysql_thread_end(void);
/* Functions to get information from the MYSQL and MYSQL_RES structures */
/* Should definitely be used if one uses shared libraries */
@@ -300,20 +300,20 @@ void STDCALL mysql_close(MYSQL *sock);
int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
int STDCALL mysql_query(MYSQL *mysql, const char *q);
int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
int STDCALL mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
/* perform query on master */
int STDCALL mysql_master_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
/* perform query on slave */
int STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
- unsigned int length);
+ unsigned long length);
/*
enable/disable parsing of all queries to decide if they go on master or
@@ -411,9 +411,18 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
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);
+#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
+#define HAVE_MYSQL_REAL_CONNECT
#endif
-#define HAVE_MYSQL_REAL_CONNECT
+/*
+ The following functions are mainly exported because of mysqlbinlog;
+ They are not for general usage
+*/
+
+int simple_command(MYSQL *mysql,enum enum_server_command command,
+ const char *arg, ulong length, my_bool skipp_check);
+ulong net_safe_read(MYSQL* mysql);
#ifdef __cplusplus
}
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 708280176f1..632d77a5d52 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -108,11 +108,12 @@ typedef struct st_vio Vio;
typedef struct st_net {
Vio* vio;
+ unsigned char *buff,*buff_end,*write_pos,*read_pos;
my_socket fd; /* For Perl DBI/dbd */
+ unsigned long max_packet;
int fcntl;
- unsigned char *buff,*buff_end,*write_pos,*read_pos;
+ unsigned int last_errno,timeout,pkt_nr,compress_pkt_nr;
char last_error[MYSQL_ERRMSG_SIZE];
- unsigned int last_errno,max_packet,timeout,pkt_nr;
unsigned char error;
my_bool return_errno,compress;
/*
@@ -120,14 +121,14 @@ typedef struct st_net {
command ( as in LOAD TABLE ... FROM MASTER ),
and do not want to confuse the client with OK at the wrong time
*/
- my_bool no_send_ok;
unsigned long remain_in_buf,length, buf_length, where_b;
unsigned int *return_status;
unsigned char reading_or_writing;
char save_char;
+ my_bool no_send_ok;
} NET;
-#define packet_error ((unsigned int) -1)
+#define packet_error (~(unsigned long) 0)
enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
FIELD_TYPE_SHORT, FIELD_TYPE_LONG,