diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 2 | ||||
-rw-r--r-- | include/mysql.h | 84 | ||||
-rw-r--r-- | include/mysql_com.h | 6 | ||||
-rw-r--r-- | include/mysql_embed.h | 2 | ||||
-rw-r--r-- | include/mysqld_error.h | 5 | ||||
-rw-r--r-- | include/sql_common.h | 6 | ||||
-rw-r--r-- | include/violite.h | 3 |
7 files changed, 52 insertions, 56 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 7ea9f63a50f..e4125a2e7e6 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -627,7 +627,7 @@ extern my_string my_path(my_string to,const char *progname, const char *own_pathname_part); extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); -extern int wild_compare(const char *str,const char *wildstr); +extern int wild_compare(const char *str,const char *wildstr,pbool str_is_pattern); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); diff --git a/include/mysql.h b/include/mysql.h index 10bacffb2b1..bd5808d82df 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -129,11 +129,22 @@ typedef struct st_mysql_data { unsigned int fields; MYSQL_ROWS *data; MEM_ROOT alloc; -#ifdef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) MYSQL_ROWS **prev_ptr; #endif } MYSQL_DATA; +enum mysql_option +{ + MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, + MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, + MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, + MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, + MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, + MYSQL_OPT_GUESS_CONNECTION +}; + struct st_mysql_options { unsigned int connect_timeout, read_timeout, write_timeout; unsigned int port, protocol; @@ -165,18 +176,10 @@ struct st_mysql_options { a read that is replication-aware */ my_bool no_master_reads; -#ifdef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) my_bool separate_thread; #endif -}; - -enum mysql_option -{ - MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, - MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, - MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, - MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT + enum mysql_option methods_to_use; }; enum mysql_status @@ -199,8 +202,7 @@ enum mysql_rpl_type MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN }; - -#ifndef EMBEDDED_LIBRARY +struct st_mysql_methods; typedef struct st_mysql { @@ -247,34 +249,11 @@ typedef struct st_mysql struct st_mysql* last_used_con; LIST *stmts; /* list of all statements */ -} MYSQL; - -#else - -struct st_mysql_res; - -typedef struct st_mysql -{ + const struct st_mysql_methods *methods; struct st_mysql_res *result; void *thd; - struct charset_info_st *charset; - unsigned int server_language; - MYSQL_FIELD *fields; - MEM_ROOT field_alloc; - my_ulonglong affected_rows; - unsigned int field_count; - struct st_mysql_options options; - enum mysql_status status; - my_bool free_me; /* If free in mysql_close */ - my_ulonglong insert_id; /* id if insert on table with NEXTNR */ - unsigned int last_errno; - unsigned int server_status; - char *last_error; /* Used by embedded server */ - char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */ } MYSQL; -#endif - typedef struct st_mysql_res { my_ulonglong row_count; MYSQL_FIELD *fields; @@ -287,6 +266,7 @@ typedef struct st_mysql_res { MYSQL_ROW row; /* If unbuffered read */ MYSQL_ROW current_row; /* buffer to current row */ my_bool eof; /* Used by mysql_fetch_row */ + const struct st_mysql_methods *methods; } MYSQL_RES; #define MAX_MYSQL_MANAGER_ERR 256 @@ -373,12 +353,10 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, unsigned int port, const char *unix_socket, unsigned long clientflag); -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 long length); -my_bool STDCALL mysql_read_query_result(MYSQL *mysql); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); /* perform query on master */ @@ -439,8 +417,6 @@ MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, const char *wild); MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg); void STDCALL mysql_free_result(MYSQL_RES *result); @@ -561,6 +537,24 @@ typedef struct st_mysql_stmt } MYSQL_STMT; +#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) +#define mysql_store_result(mysql) (*(mysql)->methods->store_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); + my_bool STDCALL (*advanced_command)(MYSQL *mysql, + enum enum_server_command command, + const char *header, + unsigned long header_length, + const char *arg, + unsigned long arg_length, my_bool skip_check); + MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql); + MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql); + void STDCALL (*fetch_lengths)(unsigned long *to, MYSQL_ROW column, uint field_count); +} MYSQL_METHODS; + MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, unsigned long length); int STDCALL mysql_execute(MYSQL_STMT * stmt); @@ -595,6 +589,8 @@ MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); +void STDCALL mysql_close(MYSQL *sock); + /* status return codes */ #define MYSQL_NO_DATA 100 @@ -615,9 +611,9 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); They are not for general usage */ -my_bool -simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, - unsigned long length, my_bool skip_check); +#define simple_command(mysql, command, arg, length, skip_check) \ + (*(mysql)->methods->advanced_command)(mysql, command, \ + NullS, 0, arg, length, skip_check) unsigned long net_safe_read(MYSQL* mysql); void mysql_once_init(void); diff --git a/include/mysql_com.h b/include/mysql_com.h index 87cedafb93d..301ecc26f82 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -137,7 +137,7 @@ typedef struct st_vio Vio; #define MAX_BLOB_WIDTH 8192 /* Default width for blob */ typedef struct st_net { -#ifndef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) Vio* vio; unsigned char *buff,*buff_end,*write_pos,*read_pos; my_socket fd; /* For Perl DBI/dbd */ @@ -241,7 +241,8 @@ void my_net_local_init(NET *net); void net_end(NET *net); void net_clear(NET *net); my_bool net_realloc(NET *net, unsigned long length); -#ifndef EMBEDDED_LIBRARY + +#ifndef EMBEDDED_LIBRARY /* To be removed by HF */ my_bool net_flush(NET *net); #else #define net_flush(A) @@ -349,6 +350,7 @@ void my_thread_end(void); #ifdef _global_h ulong STDCALL net_field_length(uchar **packet); my_ulonglong net_field_length_ll(uchar **packet); +char *net_store_length(char *pkg, ulonglong length); #endif #ifdef __cplusplus diff --git a/include/mysql_embed.h b/include/mysql_embed.h index d48b0440660..7a169d4133e 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -19,11 +19,11 @@ #ifdef EMBEDDED_LIBRARY /* Things we don't need in the embedded version of MySQL */ +/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ #undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_OPENSSL -#undef HAVE_VIO #undef HAVE_ISAM #undef HAVE_SMEM /* No shared memory */ diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 2f27e3aae74..4163a2cd8cf 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -287,5 +287,6 @@ #define ER_CANT_AGGREGATE_3COLLATIONS 1268 #define ER_CANT_AGGREGATE_NCOLLATIONS 1269 #define ER_VARIABLE_IS_NOT_STRUCT 1270 -#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1271 -#define ER_ERROR_MESSAGES 272 +#define ER_UNKNOWN_COLLATION 1271 +#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1272 +#define ER_ERROR_MESSAGES 273 diff --git a/include/sql_common.h b/include/sql_common.h index f3300281f29..9fea46be298 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -27,17 +27,15 @@ my_ulonglong net_field_length_ll(uchar **packet); MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities); -my_bool advanced_command(MYSQL *mysql, enum enum_server_command command, - const char *header, ulong header_length, - const char *arg, ulong arg_length, my_bool skip_check); void free_rows(MYSQL_DATA *cur); MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, uint field_count); my_bool mysql_autenticate(MYSQL *mysql, const char *passwd); -void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count); void free_old_query(MYSQL *mysql); void end_server(MYSQL *mysql); my_bool mysql_reconnect(MYSQL *mysql); +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group); #ifdef __cplusplus } #endif diff --git a/include/violite.h b/include/violite.h index 3b61fbf344e..9205f5b799a 100644 --- a/include/violite.h +++ b/include/violite.h @@ -220,7 +220,7 @@ enum SSL_type }; -#ifndef EMBEDDED_LIBRARY +/* HFTODO - hide this if we don't want client in embedded server */ /* This structure is for every connection on both sides */ struct st_vio { @@ -263,5 +263,4 @@ struct st_vio #endif /* HAVE_SMEM */ #endif /* HAVE_VIO */ }; -#endif /* EMBEDDED_LIBRARY */ #endif /* vio_violite_h_ */ |