summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-01-21 21:07:59 +0200
committerunknown <monty@mashka.mysql.fi>2003-01-21 21:07:59 +0200
commit10e22c346a4105c2c348ac500851e3b59cd9d887 (patch)
treeb3f7b07e6d74a88c6ef0b3e8f43bc27b784bb24d /include
parentfd86106365476d5c774cd4779164516a0e56744a (diff)
downloadmariadb-git-10e22c346a4105c2c348ac500851e3b59cd9d887.tar.gz
Portability fixes (for windows)
Some changes to the prepared statement protocol to make it easier to use and faster. Makefile.am: Fix to make dist to work with cmd-line-utils client/mysql.cc: Portability fixes client/mysqlbinlog.cc: Portabiliy fixes and remove usafe of FILE configure.in: Fix to make dist to work with cmd-line-utils heap/_check.c: Portability fixes include/config-win.h: Portability fixes include/m_ctype.h: Indentation cleanup include/my_list.h: Portability fixes include/mysql.h: Cleanup of BIND structure include/violite.h: Portability fixes innobase/dict/dict0dict.c: Portability fixes innobase/dict/dict0load.c: Portability fixes innobase/include/os0proc.h: Portability fixes (Heikki, please check) innobase/os/os0proc.c: Portability fixes (Heikki, please check) innobase/ut/ut0ut.c: Portability fixes isam/pack_isam.c: Portability fixes libmysql/libmysql.c: Portability fixes Remove obscure usage of the length parameter for prepared statements. libmysql/libmysql.def: Remove not existing functions libmysqld/lib_sql.cc: Remove compiler warning mysql-test/r/explain.result: Fix after merge mysql-test/r/join.result: Fix after merge mysys/my_once.c: Portability fix mysys/tree.c: Portability fixes sql/field.cc: Portability fixes sql/filesort.cc: move assert.h to mysql_priv.h sql/ha_berkeley.cc: move assert.h to mysql_priv.h sql/ha_innodb.cc: move assert.h to mysql_priv.h sql/item.cc: move assert.h to mysql_priv.h Fixed syntax error sql/item_cmpfunc.cc: move assert.h to mysql_priv.h sql/item_func.cc: move assert.h to mysql_priv.h sql/item_row.cc: move assert.h to mysql_priv.h sql/item_strfunc.cc: Portability fix sql/item_subselect.cc: Portability fix sql/item_sum.cc: move assert.h to mysql_priv.h sql/lex.h: Portability fix sql/lock.cc: move assert.h to mysql_priv.h sql/log.cc: move assert.h to mysql_priv.h sql/log_event.cc: Portability fix sql/mf_iocache.cc: move assert.h to mysql_priv.h sql/mysql_priv.h: move assert.h to mysql_priv.h sql/mysqld.cc: move assert.h to mysql_priv.h sql/opt_range.cc: move assert.h to mysql_priv.h sql/password.c: Portability fix sql/protocol.cc: move assert.h to mysql_priv.h sql/set_var.cc: Portability fix sql/slave.cc: move assert.h to mysql_priv.h sql/spatial.cc: Portability fix sql/sql_acl.cc: move assert.h to mysql_priv.h sql/sql_base.cc: move assert.h to mysql_priv.h sql/sql_cache.cc: move assert.h to mysql_priv.h sql/sql_class.cc: move assert.h to mysql_priv.h sql/sql_handler.cc: move assert.h to mysql_priv.h sql/sql_help.cc: Removed compiler warning sql/sql_lex.cc: Portability fix sql/sql_lex.h: Portability fix sql/sql_parse.cc: move assert.h to mysql_priv.h sql/sql_prepare.cc: move assert.h to mysql_priv.h sql/sql_repl.cc: move assert.h to mysql_priv.h sql/sql_select.cc: move assert.h to mysql_priv.h sql/sql_string.cc: Portability fix sql/sql_string.h: Portability fix sql/sql_table.cc: move assert.h to mysql_priv.h sql/sql_yacc.yy: Portability fix Remove not accessed code strings/ctype-bin.c: Portability fix strings/ctype-mb.c: Portability fix strings/ctype.c: Portability fix tests/client_test.c: A
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h1
-rw-r--r--include/m_ctype.h98
-rw-r--r--include/my_list.h4
-rw-r--r--include/mysql.h32
-rw-r--r--include/violite.h3
5 files changed, 78 insertions, 60 deletions
diff --git a/include/config-win.h b/include/config-win.h
index dce543cd2b0..efe226b2381 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -262,6 +262,7 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
+#define HAVE_VIO
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
diff --git a/include/m_ctype.h b/include/m_ctype.h
index ee6a50e6b8d..91bc0e67e64 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -26,7 +26,6 @@
extern "C" {
#endif
-
#define MY_CS_NAME_SIZE 32
#define MY_CS_CTYPE_TABLE_SIZE 257
#define MY_CS_TO_LOWER_TABLE_SIZE 256
@@ -38,7 +37,8 @@ extern "C" {
#define my_wc_t ulong
-typedef struct unicase_info_st {
+typedef struct unicase_info_st
+{
uint16 toupper;
uint16 tolower;
uint16 sort;
@@ -66,7 +66,8 @@ typedef struct unicase_info_st {
#define MY_CHARSET_CURRENT (default_charset_info->number)
-typedef struct my_uni_idx_st {
+typedef struct my_uni_idx_st
+{
uint16 from;
uint16 to;
uchar *tab;
@@ -136,18 +137,27 @@ typedef struct charset_info_st
char max_sort_char; /* For LIKE optimization */
/* Charset dependant snprintf() */
- int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt, ...);
- int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix, long int val);
- int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n, int radix, longlong val);
+ int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
+ ...);
+ int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix,
+ long int val);
+ int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
+ int radix, longlong val);
/* String-to-number convertion routines */
- long (*strntol)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err);
- ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err);
- longlong (*strntoll)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err);
- ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err);
- double (*strntod)(struct charset_info_st *, char *s, uint l, char **e, int *err);
+ long (*strntol)(struct charset_info_st *, const char *s, uint l,
+ int base, char **e, int *err);
+ ulong (*strntoul)(struct charset_info_st *, const char *s, uint l,
+ int base, char **e, int *err);
+ longlong (*strntoll)(struct charset_info_st *, const char *s, uint l,
+ int base, char **e, int *err);
+ ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
+ int base, char **e, int *err);
+ double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
+ int *err);
- ulong (*scan)(struct charset_info_st *, const char *b, const char *e, int sq);
+ ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
+ int sq);
} CHARSET_INFO;
@@ -162,8 +172,10 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
int (*add)(CHARSET_INFO *cs));
/* declarations for simple charsets */
-extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
-extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
+extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
+ uint);
+extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
+ const uchar *, uint);
extern uint my_hash_caseup_simple(CHARSET_INFO *cs,
const byte *key, uint len);
@@ -181,36 +193,45 @@ extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
extern void my_tosort_8bit(CHARSET_INFO *, char *, uint);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
-extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint);
+extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *,
+ uint);
int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
-int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, const char *fmt, ...);
-
-long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err);
-ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err);
-longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err);
-ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err);
-double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e, int *err);
-
-int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, long int val);
-int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, longlong val);
+int my_snprintf_8bit(struct charset_info_st *, char *to, uint n,
+ const char *fmt, ...);
+
+long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ char **e, int *err);
+ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ char **e, int *err);
+longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ char **e, int *err);
+ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ char **e, int *err);
+double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
+ int *err);
+
+int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
+ long int val);
+int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
+ longlong val);
my_bool my_like_range_simple(CHARSET_INFO *cs,
- const char *ptr, uint ptr_length,
- int escape, int w_one, int w_many,
- uint res_length,
- char *min_str, char *max_str,
- uint *min_length, uint *max_length);
+ const char *ptr, uint ptr_length,
+ int escape, int w_one, int w_many,
+ uint res_length,
+ char *min_str, char *max_str,
+ uint *min_length, uint *max_length);
int my_wildcmp_8bit(CHARSET_INFO *,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many);
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many);
#ifdef USE_MB
@@ -220,15 +241,14 @@ extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern void my_caseup_mb(CHARSET_INFO *, char *, uint);
extern void my_casedn_mb(CHARSET_INFO *, char *, uint);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
-extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t, uint);
+extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t,
+ uint);
int my_wildcmp_mb(CHARSET_INFO *,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many);
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many);
#endif
-
-
#define _U 01 /* Upper case */
#define _L 02 /* Lower case */
#define _NMR 04 /* Numeral (digit) */
diff --git a/include/my_list.h b/include/my_list.h
index 056e1f13b36..789bbb50f97 100644
--- a/include/my_list.h
+++ b/include/my_list.h
@@ -32,8 +32,8 @@ extern LIST *list_add(LIST *root,LIST *element);
extern LIST *list_delete(LIST *root,LIST *element);
extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
-extern void list_free(LIST *root,uint free_data);
-extern uint list_length(LIST *list);
+extern void list_free(LIST *root,unsigned int free_data);
+extern unsigned int list_length(LIST *list);
extern int list_walk(LIST *list,list_walk_action action,gptr argument);
#define rest(a) ((a)->next)
diff --git a/include/mysql.h b/include/mysql.h
index 2e2558d7183..3935963e84c 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -439,17 +439,17 @@ enum PREP_STMT_STATE { MY_ST_UNKNOWN, MY_ST_PREPARE, MY_ST_EXECUTE };
/* bind structure */
typedef struct st_mysql_bind
{
- long *length; /* output length pointer */
- gptr buffer; /* buffer */
+ unsigned long *length; /* output length pointer */
+ my_bool *is_null; /* Pointer to null indicators */
+ char *buffer; /* buffer to get/put data */
enum enum_field_types buffer_type; /* buffer type */
- my_bool is_null; /* NULL indicator */
- my_bool is_long_data; /* long data indicator */
+ /* Must be set for string/blob data */
+ unsigned long buffer_length; /* buffer length */
/* The following are for internal use. Set by mysql_bind_param */
- unsigned long buffer_length; /* buffer length */
- long bind_length; /* Default length of data */
- my_bool long_ended; /* All data supplied for long */
+ unsigned long bind_length; /* Default length of data */
unsigned int param_number; /* For null count and error messages */
+ my_bool long_data_used; /* If used with mysql_send_long_data */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
} MYSQL_BIND;
@@ -465,20 +465,21 @@ typedef struct st_mysql_stmt
MYSQL_FIELD *fields; /* prepare meta info */
LIST list; /* list to keep track of all stmts */
char *query; /* query buffer */
+ char *buffer; /* buffer to hold results */
MEM_ROOT mem_root; /* root allocations */
MYSQL_RES tmp_result; /* Used by mysql_prepare_result */
unsigned long param_count; /* parameters count */
unsigned long field_count; /* fields count */
- unsigned long long_length; /* long buffer alloced length */
+ unsigned long buffer_length; /* long buffer alloced length */
unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */
enum PREP_STMT_STATE state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
my_bool long_alloced; /* flag to indicate long alloced */
- my_bool send_types_to_server; /* to indicate types supply to server */
- my_bool param_buffers; /* to indicate the param bound buffers */
- my_bool res_buffers; /* to indicate the output bound buffers */
- my_bool result_buffered; /* to indicate the results buffered */
+ my_bool send_types_to_server; /* Types sent to server */
+ my_bool param_buffers; /* param bound buffers */
+ my_bool res_buffers; /* output bound buffers */
+ my_bool result_buffered; /* Results buffered */
} MYSQL_STMT;
@@ -498,10 +499,7 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt);
my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
- unsigned long length,
- my_bool last_data);
-int STDCALL mysql_multi_query(MYSQL *mysql,const char *query,
- unsigned long len);
+ unsigned long length);
MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
@@ -515,8 +513,6 @@ my_bool STDCALL mysql_next_result(MYSQL *mysql);
#define MYSQL_STATUS_ERROR 1
#define MYSQL_NO_DATA 100
#define MYSQL_NEED_DATA 99
-#define MYSQL_NULL_DATA (-1)
-#define MYSQL_LONG_DATA (-2)
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
diff --git a/include/violite.h b/include/violite.h
index b8bfb2183a2..579043dcffa 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -216,6 +216,7 @@ enum SSL_type
SSL_TYPE_SPECIFIED
};
+
#ifndef EMBEDDED_LIBRARY
/* This structure is for every connection on both sides */
struct st_vio
@@ -233,7 +234,7 @@ struct st_vio
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
int (*read)(Vio*, gptr, int);
- int (*write)(Vio*, gptr, int);
+ int (*write)(Vio*, const gptr, int);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);