summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am25
-rw-r--r--include/base64.h51
-rw-r--r--include/config-netware.h2
-rw-r--r--include/config-win.h17
-rw-r--r--include/decimal.h107
-rw-r--r--include/errmsg.h9
-rw-r--r--include/m_ctype.h48
-rw-r--r--include/m_string.h7
-rw-r--r--include/merge.h93
-rw-r--r--include/my_base.h106
-rw-r--r--include/my_bitmap.h7
-rw-r--r--include/my_dbug.h10
-rw-r--r--include/my_global.h112
-rw-r--r--include/my_handler.h35
-rw-r--r--include/my_net.h5
-rw-r--r--include/my_pthread.h39
-rw-r--r--include/my_sys.h123
-rw-r--r--include/my_time.h24
-rw-r--r--include/myisam.h94
-rw-r--r--include/mysql.h132
-rw-r--r--include/mysql_com.h57
-rw-r--r--include/mysql_embed.h1
-rw-r--r--include/mysqld_error.h322
-rw-r--r--include/mysys_err.h17
-rw-r--r--include/nisam.h212
-rw-r--r--include/queues.h1
-rw-r--r--include/sql_state.h164
-rw-r--r--include/thr_lock.h45
-rw-r--r--include/violite.h21
29 files changed, 936 insertions, 950 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 3fa7b04d69a..8ad63f088ac 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -17,39 +17,34 @@
BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h
pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
- mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
+ mysql.h mysql_com.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
- sql_state.h mysql_time.h $(BUILT_SOURCES)
+ mysql_time.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \
- nisam.h heap.h merge.h my_bitmap.h\
+ heap.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h help_start.h help_end.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h hash.h thr_alarm.h \
- thr_lock.h t_ctype.h violite.h md5.h \
- mysql_version.h.in my_handler.h my_time.h
+ thr_lock.h t_ctype.h violite.h md5.h base64.h \
+ mysql_version.h.in my_handler.h my_time.h decimal.h
# mysql_version.h are generated
-SUPERCLEANFILES = mysql_version.h my_config.h
+CLEANFILES = mysql_version.h my_config.h readline
# Some include files that may be moved and patched by configure
-DISTCLEANFILES = sched.h $(SUPERCLEANFILES)
-
-clean-local:
- $(RM) -fr readline
-distclean-local:
- $(RM) -fr readline
-
-my_config.h: ../config.h
- $(CP) ../config.h my_config.h
+DISTCLEANFILES = sched.h $(CLEANFILES)
link_sources:
-$(RM) -fr readline
@readline_h_ln_cmd@
+my_config.h: ../config.h
+ $(CP) ../config.h my_config.h
+
# These files should not be included in distributions since they are
# generated by configure from the .h.in files
dist-hook:
diff --git a/include/base64.h b/include/base64.h
new file mode 100644
index 00000000000..fcc2f8b40dc
--- /dev/null
+++ b/include/base64.h
@@ -0,0 +1,51 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef __BASE64_H_INCLUDED__
+#define __BASE64_H_INCLUDED__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <mysys_priv.h>
+
+/*
+ Calculate how much memory needed for dst of base64_encode()
+*/
+int base64_needed_encoded_length(int length_of_data);
+
+/*
+ Calculate how much memory needed for dst of base64_decode()
+*/
+int base64_needed_decoded_length(int length_of_encoded_data);
+
+/*
+ Encode data as a base64 string
+*/
+int base64_encode(const void *src, size_t src_len, char *dst);
+
+/*
+ Decode a base64 string into data
+*/
+int base64_decode(const char *src, size_t src_len, void *dst);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !__BASE64_H_INCLUDED__ */
diff --git a/include/config-netware.h b/include/config-netware.h
index 74b3c3720e9..7def0053bf2 100644
--- a/include/config-netware.h
+++ b/include/config-netware.h
@@ -45,7 +45,9 @@ extern "C" {
#undef HAVE_SCHED_H
#undef HAVE_SYS_MMAN_H
#undef HAVE_SYNCH_H
+#undef HAVE_MMAP
#undef HAVE_RINT
+
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_SIGMASK 1
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
diff --git a/include/config-win.h b/include/config-win.h
index e1972051e67..edfb4ecc5c7 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -76,6 +76,7 @@ functions */
#define F_EXCLUSIVE 1 /* We have only exclusive locking */
#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
#define F_OK 0 /* parameter to access() */
+#define W_OK 2
#define S_IROTH S_IREAD /* for my_lib */
@@ -283,8 +284,8 @@ inline double ulonglong2double(ulonglong value)
#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
*(((long *) T)+1) = *(((long*) &V)+1); } while(0)
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define floatget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(float))
#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
+#define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float))
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
@@ -322,7 +323,7 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
#define HAVE_SETFILEPOINTER
-#define HAVE_VIO
+#define HAVE_VIO_READ_BUFF
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
@@ -350,6 +351,12 @@ inline double ulonglong2double(ulonglong value)
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
+#ifndef DEFAULT_HOME_ENV
+#define DEFAULT_HOME_ENV MYSQL_HOME
+#endif
+#ifndef DEFAULT_GROUP_SUFFIX_ENV
+#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
+#endif
/* File name handling */
@@ -361,6 +368,7 @@ inline double ulonglong2double(ulonglong value)
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
+#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
@@ -374,6 +382,7 @@ inline double ulonglong2double(ulonglong value)
#define statistic_add(V,C,L) (V)+=(C)
#endif
#define statistic_increment(V,L) thread_safe_increment((V),(L))
+#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
@@ -383,6 +392,9 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1
+/* #undef HAVE_OPENSSL */
+/* #undef HAVE_YASSL */
+
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
@@ -396,6 +408,7 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */
+#define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
diff --git a/include/decimal.h b/include/decimal.h
new file mode 100644
index 00000000000..2648e04c1cf
--- /dev/null
+++ b/include/decimal.h
@@ -0,0 +1,107 @@
+/* Copyright (C) 2000 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef _decimal_h
+#define _decimal_h
+
+typedef enum
+{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR}
+ decimal_round_mode;
+typedef int32 decimal_digit_t;
+
+typedef struct st_decimal_t {
+ int intg, frac, len;
+ my_bool sign;
+ decimal_digit_t *buf;
+} decimal_t;
+
+int internal_str2dec(const char *from, decimal_t *to, char **end,
+ my_bool fixed);
+int decimal2string(decimal_t *from, char *to, int *to_len,
+ int fixed_precision, int fixed_decimals,
+ char filler);
+int decimal2ulonglong(decimal_t *from, ulonglong *to);
+int ulonglong2decimal(ulonglong from, decimal_t *to);
+int decimal2longlong(decimal_t *from, longlong *to);
+int longlong2decimal(longlong from, decimal_t *to);
+int decimal2double(decimal_t *from, double *to);
+int double2decimal(double from, decimal_t *to);
+int decimal_actual_fraction(decimal_t *from);
+int decimal2bin(decimal_t *from, char *to, int precision, int scale);
+int bin2decimal(char *from, decimal_t *to, int precision, int scale);
+
+int decimal_size(int precision, int scale);
+int decimal_bin_size(int precision, int scale);
+int decimal_result_size(decimal_t *from1, decimal_t *from2, char op,
+ int param);
+
+int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to);
+int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to);
+int decimal_cmp(decimal_t *from1, decimal_t *from2);
+int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to);
+int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to,
+ int scale_incr);
+int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to);
+int decimal_round(decimal_t *from, decimal_t *to, int new_scale,
+ decimal_round_mode mode);
+int decimal_is_zero(decimal_t *from);
+void max_decimal(int precision, int frac, decimal_t *to);
+
+#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)
+#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1)
+
+/* set a decimal_t to zero */
+
+#define decimal_make_zero(dec) do { \
+ (dec)->buf[0]=0; \
+ (dec)->intg=1; \
+ (dec)->frac=0; \
+ (dec)->sign=0; \
+ } while(0)
+
+/*
+ returns the length of the buffer to hold string representation
+ of the decimal (including decimal dot, possible sign and \0)
+*/
+
+#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \
+ (dec)->frac + ((dec)->frac > 0) + 2)
+
+/* negate a decimal */
+#define decimal_neg(dec) do { (dec)->sign^=1; } while(0)
+
+/*
+ conventions:
+
+ decimal_smth() == 0 -- everything's ok
+ decimal_smth() <= 1 -- result is usable, but precision loss is possible
+ decimal_smth() <= 2 -- result can be unusable, most significant digits
+ could've been lost
+ decimal_smth() > 2 -- no result was generated
+*/
+
+#define E_DEC_OK 0
+#define E_DEC_TRUNCATED 1
+#define E_DEC_OVERFLOW 2
+#define E_DEC_DIV_ZERO 4
+#define E_DEC_BAD_NUM 8
+#define E_DEC_OOM 16
+
+#define E_DEC_ERROR 31
+#define E_DEC_FATAL_ERROR 30
+
+#endif
+
diff --git a/include/errmsg.h b/include/errmsg.h
index 96977227666..1dd5759c104 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -21,6 +21,7 @@
extern "C" {
#endif
void init_client_errs(void);
+void finish_client_errs(void);
extern const char *client_errors[]; /* Error messages */
#ifdef __cplusplus
}
@@ -35,6 +36,9 @@ extern const char *client_errors[]; /* Error messages */
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
+/* Do not add error numbers before CR_ERROR_FIRST. */
+/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
+#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/
#define CR_UNKNOWN_ERROR 2000
#define CR_SOCKET_CREATE_ERROR 2001
#define CR_CONNECTION_ERROR 2002
@@ -91,3 +95,8 @@ extern const char *client_errors[]; /* Error messages */
#define CR_FETCH_CANCELED 2050
#define CR_NO_DATA 2051
#define CR_NO_STMT_METADATA 2052
+#define CR_NO_RESULT_SET 2053
+#define CR_NOT_IMPLEMENTED 2054
+#define CR_ERROR_LAST /*Copy last error nr:*/ 2054
+/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
+
diff --git a/include/m_ctype.h b/include/m_ctype.h
index a5dc7cc00c6..b7361cb7d7b 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -44,6 +44,9 @@ typedef struct unicase_info_st
uint16 sort;
} MY_UNICASE_INFO;
+extern MY_UNICASE_INFO *my_unicase_default[256];
+extern MY_UNICASE_INFO *my_unicase_turkish[256];
+
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0
#define MY_CS_TOOSMALL -1
@@ -85,7 +88,7 @@ enum my_lex_states
{
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
- MY_LEX_REAL, MY_LEX_HEX_NUMBER,
+ MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER,
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
@@ -106,9 +109,11 @@ typedef struct my_collation_handler_st
int (*strnncoll)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint, my_bool);
int (*strnncollsp)(struct charset_info_st *,
- const uchar *, uint, const uchar *, uint);
+ const uchar *, uint, const uchar *, uint,
+ my_bool diff_if_only_endspace_difference);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
+ uint (*strnxfrmlen)(struct charset_info_st *, uint);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
pchar w_prefix, pchar w_one, pchar w_many,
@@ -130,6 +135,7 @@ typedef struct my_collation_handler_st
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
ulong *nr1, ulong *nr2);
+ my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
@@ -161,8 +167,10 @@ typedef struct my_charset_handler_st
/* Functions for case and sort convertion */
void (*caseup_str)(struct charset_info_st *, char *);
void (*casedn_str)(struct charset_info_st *, char *);
- void (*caseup)(struct charset_info_st *, char *, uint);
- void (*casedn)(struct charset_info_st *, char *, uint);
+ uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
+ char *dst, uint dstlen);
+ uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
+ char *dst, uint dstlen);
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
@@ -185,7 +193,7 @@ typedef struct my_charset_handler_st
int base, char **e, int *err);
double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
int *err);
- longlong (*my_strtoll10)(struct charset_info_st *cs,
+ longlong (*strtoll10)(struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
int sq);
@@ -213,13 +221,17 @@ typedef struct charset_info_st
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
+ MY_UNICASE_INFO **caseinfo;
uchar *state_map;
uchar *ident_map;
uint strxfrm_multiply;
+ uchar caseup_multiply;
+ uchar casedn_multiply;
uint mbminlen;
uint mbmaxlen;
uint16 min_sort_char;
uint16 max_sort_char; /* For LIKE optimization */
+ uchar pad_char;
my_bool escape_with_backslash_is_dangerous;
MY_CHARSET_HANDLER *cset;
@@ -233,6 +245,8 @@ extern CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
extern CHARSET_INFO my_charset_cp932_bin;
+extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
+extern CHARSET_INFO my_charset_eucjpms_bin;
extern CHARSET_INFO my_charset_euckr_korean_ci;
extern CHARSET_INFO my_charset_euckr_bin;
extern CHARSET_INFO my_charset_gb2312_chinese_ci;
@@ -258,12 +272,14 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
- uint);
+ uint);
+uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint);
+ const uchar *, uint,
+ my_bool diff_if_only_endspace_difference);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, uint len,
@@ -280,8 +296,10 @@ extern uint my_instr_simple(struct charset_info_st *,
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
-extern void my_caseup_8bit(CHARSET_INFO *, char *, uint);
-extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
+extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
+ char *dst, uint dstlen);
+extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
+ char *dst, uint dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
@@ -353,8 +371,10 @@ int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
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 uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
+ char *dst, uint dstlen);
+extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
+ char *dst, uint dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
@@ -380,6 +400,10 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
extern my_bool my_parse_charset_xml(const char *bug, uint len,
int (*add)(CHARSET_INFO *cs));
+my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
+my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
+
+
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */
@@ -431,8 +455,6 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
#define my_mbcharlen(s, a) 1
#endif
-#define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l)))
-#define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l)))
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))
diff --git a/include/m_string.h b/include/m_string.h
index d7edff4f626..c02ce92cd88 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -88,6 +88,13 @@
extern "C" {
#endif
+/*
+ my_str_malloc() and my_str_free() are assigned to implementations in
+ strings/alloc.c, but can be overridden in the calling program.
+ */
+extern void *(*my_str_malloc)(size_t);
+extern void (*my_str_free)(void *);
+
#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
diff --git a/include/merge.h b/include/merge.h
deleted file mode 100644
index 97cea5fabb1..00000000000
--- a/include/merge.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* This file should be included when using merge_isam_funktions */
-/* Author: Michael Widenius */
-
-#ifndef _merge_h
-#define _merge_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _my_base_h
-#include <my_base.h>
-#endif
-#ifndef _nisam_h
-#include <nisam.h>
-#endif
-
-#define MRG_NAME_EXT ".MRG"
-
- /* Param to/from mrg_info */
-
-typedef struct st_mrg_info /* Struct from h_info */
-{
- ulonglong records; /* Records in database */
- ulonglong deleted; /* Deleted records in database */
- ulonglong recpos; /* Pos for last used record */
- ulonglong data_file_length;
- uint reclength; /* Recordlength */
- int errkey; /* With key was dupplicated on err */
- uint options; /* HA_OPTION_... used */
-} MERGE_INFO;
-
-typedef struct st_mrg_table_info
-{
- N_INFO *table;
- ulonglong file_offset;
-} MRG_TABLE;
-
-typedef struct st_merge
-{
- MRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
- ulonglong records; /* records in tables */
- ulonglong del; /* Removed records */
- ulonglong data_file_length;
- uint tables,options,reclength;
- my_bool cache_in_use;
- LIST open_list;
-} MRG_INFO;
-
-typedef ulong mrg_off_t;
-
- /* Prototypes for merge-functions */
-
-extern int mrg_close(MRG_INFO *file);
-extern int mrg_delete(MRG_INFO *file,const byte *buff);
-extern MRG_INFO *mrg_open(const char *name,int mode,int wait_if_locked);
-extern int mrg_panic(enum ha_panic_function function);
-extern int mrg_rfirst(MRG_INFO *file,byte *buf,int inx);
-extern int mrg_rkey(MRG_INFO *file,byte *buf,int inx,const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int mrg_rrnd(MRG_INFO *file,byte *buf, mrg_off_t pos);
-extern int mrg_rsame(MRG_INFO *file,byte *record,int inx);
-extern int mrg_update(MRG_INFO *file,const byte *old,const byte *new_rec);
-extern int mrg_info(MRG_INFO *file,MERGE_INFO *x,int flag);
-extern int mrg_lock_database(MRG_INFO *file,int lock_type);
-extern int mrg_create(const char *name,const char **table_names);
-extern int mrg_extra(MRG_INFO *file,enum ha_extra_function function);
-extern ha_rows mrg_records_in_range(MRG_INFO *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-
-extern mrg_off_t mrg_position(MRG_INFO *info);
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/my_base.h b/include/my_base.h
index 271e7cd23ba..8eab79a96fd 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -146,7 +146,13 @@ enum ha_extra_function {
On-the-fly switching between unique and non-unique key inserting.
*/
HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
- HA_EXTRA_CHANGE_KEY_TO_DUP
+ HA_EXTRA_CHANGE_KEY_TO_DUP,
+ /*
+ When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep
+ other fields intact. When this is off (by default) InnoDB will use memcpy
+ to overwrite entire row.
+ */
+ HA_EXTRA_KEYREAD_PRESERVE_FIELDS
};
/* The following is parameter to ha_panic() */
@@ -175,8 +181,13 @@ enum ha_base_keytype {
HA_KEYTYPE_INT24=12,
HA_KEYTYPE_UINT24=13,
HA_KEYTYPE_INT8=14,
- HA_KEYTYPE_VARTEXT=15, /* Key is sorted as letters */
- HA_KEYTYPE_VARBINARY=16 /* Key is sorted as unsigned chars */
+ /* Varchar (0-255 bytes) with length packed with 1 byte */
+ HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */
+ HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */
+ /* Varchar (0-65535 bytes) with length packed with 2 bytes */
+ HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */
+ HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */
+ HA_KEYTYPE_BIT=19
};
#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
@@ -207,7 +218,7 @@ enum ha_base_keytype {
/*
Key has a part that can have end space. If this is an unique key
we have to handle it differently from other unique keys as we can find
- many matching rows for one key (becaue end space are not compared)
+ many matching rows for one key (because end space are not compared)
*/
#define HA_END_SPACE_KEY 4096
@@ -215,12 +226,18 @@ enum ha_base_keytype {
#define HA_SPACE_PACK 1 /* Pack space in key-seg */
#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */
-#define HA_VAR_LENGTH 8
+#define HA_VAR_LENGTH_PART 8
#define HA_NULL_PART 16
#define HA_BLOB_PART 32
#define HA_SWAP_KEY 64
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
+/*
+ End space in unique/varchar are considered equal. (Like 'a' and 'a ')
+ Only needed for internal temporary tables.
+*/
+#define HA_END_SPACE_ARE_EQUAL 512
+#define HA_BIT_PART 1024
/* optionbits for database */
#define HA_OPTION_PACK_RECORD 1
@@ -231,7 +248,7 @@ enum ha_base_keytype {
#define HA_OPTION_CHECKSUM 32
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
-#define HA_OPTION_CREATE_FROM_ENGINE 256
+#define HA_OPTION_CREATE_FROM_ENGINE 256
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
@@ -243,19 +260,55 @@ enum ha_base_keytype {
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_DELAY_KEY_WRITE 64
- /* Bits in flag to _status */
+/*
+ The following flags (OR-ed) are passed to handler::info() method.
+ The method copies misc handler information out of the storage engine
+ to data structures accessible from MySQL
-#define HA_STATUS_POS 1 /* Return position */
-#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */
-#define HA_STATUS_TIME 4 /* Return update time */
-#define HA_STATUS_CONST 8 /* Return constants values */
-#define HA_STATUS_VARIABLE 16
-#define HA_STATUS_ERRKEY 32
-#define HA_STATUS_AUTO 64
+ Same flags are also passed down to mi_status, myrg_status, etc.
+*/
+
+/* this one is not used */
+#define HA_STATUS_POS 1
+/*
+ assuming the table keeps shared actual copy of the 'info' and
+ local, possibly outdated copy, the following flag means that
+ it should not try to get the actual data (locking the shared structure)
+ slightly outdated version will suffice
+*/
+#define HA_STATUS_NO_LOCK 2
+/* update the time of the last modification (in handler::update_time) */
+#define HA_STATUS_TIME 4
+/*
+ update the 'constant' part of the info:
+ handler::max_data_file_length, max_index_file_length, create_time
+ sortkey, ref_length, block_size, data_file_name, index_file_name.
+ handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
+*/
+#define HA_STATUS_CONST 8
+/*
+ update the 'variable' part of the info:
+ handler::records, deleted, data_file_length, index_file_length,
+ delete_length, check_time, mean_rec_length
+*/
+#define HA_STATUS_VARIABLE 16
+/*
+ get the information about the key that caused last duplicate value error
+ update handler::errkey and handler::dupp_ref
+ see handler::get_dup_key()
+*/
+#define HA_STATUS_ERRKEY 32
+/*
+ update handler::auto_increment_value
+*/
+#define HA_STATUS_AUTO 64
/* Errorcodes given by functions */
/* opt_sum_query() assumes these codes are > 1 */
+/* Do not add error numbers before HA_ERR_FIRST. */
+/* If necessary to add lower numbers, change HA_ERR_FIRST accordingly. */
+#define HA_ERR_FIRST 120 /*Copy first error nr.*/
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
@@ -292,6 +345,11 @@ enum ha_base_keytype {
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
+#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
+
+#define HA_ERR_LAST 159 /*Copy last error nr.*/
+/* Add error numbers before HA_ERR_LAST and change it accordingly. */
+#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
/* Other constants */
@@ -342,6 +400,7 @@ enum ha_base_keytype {
#define HA_STATE_EXTEND_BLOCK 2048
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */
+/* myisampack expects no more than 32 field types. */
enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
@@ -354,6 +413,15 @@ enum data_file_type {
/* For key ranges */
+#define NO_MIN_RANGE 1
+#define NO_MAX_RANGE 2
+#define NEAR_MIN 4
+#define NEAR_MAX 8
+#define UNIQUE_RANGE 16
+#define EQ_RANGE 32
+#define NULL_RANGE 64
+#define GEOM_FLAG 128
+
typedef struct st_key_range
{
const byte *key;
@@ -361,6 +429,14 @@ typedef struct st_key_range
enum ha_rkey_function flag;
} key_range;
+typedef struct st_key_multi_range
+{
+ key_range start_key;
+ key_range end_key;
+ char *ptr; /* Free to use by caller (ptr to row etc) */
+ uint range_flag; /* key range flags see above */
+} KEY_MULTI_RANGE;
+
/* For number of records */
#ifdef BIG_TABLES
@@ -380,4 +456,6 @@ typedef ulong ha_rows;
#define MAX_FILE_SIZE LONGLONG_MAX
#endif
+#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
+
#endif /* _my_base_h */
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index a4511bf3414..f4fe28266e4 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -24,7 +24,7 @@
typedef struct st_bitmap
{
uchar *bitmap;
- uint bitmap_size;
+ uint bitmap_size; /* number of bytes occupied by the above */
/*
mutex will be acquired for the duration of each bitmap operation if
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
@@ -45,11 +45,16 @@ extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2);
+extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
+extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern uint bitmap_set_next(MY_BITMAP *map);
+extern uint bitmap_get_first(const MY_BITMAP *map);
+extern uint bitmap_bits_set(const MY_BITMAP *map);
extern void bitmap_clear_all(MY_BITMAP *map);
extern void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_free(MY_BITMAP *map);
extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
extern void bitmap_set_all(MY_BITMAP *map);
extern void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 711ece4335c..b76a3fcc8c9 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -25,6 +25,7 @@ extern int _db_on_,_no_db_;
extern FILE *_db_fp_;
extern char *_db_process_;
extern int _db_keyword_(const char *keyword);
+extern int _db_strict_keyword_(const char *keyword);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_push_(const char *control);
@@ -38,9 +39,9 @@ extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
-extern void _db_output_();
-extern void _db_lock_file();
-extern void _db_unlock_file();
+extern void _db_output_(uint flag);
+extern void _db_lock_file(void);
+extern void _db_unlock_file(void);
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
@@ -69,12 +70,15 @@ extern void _db_unlock_file();
#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_OUTPUT(A) { _db_output_(A); }
#define DBUG_ASSERT(A) assert(A)
+#define DBUG_EXECUTE_IF(keyword,a1) \
+ {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_RETURN(a1) return(a1)
#define DBUG_VOID_RETURN return
#define DBUG_EXECUTE(keyword,a1) {}
+#define DBUG_EXECUTE_IF(keyword,a1) {}
#define DBUG_PRINT(keyword,arglist) {}
#define DBUG_PUSH(a1) {}
#define DBUG_POP() {}
diff --git a/include/my_global.h b/include/my_global.h
index 0f99aacd079..851033cf366 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -107,6 +107,14 @@
#define _GNU_SOURCE 1
#endif
+/*
+ Temporary solution to solve bug#7156. Include "sys/types.h" before
+ the thread headers, else the function madvise() will not be defined
+*/
+#if defined(HAVE_SYS_TYPES_H) && ( defined(sun) || defined(__sun) )
+#include <sys/types.h>
+#endif
+
/* The client defines this to avoid all thread code */
#if defined(UNDEF_THREADS_HACK)
#undef THREAD
@@ -126,6 +134,38 @@
#define __STDC_EXT__ 1 /* To get large file support on hpux */
#endif
+/*
+ Solaris 9 include file <sys/feature_tests.h> refers to X/Open document
+
+ System Interfaces and Headers, Issue 5
+
+ saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes,
+ but apparently other systems (namely FreeBSD) don't agree.
+
+ On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600.
+ Furthermore, it tests that if a program requires older standard
+ (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be
+ run on a new compiler (that defines _STDC_C99) and issues an #error.
+ It's also an #error if a program requires new standard (_XOPEN_SOURCE=600
+ or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99.
+
+ To add more to this mess, Sun Studio C compiler defines _STDC_C99 while
+ C++ compiler does not!
+
+ So, in a desperate attempt to get correct prototypes for both
+ C and C++ code, we define either _XOPEN_SOURCE=600 or _XOPEN_SOURCE=500
+ depending on the compiler's announced C standard support.
+
+ Cleaner solutions are welcome.
+*/
+#ifdef __sun
+#if __STDC_VERSION__ - 0 >= 199901L
+#define _XOPEN_SOURCE 600
+#else
+#define _XOPEN_SOURCE 500
+#endif
+#endif
+
#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
@@ -198,22 +238,11 @@ C_MODE_END
/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
-#if SIZEOF_LONG == 4 && defined(__LONG_MAX__)
+#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_MINOR__ == 8)
#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */
#define __LONG_MAX__ 2147483647
#endif
-/* Fix problem when linking c++ programs with gcc 3.x */
-#ifdef DEFINE_CXA_PURE_VIRTUAL
-#define FIX_GCC_LINKING_PROBLEM \
-C_MODE_START int __cxa_pure_virtual() {\
- DBUG_ASSERT("Pure virtual method called." == "Aborted");\
- return 0;\
-} C_MODE_END
-#else
-#define FIX_GCC_LINKING_PROBLEM
-#endif
-
/* egcs 1.1.2 has a problem with memcpy on Alpha */
#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#define BAD_MEMCPY
@@ -323,7 +352,9 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
#undef LONGLONG_MAX /* standard system library 'limits.h' */
#ifdef __cplusplus
-#define HAVE_RINT /* rint() and isnan() functions are not */
+#ifndef HAVE_RINT
+#define HAVE_RINT
+#endif /* rint() and isnan() functions are not */
#define rint(a) std::rint(a) /* visible in C++ scope due to an error */
#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */
#endif
@@ -522,6 +553,15 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define O_NOFOLLOW 0
#endif
+/* additional file share flags for win32 */
+#ifdef __WIN__
+#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */
+#define _SH_DENYWRD 0x120 /* deny write mode & delete */
+#define _SH_DENYRDD 0x130 /* deny read mode & delete */
+#define _SH_DENYDEL 0x140 /* deny delete only */
+#endif /* __WIN__ */
+
+
/* #define USE_RECORD_LOCK */
/* Unsigned types supported by the compiler */
@@ -534,11 +574,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_LEN 256 /* Max file name len */
#define FN_HEADLEN 253 /* Max length of filepart of file name */
#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
-#ifdef PATH_MAX
-#define FN_REFLEN PATH_MAX/* Max length of full path-name */
-#else
#define FN_REFLEN 512 /* Max length of full path-name */
-#endif
#define FN_EXTCHAR '.'
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
@@ -669,6 +705,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define UINT_MAX16 0xFFFF
#define INT_MIN8 (~0x7F)
#define INT_MAX8 0x7F
+#define UINT_MAX8 0xFF
/* From limits.h instead */
#ifndef DBL_MIN
@@ -684,6 +721,17 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define isinf(X) 0
#endif
+/* Define missing math constants. */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef M_E
+#define M_E 2.7182818284590452354
+#endif
+#ifndef M_LN2
+#define M_LN2 0.69314718055994530942
+#endif
+
/*
Max size that must be added to a so that we know Size to make
adressable obj.
@@ -747,7 +795,7 @@ typedef long int32;
#endif
typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
#else
-error "Neither int or long is of 4 bytes width"
+#error "Neither int or long is of 4 bytes width"
#endif
#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)
@@ -899,10 +947,24 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
-#ifndef set_timespec
#ifdef HAVE_TIMESPEC_TS_SEC
-#define set_timespec(ABSTIME,SEC) { (ABSTIME).ts_sec=time(0) + (time_t) (SEC); (ABSTIME).ts_nsec=0; }
+#ifndef set_timespec
+#define set_timespec(ABSTIME,SEC) \
+{ \
+ (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
+ (ABSTIME).ts_nsec=0; \
+}
+#endif /* !set_timespec */
+#ifndef set_timespec_nsec
+#define set_timespec_nsec(ABSTIME,NSEC) \
+{ \
+ ulonglong now= my_getsystime() + (NSEC/100); \
+ (ABSTIME).ts_sec= (now / ULL(10000000)); \
+ (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
+}
+#endif /* !set_timespec_nsec */
#else
+#ifndef set_timespec
#define set_timespec(ABSTIME,SEC) \
{\
struct timeval tv;\
@@ -910,8 +972,16 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
(ABSTIME).tv_nsec=tv.tv_usec*1000;\
}
+#endif /* !set_timespec */
+#ifndef set_timespec_nsec
+#define set_timespec_nsec(ABSTIME,NSEC) \
+{\
+ ulonglong now= my_getsystime() + (NSEC/100); \
+ (ABSTIME).tv_sec= (now / ULL(10000000)); \
+ (ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
+}
+#endif /* !set_timespec_nsec */
#endif /* HAVE_TIMESPEC_TS_SEC */
-#endif /* set_timespec */
/*
Define-funktions for reading and storing in machine independent format
diff --git a/include/my_handler.h b/include/my_handler.h
index 8b3cc1a1ee0..d531e0fb3e1 100644
--- a/include/my_handler.h
+++ b/include/my_handler.h
@@ -25,15 +25,17 @@
typedef struct st_HA_KEYSEG /* Key-portion */
{
+ CHARSET_INFO *charset;
+ uint32 start; /* Start of key in record */
+ uint32 null_pos; /* position to NULL indicator */
+ uint16 bit_pos; /* Position to bit part */
+ uint16 flag;
+ uint16 length; /* Keylength */
uint8 type; /* Type of key (for sort) */
uint8 language;
uint8 null_bit; /* bitmask to test for NULL */
uint8 bit_start,bit_end; /* if bit field */
- uint16 flag;
- uint16 length; /* Keylength */
- uint32 start; /* Start of key in record */
- uint32 null_pos; /* position to NULL indicator */
- CHARSET_INFO *charset;
+ uint8 bit_length; /* Length of bit part */
} HA_KEYSEG;
#define get_key_length(length,key) \
@@ -57,6 +59,29 @@ typedef struct st_HA_KEYSEG /* Key-portion */
{ length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \
}
+#define store_key_length_inc(key,length) \
+{ if ((length) < 255) \
+ { *(key)++=(length); } \
+ else \
+ { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
+}
+
+#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
+ ((1 << (bit_len)) - 1))
+
+#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
+{ \
+ (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
+ ((bits) << (bit_ofs)); \
+ if ((bit_ofs) + (bit_len) > 8) \
+ (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
+ ((bits) >> (8 - (bit_ofs))); \
+}
+
+#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
+ set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
+
extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
my_bool, my_bool);
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
diff --git a/include/my_net.h b/include/my_net.h
index 7b42afa1f3a..71914964e46 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -72,6 +72,11 @@ C_MODE_START
#define in_addr_t uint32
#endif
+/* On some operating systems (e.g. Solaris) INADDR_NONE is not defined */
+#ifndef INADDR_NONE
+#define INADDR_NONE -1 /* Error value from inet_addr */
+#endif
+
/* Thread safe or portable version of some functions */
void my_inet_ntoa(struct in_addr in, char *buf);
diff --git a/include/my_pthread.h b/include/my_pthread.h
index b6b65d4389a..6f60a6df2c1 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -25,7 +25,10 @@
#endif
#ifdef __cplusplus
+#define EXTERNC extern "C"
extern "C" {
+#else
+#define EXTERNC
#endif /* __cplusplus */
#if defined(__WIN__) || defined(OS2)
@@ -77,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
-#define pthread_handler_decl(A,B) void * _Optlink A(void *B)
+#define pthread_handler_t EXTERNC void * _Optlink
typedef void * (_Optlink *pthread_handler)(void *);
#else
-#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
+#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
#endif
@@ -144,7 +147,7 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#define pthread_kill(A,B) raise(B)
#define pthread_exit(A) pthread_dummy()
#else
-#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
+#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
@@ -184,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
#define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_delete(A) thr_keydelete(A)
-#define pthread_handler_decl(A,B) void *A(void *B)
+#define pthread_handler_t EXTERNC void *
#define pthread_key(T,V) pthread_key_t V
void * my_pthread_getspecific_imp(pthread_key_t key);
@@ -262,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
#define pthread_detach_this_thread()
-#define pthread_handler_decl(A,B) void *A(void *B)
+#define pthread_handler_t EXTERNC void *
typedef void *(* pthread_handler)(void *);
/* Test first for RTS or FSU threads */
@@ -533,9 +536,15 @@ void safe_mutex_end(FILE *file);
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#define pthread_mutex_t safe_mutex_t
-#define safe_mutex_assert_owner(mp) DBUG_ASSERT((mp)->count > 0 && pthread_equal(pthread_self(),(mp)->thread))
+#define safe_mutex_assert_owner(mp) \
+ DBUG_ASSERT((mp)->count > 0 && \
+ pthread_equal(pthread_self(), (mp)->thread))
+#define safe_mutex_assert_not_owner(mp) \
+ DBUG_ASSERT(! (mp)->count || \
+ ! pthread_equal(pthread_self(), (mp)->thread))
#else
#define safe_mutex_assert_owner(mp)
+#define safe_mutex_assert_not_owner(mp)
#endif /* SAFE_MUTEX */
/* READ-WRITE thread locking */
@@ -678,21 +687,25 @@ extern pthread_t shutdown_th, main_th, signal_th;
#ifndef thread_safe_increment
#ifdef HAVE_ATOMIC_ADD
-#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
-#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
-#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
+#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V)
+#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V)
+#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V)
+#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V)
#else
#define thread_safe_increment(V,L) \
- pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
-#define thread_safe_add(V,C,L) \
- pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
+ (pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
+#define thread_safe_decrement(V,L) \
+ (pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
+#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
#define thread_safe_sub(V,C,L) \
- pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
+ (pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
#endif /* HAVE_ATOMIC_ADD */
#ifdef SAFE_STATISTICS
#define statistic_increment(V,L) thread_safe_increment((V),(L))
+#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#else
+#define statistic_decrement(V,L) (V)--
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
#endif /* SAFE_STATISTICS */
diff --git a/include/my_sys.h b/include/my_sys.h
index 02ea188a18e..44fe383bf4f 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -43,8 +43,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); }
-#define MAXMAPS (4) /* Number of error message maps */
-#define ERRMOD (1000) /* Max number of errors in a map */
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
#define NRERRBUFFS (2) /* Buffers for parameters */
#define MY_FILE_ERROR ((uint) ~0)
@@ -56,11 +54,10 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_FAE 8 /* Fatal if any error */
#define MY_WME 16 /* Write message on error */
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
-#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */
-#define MY_FULL_IO 512 /* For my_read - loop intil I/O
- is complete
- */
-#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
+#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
+#define MY_RAID 64 /* Support for RAID */
+#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
+#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
@@ -74,7 +71,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
-#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */
+#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@@ -121,6 +118,13 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_ERRNO_EDOM 33
#define MY_ERRNO_ERANGE 34
+ /* Bits for get_date timeflag */
+#define GETDATE_DATE_TIME 1
+#define GETDATE_SHORT_DATE 2
+#define GETDATE_HHMMSSTIME 4
+#define GETDATE_GMT 8
+#define GETDATE_FIXEDLENGTH 16
+
/* defines when allocating data */
#ifdef SAFEMALLOC
#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
@@ -131,6 +135,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C)
+#define TRASH(A,B) bfill(A, B, 0x8F)
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -153,12 +158,24 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strdup_with_length(const byte *from, uint length,
myf MyFlags);
-#define my_free(PTR,FG) my_no_flags_free(PTR)
+/* we do use FG (as a no-op) in below so that a typo on FG is caught */
+#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
#define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */
#define ORIG_CALLER_INFO /* nothing */
+#define TRASH(A,B) /* nothing */
#endif
+#ifdef HAVE_LARGE_PAGES
+extern uint my_get_large_page_size(void);
+extern gptr my_large_malloc(uint size, myf my_flags);
+extern void my_large_free(gptr ptr, myf my_flags);
+#else
+#define my_get_large_page_size() (0)
+#define my_large_malloc(A,B) my_malloc_lock((A),(B))
+#define my_large_free(A,B) my_free_lock((A),(B))
+#endif /* HAVE_LARGE_PAGES */
+
#ifdef HAVE_ALLOCA
#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
#pragma alloca
@@ -200,16 +217,20 @@ void __CDECL hfree(void *ptr);
extern int errno; /* declare errno */
#endif
#endif /* #ifndef errno */
-extern const char ** NEAR my_errmsg[];
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
extern char *home_dir; /* Home directory for user */
-extern char *my_progname; /* program-name (printed in errors) */
+extern const char *my_progname; /* program-name (printed in errors) */
extern char NEAR curr_dir[]; /* Current directory for user */
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
extern uint my_file_limit;
+#ifdef HAVE_LARGE_PAGES
+extern my_bool my_use_large_pages;
+extern uint my_large_page_size;
+#endif
+
/* charsets */
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
@@ -240,6 +261,10 @@ extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
extern char *defaults_extra_file;
+extern const char *defaults_group_suffix;
+extern const char *defaults_file;
+
+extern my_bool timed_mutexes;
typedef struct wild_file_pack /* Struct to hold info when selecting files */
{
@@ -256,7 +281,7 @@ enum loglevel {
enum cache_type
{
- READ_CACHE,WRITE_CACHE,
+ TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE,
SEQ_READ_APPEND /* sequential read or append */,
READ_FIFO, READ_NET,WRITE_NET};
@@ -502,12 +527,17 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
/* tell write offset in the SEQ_APPEND cache */
my_off_t my_b_append_tell(IO_CACHE* info);
+my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
*(info)->current_pos)
typedef uint32 ha_checksum;
+/* Define the type of function to be passed to process_default_option_files */
+typedef int (*Process_option_func)(void *ctx, const char *group_name,
+ const char *option);
+
#include <my_alloc.h>
/* Prototypes for mysys and my_func functions */
@@ -522,7 +552,6 @@ extern gptr my_once_alloc(uint Size,myf MyFlags);
extern void my_once_free(void);
extern char *my_once_strdup(const char *src,myf myflags);
extern char *my_once_memdup(const char *src, uint len, myf myflags);
-extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags);
extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file,
@@ -572,6 +601,7 @@ extern char *_my_strdup_with_length(const byte *from, uint length,
#ifdef __WIN__
extern int my_access(const char *path, int amode);
+extern File my_sopen(const char *path, int oflag, int shflag, int pmode);
#else
#define my_access access
#endif
@@ -590,6 +620,8 @@ extern int my_error _VARARGS((int nr,myf MyFlags, ...));
extern int my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...)
__attribute__ ((format (printf, 2, 4))));
+extern int my_error_register(const char **errmsgs, int first, int last);
+extern const char **my_error_unregister(int first, int last);
extern int my_message(uint my_err, const char *str,myf MyFlags);
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
@@ -662,6 +694,8 @@ extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument);
extern qsort2_cmp get_ptr_compare(uint);
+void my_store_ptr(byte *buff, uint pack_length, my_off_t pos);
+my_off_t my_get_ptr(byte *ptr, uint pack_length);
extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
enum cache_type type,my_off_t seek_offset,
pbool use_async_io, myf cache_myflags);
@@ -707,7 +741,8 @@ File create_temp_file(char *to, const char *dir, const char *pfx,
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO)
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO)
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
- uint init_alloc,uint alloc_increment CALLER_INFO_PROTO);
+ uint init_alloc,uint alloc_increment
+ CALLER_INFO_PROTO);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
extern byte *pop_dynamic(DYNAMIC_ARRAY*);
@@ -742,6 +777,7 @@ extern void my_free_lock(byte *ptr,myf flags);
extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size);
extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
+extern gptr multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
@@ -749,11 +785,19 @@ extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
-extern void get_defaults_files(int argc, char **argv,
- char **defaults, char **extra_defaults);
+extern int get_defaults_options(int argc, char **argv,
+ char **defaults, char **extra_defaults,
+ char **group_suffix);
extern int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
+extern int modify_defaults_file(const char *file_location, const char *option,
+ const char *option_value,
+ const char *section_name, int remove_option);
+extern int my_search_option_files(const char *conf_file, int *argc,
+ char ***argv, uint *args_used,
+ Process_option_func func, void *func_ctx);
extern void free_defaults(char **argv);
+extern void my_print_default_files(const char *conf_file);
extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(byte *, ulong *, ulong *);
extern my_bool my_uncompress(byte *, ulong *, ulong *);
@@ -761,6 +805,7 @@ extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count);
extern uint my_bit_log2(ulong value);
extern uint my_count_bits(ulonglong v);
+extern uint my_count_bits_ushort(ushort v);
extern void my_sleep(ulong m_seconds);
extern ulong crc32(ulong crc, const uchar *buf, uint len);
extern uint my_set_max_open_files(uint files);
@@ -769,6 +814,42 @@ void my_free_open_file_info(void);
ulonglong my_getsystime(void);
my_bool my_gethwaddr(uchar *to);
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+
+#ifndef MAP_NOSYNC
+#define MAP_NOSYNC 0
+#endif
+
+#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
+#ifdef HAVE_GETPAGESIZE
+#define my_getpagesize() getpagesize()
+#else
+/* qnx ? */
+#define my_getpagesize() 8192
+#endif
+#define my_munmap(a,b) munmap((a),(b))
+
+#else
+/* not a complete set of mmap() flags, but only those that nesessary */
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define MAP_SHARED 0x0001
+#define MAP_NOSYNC 0x0800
+#define MAP_FAILED ((void *)-1)
+#define MS_SYNC 0x0000
+
+#ifndef __NETWARE__
+#define HAVE_MMAP
+#endif
+
+int my_getpagesize(void);
+void *my_mmap(void *, size_t, int, int, int, my_off_t);
+int my_munmap(void *, size_t);
+#endif
+
+int my_msync(int, void *, size_t, int);
+
/* character sets */
extern uint get_charset_number(const char *cs_name, uint cs_flags);
extern uint get_collation_number(const char *name);
@@ -783,13 +864,21 @@ extern char *get_charsets_dir(char *buf);
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
extern my_bool init_compiled_charsets(myf flags);
extern void add_compiled_collation(CHARSET_INFO *cs);
-extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to,
+extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info,
+ char *to, ulong to_length,
const char *from, ulong length);
#ifdef __WIN__
#define BACKSLASH_MBTAIL
/* File system character set */
extern CHARSET_INFO *fs_character_set(void);
#endif
+extern ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info,
+ char *to, ulong to_length,
+ const char *from, ulong length);
+
+extern void thd_increment_bytes_sent(ulong length);
+extern void thd_increment_bytes_received(ulong length);
+extern void thd_increment_net_big_packet_count(ulong length);
#ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */
diff --git a/include/my_time.h b/include/my_time.h
index 94701e159c4..e52ef69475d 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -41,22 +41,36 @@ typedef long my_time_t;
#define YY_PART_YEAR 70
/* Flags to str_to_datetime */
-#define TIME_FUZZY_DATE 1
-#define TIME_DATETIME_ONLY 2
+#define TIME_FUZZY_DATE 1
+#define TIME_DATETIME_ONLY 2
+/* Must be same as MODE_NO_ZERO_IN_DATE */
+#define TIME_NO_ZERO_IN_DATE (65536L*2*2*2*2*2*2*2)
+/* Must be same as MODE_NO_ZERO_DATE */
+#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2)
+#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2)
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);
+longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
+ uint flags, int *was_cut);
+ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
+ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
+ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
+ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
-bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
- int *was_cut);
+
+my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
+ int *was_cut);
long calc_daynr(uint year,uint month,uint day);
+uint calc_days_in_year(uint year);
void init_time(void);
my_time_t
-my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
+my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
+ my_bool *in_dst_time_gap);
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
diff --git a/include/myisam.h b/include/myisam.h
index c2d3d99a414..56717524bb2 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -35,14 +35,26 @@ extern "C" {
/* defines used by myisam-funktions */
-/* The following defines can be increased if necessary */
-#define MI_MAX_KEY 64 /* Max allowed keys */
-#define MI_MAX_KEY_SEG 16 /* Max segments for key */
-#define MI_MAX_KEY_LENGTH 1000
+/*
+ There is a hard limit for the maximum number of keys as there are only
+ 8 bits in the index file header for the number of keys in a table.
+ This means that 0..255 keys can exist for a table. The idea of
+ MI_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
+ a MyISAM table for which one has more keys than MyISAM is normally
+ compiled for. If you don't have this, you will get a core dump when
+ running myisamchk compiled for 128 keys on a table with 255 keys.
+*/
+#define MI_MAX_POSSIBLE_KEY 255 /* For myisam_chk */
+#define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */
+/*
+ The following defines can be increased if necessary.
+ BUT: MI_MAX_KEY must be <= MI_MAX_POSSIBLE_KEY.
+*/
+#define MI_MAX_KEY 64 /* Max allowed keys */
+#define MI_MAX_KEY_SEG 16 /* Max segments for key */
+#define MI_MAX_KEY_LENGTH 1000
#define MI_MAX_KEY_BUFF (MI_MAX_KEY_LENGTH+MI_MAX_KEY_SEG*6+8+8)
-#define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */
-#define MI_MAX_POSSIBLE_KEY 64 /* For myisam_chk */
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
#define MI_NAME_IEXT ".MYI"
#define MI_NAME_DEXT ".MYD"
@@ -56,6 +68,63 @@ extern "C" {
#define mi_portable_sizeof_char_ptr 8
+/*
+ In the following macros '_keyno_' is 0 .. keys-1.
+ If there can be more keys than bits in the key_map, the highest bit
+ is for all upper keys. They cannot be switched individually.
+ This means that clearing of high keys is ignored, setting one high key
+ sets all high keys.
+*/
+#define MI_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
+#define MI_KEYMAP_HIGH_MASK (ULL(1) << (MI_KEYMAP_BITS - 1))
+#define mi_get_mask_all_keys_active(_keys_) \
+ (((_keys_) < MI_KEYMAP_BITS) ? \
+ ((ULL(1) << (_keys_)) - ULL(1)) : \
+ (~ ULL(0)))
+
+#if MI_MAX_KEY > MI_KEYMAP_BITS
+
+#define mi_is_key_active(_keymap_,_keyno_) \
+ (((_keyno_) < MI_KEYMAP_BITS) ? \
+ test((_keymap_) & (ULL(1) << (_keyno_))) : \
+ test((_keymap_) & MI_KEYMAP_HIGH_MASK))
+#define mi_set_key_active(_keymap_,_keyno_) \
+ (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
+ (ULL(1) << (_keyno_)) : \
+ MI_KEYMAP_HIGH_MASK)
+#define mi_clear_key_active(_keymap_,_keyno_) \
+ (_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
+ (~ (ULL(1) << (_keyno_))) : \
+ (~ (ULL(0))) /*ignore*/ )
+
+#else
+
+#define mi_is_key_active(_keymap_,_keyno_) \
+ test((_keymap_) & (ULL(1) << (_keyno_)))
+#define mi_set_key_active(_keymap_,_keyno_) \
+ (_keymap_)|= (ULL(1) << (_keyno_))
+#define mi_clear_key_active(_keymap_,_keyno_) \
+ (_keymap_)&= (~ (ULL(1) << (_keyno_)))
+
+#endif
+
+#define mi_is_any_key_active(_keymap_) \
+ test((_keymap_))
+#define mi_is_all_keys_active(_keymap_,_keys_) \
+ ((_keymap_) == mi_get_mask_all_keys_active(_keys_))
+#define mi_set_all_keys_active(_keymap_,_keys_) \
+ (_keymap_)= mi_get_mask_all_keys_active(_keys_)
+#define mi_clear_all_keys_active(_keymap_) \
+ (_keymap_)= 0
+#define mi_intersect_keys_active(_to_,_from_) \
+ (_to_)&= (_from_)
+#define mi_is_any_intersect_keys_active(_keymap1_,_keys_,_keymap2_) \
+ ((_keymap1_) & (_keymap2_) & \
+ mi_get_mask_all_keys_active(_keys_))
+#define mi_copy_keys_active(_to_,_maxkeys_,_from_) \
+ (_to_)= (mi_get_mask_all_keys_active(_maxkeys_) & \
+ (_from_))
+
/* Param to/from mi_info */
typedef struct st_mi_isaminfo /* Struct from h_info */
@@ -107,12 +176,13 @@ typedef struct st_mi_create_info
} MI_CREATE_INFO;
struct st_myisam_info; /* For referense */
+struct st_mi_isam_share;
typedef struct st_myisam_info MI_INFO;
-
struct st_mi_s_param;
typedef struct st_mi_keydef /* Key definition with open & info */
{
+ struct st_mi_isam_share *share; /* Pointer to base (set in mi_open) */
uint16 keysegs; /* Number of key-segment */
uint16 flag; /* NOSAME, PACK_USED */
@@ -189,10 +259,10 @@ typedef struct st_columndef /* column information */
typedef void (* invalidator_by_filename)(const char * filename);
extern my_string myisam_log_filename; /* Name of logfile */
-extern uint myisam_block_size;
+extern ulong myisam_block_size;
+extern ulong myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
-extern my_bool myisam_concurrent_insert;
-extern my_off_t myisam_max_temp_length,myisam_max_extra_temp_length;
+extern my_off_t myisam_max_temp_length;
extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
/* Prototypes for myisam-functions */
@@ -362,8 +432,8 @@ typedef struct st_mi_check_param
ha_checksum key_crc[MI_MAX_POSSIBLE_KEY];
ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY];
void *thd;
- char *db_name,*table_name;
- char *op_name;
+ const char *db_name, *table_name;
+ const char *op_name;
enum_mi_stats_method stats_method;
} MI_CHECK;
diff --git a/include/mysql.h b/include/mysql.h
index 0949937814c..c4b4e026e5b 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -74,14 +74,14 @@ extern char *mysql_unix_port;
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
#define IS_BLOB(n) ((n) & BLOB_FLAG)
-#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
+#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
typedef struct st_mysql_field {
char *name; /* Name of column */
- char *org_name; /* Original column name, if an alias */
+ char *org_name; /* Original column name, if an alias */
char *table; /* Table of column if column was a field */
char *org_table; /* Org table name, if table was an alias */
char *db; /* Database for table */
@@ -145,7 +145,8 @@ enum mysql_option
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, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH
+ MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
+ MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT
};
struct st_mysql_options {
@@ -186,6 +187,8 @@ struct st_mysql_options {
char *client_ip;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
my_bool secure_auth;
+ /* 0 - never report, 1 - always report (default) */
+ my_bool report_data_truncation;
/* function pointers for local infile support */
int (*local_infile_init)(void **, const char *, void *);
@@ -215,6 +218,18 @@ enum mysql_rpl_type
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
};
+typedef struct character_set
+{
+ unsigned int number; /* character set number */
+ unsigned int state; /* character set state */
+ const char *csname; /* collation name */
+ const char *name; /* character set name */
+ const char *comment; /* comment */
+ const char *dir; /* character set directory */
+ unsigned int mbminlen; /* min. length for multibyte strings */
+ unsigned int mbmaxlen; /* max. length for multibyte strings */
+} MY_CHARSET_INFO;
+
struct st_mysql_methods;
typedef struct st_mysql
@@ -228,7 +243,7 @@ typedef struct st_mysql
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 */
+ my_ulonglong extra_info; /* Not used */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
@@ -381,7 +396,7 @@ unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
const char * STDCALL mysql_info(MYSQL *mysql);
unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char * STDCALL mysql_character_set_name(MYSQL *mysql);
-int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
+int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
MYSQL * STDCALL mysql_init(MYSQL *mysql);
my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
@@ -415,6 +430,8 @@ 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,
+ MY_CHARSET_INFO *charset);
/* local infile support */
@@ -549,26 +566,91 @@ enum enum_mysql_stmt_state
};
-/* bind structure */
+/*
+ This structure is used to define bind information, and
+ internally by the client library.
+ Public members with their descriptions are listed below
+ (conventionally `On input' refers to the binds given to
+ mysql_stmt_bind_param, `On output' refers to the binds given
+ to mysql_stmt_bind_result):
+
+ buffer_type - One of the MYSQL_* types, used to describe
+ the host language type of buffer.
+ On output: if column type is different from
+ buffer_type, column value is automatically converted
+ to buffer_type before it is stored in the buffer.
+ buffer - On input: points to the buffer with input data.
+ On output: points to the buffer capable to store
+ output data.
+ The type of memory pointed by buffer must correspond
+ to buffer_type. See the correspondence table in
+ the comment to mysql_stmt_bind_param.
+
+ The two above members are mandatory for any kind of bind.
+
+ buffer_length - the length of the buffer. You don't have to set
+ it for any fixed length buffer: float, double,
+ int, etc. It must be set however for variable-length
+ types, such as BLOBs or STRINGs.
+
+ length - On input: in case when lengths of input values
+ are different for each execute, you can set this to
+ point at a variable containining value length. This
+ way the value length can be different in each execute.
+ If length is not NULL, buffer_length is not used.
+ Note, length can even point at buffer_length if
+ you keep bind structures around while fetching:
+ this way you can change buffer_length before
+ each execution, everything will work ok.
+ On output: if length is set, mysql_stmt_fetch will
+ write column length into it.
+
+ is_null - On input: points to a boolean variable that should
+ be set to TRUE for NULL values.
+ This member is useful only if your data may be
+ NULL in some but not all cases.
+ If your data is never NULL, is_null should be set to 0.
+ If your data is always NULL, set buffer_type
+ to MYSQL_TYPE_NULL, and is_null will not be used.
+
+ is_unsigned - On input: used to signify that values provided for one
+ of numeric types are unsigned.
+ On output describes signedness of the output buffer.
+ If, taking into account is_unsigned flag, column data
+ is out of range of the output buffer, data for this column
+ is regarded truncated. Note that this has no correspondence
+ to the sign of result set column, if you need to find it out
+ use mysql_stmt_result_metadata.
+ error - where to write a truncation error if it is present.
+ possible error value is:
+ 0 no truncation
+ 1 value is out of range or buffer is too small
+
+ Please note that MYSQL_BIND also has internals members.
+*/
+
typedef struct st_mysql_bind
{
unsigned long *length; /* output length pointer */
my_bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
+ /* set this if you want to track data truncations happened during fetch */
+ my_bool *error;
enum enum_field_types buffer_type; /* buffer type */
- unsigned long buffer_length; /* buffer length, must be set for str/binary */
-
- /* Following are for internal use. Set by mysql_stmt_bind_param */
- unsigned char *inter_buffer; /* for the current data position */
+ /* output buffer length, must be set when fetching str/binary */
+ unsigned long buffer_length;
+ unsigned char *row_ptr; /* for the current data position */
unsigned long offset; /* offset position for char/binary fetch */
- unsigned long internal_length; /* Used if length is 0 */
+ unsigned long length_value; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
unsigned int pack_length; /* Internal length for packed data */
+ my_bool error_value; /* used if error is 0 */
my_bool is_unsigned; /* set if integer type is unsigned */
my_bool long_data_used; /* If used with mysql_send_long_data */
- my_bool internal_is_null; /* Used if is_null is 0 */
+ my_bool is_null_value; /* Used if is_null is 0 */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
- void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
+ void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
+ unsigned char **row);
void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
unsigned char **row);
} MYSQL_BIND;
@@ -595,6 +677,13 @@ typedef struct st_mysql_stmt
int (*read_row_func)(struct st_mysql_stmt *stmt,
unsigned char **row);
unsigned long stmt_id; /* Id for prepared statement */
+ unsigned long flags; /* i.e. type of cursor to open */
+ unsigned long prefetch_rows; /* number of rows per one COM_FETCH */
+ /*
+ Copied from mysql->server_status after execute/fetch to know
+ server-side cursor status for this statement.
+ */
+ unsigned int server_status;
unsigned int last_errno; /* error code */
unsigned int param_count; /* input parameter count */
unsigned int field_count; /* number of columns in result set */
@@ -604,7 +693,7 @@ typedef struct st_mysql_stmt
/* Types of input parameters should be sent to server */
my_bool send_types_to_server;
my_bool bind_param_done; /* input buffers were supplied */
- my_bool bind_result_done; /* output buffers were supplied */
+ unsigned char bind_result_done; /* output buffers were supplied */
/* mysql_stmt_close() had to cancel this result */
my_bool unbuffered_fetch_cancelled;
/*
@@ -623,7 +712,17 @@ enum enum_stmt_attr_type
In the new API we do that only by request because it slows down
mysql_stmt_store_result sufficiently.
*/
- STMT_ATTR_UPDATE_MAX_LENGTH
+ STMT_ATTR_UPDATE_MAX_LENGTH,
+ /*
+ unsigned long with combination of cursor flags (read only, for update,
+ etc)
+ */
+ STMT_ATTR_CURSOR_TYPE,
+ /*
+ Amount of rows to retrieve from server per one fetch if using cursors.
+ Accepts unsigned long attribute in the range 1 - ulong_max
+ */
+ STMT_ATTR_PREFETCH_ROWS
};
@@ -705,7 +804,8 @@ void STDCALL mysql_close(MYSQL *sock);
/* status return codes */
-#define MYSQL_NO_DATA 100
+#define MYSQL_NO_DATA 100
+#define MYSQL_DATA_TRUNCATED 101
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 56c7f7d2ab5..1e595cdbba3 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -36,6 +36,11 @@
#define MYSQL_SERVICENAME "MySQL"
#endif /* __WIN__ */
+/*
+ You should add new commands to the end of this list, otherwise old
+ servers won't be able to handle them as 'unsupported'.
+*/
+
enum enum_server_command
{
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
@@ -43,8 +48,8 @@ enum enum_server_command
COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
- COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT,
- COM_RESET_STMT, COM_SET_OPTION,
+ COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
+ COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH,
/* don't forget to update const char *command_name[] in sql_parse.cc */
/* Must be last */
@@ -77,6 +82,7 @@ enum enum_server_command
#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
#define SET_FLAG 2048 /* field is a set */
+#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */
#define NUM_FLAG 32768 /* Field is num (for clients) */
#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
#define GROUP_FLAG 32768 /* Intern: Group field */
@@ -130,13 +136,27 @@ enum enum_server_command
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
+/*
+ The server was able to fulfill the clients request and opened a
+ read-only non-scrollable cursor for a query. This flag comes
+ in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
+*/
+#define SERVER_STATUS_CURSOR_EXISTS 64
+/*
+ This flag is sent when a read-only cursor is exhausted, in reply to
+ COM_STMT_FETCH command.
+*/
+#define SERVER_STATUS_LAST_ROW_SENT 128
#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */
+#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
+#define ONLY_KILL_QUERY 1
+
struct st_vio; /* Only C */
typedef struct st_vio Vio;
@@ -167,7 +187,13 @@ typedef struct st_net {
unsigned int *return_status;
unsigned char reading_or_writing;
char save_char;
- my_bool no_send_ok;
+ my_bool no_send_ok; /* For SPs and other things that do multiple stmts */
+ my_bool no_send_eof; /* For SPs' first version read-only cursors */
+ /*
+ Set if OK packet is already sent, and we do not need to send error
+ messages
+ */
+ my_bool no_send_error;
/*
Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet
@@ -190,7 +216,9 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
- MYSQL_TYPE_NEWDATE,
+ MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
+ MYSQL_TYPE_BIT,
+ MYSQL_TYPE_NEWDECIMAL=246,
MYSQL_TYPE_ENUM=247,
MYSQL_TYPE_SET=248,
MYSQL_TYPE_TINY_BLOB=249,
@@ -206,6 +234,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
/* For backward compatibility */
#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS
#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
+#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL
#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
@@ -231,6 +260,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY
#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM
#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
+#define FIELD_TYPE_BIT MYSQL_TYPE_BIT
/* Shutdown/kill enums and constants */
@@ -265,6 +295,16 @@ enum mysql_enum_shutdown_level {
KILL_CONNECTION= 255
};
+
+enum enum_cursor_type
+{
+ CURSOR_TYPE_NO_CURSOR= 0,
+ CURSOR_TYPE_READ_ONLY= 1,
+ CURSOR_TYPE_FOR_UPDATE= 2,
+ CURSOR_TYPE_SCROLLABLE= 4
+};
+
+
/* options for mysql_set_option */
enum enum_mysql_set_option
{
@@ -310,7 +350,8 @@ struct rand_struct {
/* The following is for user defined functions */
-enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};
+enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
+ DECIMAL_RESULT};
typedef struct st_udf_args
{
@@ -319,6 +360,8 @@ typedef struct st_udf_args
char **args; /* Pointer to argument */
unsigned long *lengths; /* Length of string arguments */
char *maybe_null; /* Set to 1 for all maybe_null args */
+ char **attributes; /* Pointer to attribute name */
+ unsigned long *attribute_lengths; /* Length of attribute arguments */
} UDF_ARGS;
/* This holds information about the result */
@@ -366,6 +409,7 @@ my_bool check_scramble(const char *reply, const char *message,
const unsigned char *hash_stage2);
void get_salt_from_password(unsigned char *res, const char *password);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+char *octet2hex(char *to, const char *str, unsigned int len);
/* end of password.c */
@@ -375,6 +419,9 @@ const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
my_bool my_init(void);
+extern int modify_defaults_file(const char *file_location, const char *option,
+ const char *option_value,
+ const char *section_name, int remove_option);
int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
my_bool my_thread_init(void);
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index 603af8e83b8..311d95eda73 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -24,7 +24,6 @@
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
-#undef HAVE_ISAM
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
deleted file mode 100644
index 776869ff045..00000000000
--- a/include/mysqld_error.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Definefile for error messagenumbers */
-
-#define ER_HASHCHK 1000
-#define ER_NISAMCHK 1001
-#define ER_NO 1002
-#define ER_YES 1003
-#define ER_CANT_CREATE_FILE 1004
-#define ER_CANT_CREATE_TABLE 1005
-#define ER_CANT_CREATE_DB 1006
-#define ER_DB_CREATE_EXISTS 1007
-#define ER_DB_DROP_EXISTS 1008
-#define ER_DB_DROP_DELETE 1009
-#define ER_DB_DROP_RMDIR 1010
-#define ER_CANT_DELETE_FILE 1011
-#define ER_CANT_FIND_SYSTEM_REC 1012
-#define ER_CANT_GET_STAT 1013
-#define ER_CANT_GET_WD 1014
-#define ER_CANT_LOCK 1015
-#define ER_CANT_OPEN_FILE 1016
-#define ER_FILE_NOT_FOUND 1017
-#define ER_CANT_READ_DIR 1018
-#define ER_CANT_SET_WD 1019
-#define ER_CHECKREAD 1020
-#define ER_DISK_FULL 1021
-#define ER_DUP_KEY 1022
-#define ER_ERROR_ON_CLOSE 1023
-#define ER_ERROR_ON_READ 1024
-#define ER_ERROR_ON_RENAME 1025
-#define ER_ERROR_ON_WRITE 1026
-#define ER_FILE_USED 1027
-#define ER_FILSORT_ABORT 1028
-#define ER_FORM_NOT_FOUND 1029
-#define ER_GET_ERRNO 1030
-#define ER_ILLEGAL_HA 1031
-#define ER_KEY_NOT_FOUND 1032
-#define ER_NOT_FORM_FILE 1033
-#define ER_NOT_KEYFILE 1034
-#define ER_OLD_KEYFILE 1035
-#define ER_OPEN_AS_READONLY 1036
-#define ER_OUTOFMEMORY 1037
-#define ER_OUT_OF_SORTMEMORY 1038
-#define ER_UNEXPECTED_EOF 1039
-#define ER_CON_COUNT_ERROR 1040
-#define ER_OUT_OF_RESOURCES 1041
-#define ER_BAD_HOST_ERROR 1042
-#define ER_HANDSHAKE_ERROR 1043
-#define ER_DBACCESS_DENIED_ERROR 1044
-#define ER_ACCESS_DENIED_ERROR 1045
-#define ER_NO_DB_ERROR 1046
-#define ER_UNKNOWN_COM_ERROR 1047
-#define ER_BAD_NULL_ERROR 1048
-#define ER_BAD_DB_ERROR 1049
-#define ER_TABLE_EXISTS_ERROR 1050
-#define ER_BAD_TABLE_ERROR 1051
-#define ER_NON_UNIQ_ERROR 1052
-#define ER_SERVER_SHUTDOWN 1053
-#define ER_BAD_FIELD_ERROR 1054
-#define ER_WRONG_FIELD_WITH_GROUP 1055
-#define ER_WRONG_GROUP_FIELD 1056
-#define ER_WRONG_SUM_SELECT 1057
-#define ER_WRONG_VALUE_COUNT 1058
-#define ER_TOO_LONG_IDENT 1059
-#define ER_DUP_FIELDNAME 1060
-#define ER_DUP_KEYNAME 1061
-#define ER_DUP_ENTRY 1062
-#define ER_WRONG_FIELD_SPEC 1063
-#define ER_PARSE_ERROR 1064
-#define ER_EMPTY_QUERY 1065
-#define ER_NONUNIQ_TABLE 1066
-#define ER_INVALID_DEFAULT 1067
-#define ER_MULTIPLE_PRI_KEY 1068
-#define ER_TOO_MANY_KEYS 1069
-#define ER_TOO_MANY_KEY_PARTS 1070
-#define ER_TOO_LONG_KEY 1071
-#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
-#define ER_BLOB_USED_AS_KEY 1073
-#define ER_TOO_BIG_FIELDLENGTH 1074
-#define ER_WRONG_AUTO_KEY 1075
-#define ER_READY 1076
-#define ER_NORMAL_SHUTDOWN 1077
-#define ER_GOT_SIGNAL 1078
-#define ER_SHUTDOWN_COMPLETE 1079
-#define ER_FORCING_CLOSE 1080
-#define ER_IPSOCK_ERROR 1081
-#define ER_NO_SUCH_INDEX 1082
-#define ER_WRONG_FIELD_TERMINATORS 1083
-#define ER_BLOBS_AND_NO_TERMINATED 1084
-#define ER_TEXTFILE_NOT_READABLE 1085
-#define ER_FILE_EXISTS_ERROR 1086
-#define ER_LOAD_INFO 1087
-#define ER_ALTER_INFO 1088
-#define ER_WRONG_SUB_KEY 1089
-#define ER_CANT_REMOVE_ALL_FIELDS 1090
-#define ER_CANT_DROP_FIELD_OR_KEY 1091
-#define ER_INSERT_INFO 1092
-#define ER_UPDATE_TABLE_USED 1093
-#define ER_NO_SUCH_THREAD 1094
-#define ER_KILL_DENIED_ERROR 1095
-#define ER_NO_TABLES_USED 1096
-#define ER_TOO_BIG_SET 1097
-#define ER_NO_UNIQUE_LOGFILE 1098
-#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
-#define ER_TABLE_NOT_LOCKED 1100
-#define ER_BLOB_CANT_HAVE_DEFAULT 1101
-#define ER_WRONG_DB_NAME 1102
-#define ER_WRONG_TABLE_NAME 1103
-#define ER_TOO_BIG_SELECT 1104
-#define ER_UNKNOWN_ERROR 1105
-#define ER_UNKNOWN_PROCEDURE 1106
-#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
-#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
-#define ER_UNKNOWN_TABLE 1109
-#define ER_FIELD_SPECIFIED_TWICE 1110
-#define ER_INVALID_GROUP_FUNC_USE 1111
-#define ER_UNSUPPORTED_EXTENSION 1112
-#define ER_TABLE_MUST_HAVE_COLUMNS 1113
-#define ER_RECORD_FILE_FULL 1114
-#define ER_UNKNOWN_CHARACTER_SET 1115
-#define ER_TOO_MANY_TABLES 1116
-#define ER_TOO_MANY_FIELDS 1117
-#define ER_TOO_BIG_ROWSIZE 1118
-#define ER_STACK_OVERRUN 1119
-#define ER_WRONG_OUTER_JOIN 1120
-#define ER_NULL_COLUMN_IN_INDEX 1121
-#define ER_CANT_FIND_UDF 1122
-#define ER_CANT_INITIALIZE_UDF 1123
-#define ER_UDF_NO_PATHS 1124
-#define ER_UDF_EXISTS 1125
-#define ER_CANT_OPEN_LIBRARY 1126
-#define ER_CANT_FIND_DL_ENTRY 1127
-#define ER_FUNCTION_NOT_DEFINED 1128
-#define ER_HOST_IS_BLOCKED 1129
-#define ER_HOST_NOT_PRIVILEGED 1130
-#define ER_PASSWORD_ANONYMOUS_USER 1131
-#define ER_PASSWORD_NOT_ALLOWED 1132
-#define ER_PASSWORD_NO_MATCH 1133
-#define ER_UPDATE_INFO 1134
-#define ER_CANT_CREATE_THREAD 1135
-#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
-#define ER_CANT_REOPEN_TABLE 1137
-#define ER_INVALID_USE_OF_NULL 1138
-#define ER_REGEXP_ERROR 1139
-#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
-#define ER_NONEXISTING_GRANT 1141
-#define ER_TABLEACCESS_DENIED_ERROR 1142
-#define ER_COLUMNACCESS_DENIED_ERROR 1143
-#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
-#define ER_GRANT_WRONG_HOST_OR_USER 1145
-#define ER_NO_SUCH_TABLE 1146
-#define ER_NONEXISTING_TABLE_GRANT 1147
-#define ER_NOT_ALLOWED_COMMAND 1148
-#define ER_SYNTAX_ERROR 1149
-#define ER_DELAYED_CANT_CHANGE_LOCK 1150
-#define ER_TOO_MANY_DELAYED_THREADS 1151
-#define ER_ABORTING_CONNECTION 1152
-#define ER_NET_PACKET_TOO_LARGE 1153
-#define ER_NET_READ_ERROR_FROM_PIPE 1154
-#define ER_NET_FCNTL_ERROR 1155
-#define ER_NET_PACKETS_OUT_OF_ORDER 1156
-#define ER_NET_UNCOMPRESS_ERROR 1157
-#define ER_NET_READ_ERROR 1158
-#define ER_NET_READ_INTERRUPTED 1159
-#define ER_NET_ERROR_ON_WRITE 1160
-#define ER_NET_WRITE_INTERRUPTED 1161
-#define ER_TOO_LONG_STRING 1162
-#define ER_TABLE_CANT_HANDLE_BLOB 1163
-#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
-#define ER_DELAYED_INSERT_TABLE_LOCKED 1165
-#define ER_WRONG_COLUMN_NAME 1166
-#define ER_WRONG_KEY_COLUMN 1167
-#define ER_WRONG_MRG_TABLE 1168
-#define ER_DUP_UNIQUE 1169
-#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
-#define ER_PRIMARY_CANT_HAVE_NULL 1171
-#define ER_TOO_MANY_ROWS 1172
-#define ER_REQUIRES_PRIMARY_KEY 1173
-#define ER_NO_RAID_COMPILED 1174
-#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
-#define ER_KEY_DOES_NOT_EXITS 1176
-#define ER_CHECK_NO_SUCH_TABLE 1177
-#define ER_CHECK_NOT_IMPLEMENTED 1178
-#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
-#define ER_ERROR_DURING_COMMIT 1180
-#define ER_ERROR_DURING_ROLLBACK 1181
-#define ER_ERROR_DURING_FLUSH_LOGS 1182
-#define ER_ERROR_DURING_CHECKPOINT 1183
-#define ER_NEW_ABORTING_CONNECTION 1184
-#define ER_DUMP_NOT_IMPLEMENTED 1185
-#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186
-#define ER_INDEX_REBUILD 1187
-#define ER_MASTER 1188
-#define ER_MASTER_NET_READ 1189
-#define ER_MASTER_NET_WRITE 1190
-#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
-#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
-#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
-#define ER_CRASHED_ON_USAGE 1194
-#define ER_CRASHED_ON_REPAIR 1195
-#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
-#define ER_TRANS_CACHE_FULL 1197
-#define ER_SLAVE_MUST_STOP 1198
-#define ER_SLAVE_NOT_RUNNING 1199
-#define ER_BAD_SLAVE 1200
-#define ER_MASTER_INFO 1201
-#define ER_SLAVE_THREAD 1202
-#define ER_TOO_MANY_USER_CONNECTIONS 1203
-#define ER_SET_CONSTANTS_ONLY 1204
-#define ER_LOCK_WAIT_TIMEOUT 1205
-#define ER_LOCK_TABLE_FULL 1206
-#define ER_READ_ONLY_TRANSACTION 1207
-#define ER_DROP_DB_WITH_READ_LOCK 1208
-#define ER_CREATE_DB_WITH_READ_LOCK 1209
-#define ER_WRONG_ARGUMENTS 1210
-#define ER_NO_PERMISSION_TO_CREATE_USER 1211
-#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
-#define ER_LOCK_DEADLOCK 1213
-#define ER_TABLE_CANT_HANDLE_FT 1214
-#define ER_CANNOT_ADD_FOREIGN 1215
-#define ER_NO_REFERENCED_ROW 1216
-#define ER_ROW_IS_REFERENCED 1217
-#define ER_CONNECT_TO_MASTER 1218
-#define ER_QUERY_ON_MASTER 1219
-#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220
-#define ER_WRONG_USAGE 1221
-#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222
-#define ER_CANT_UPDATE_WITH_READLOCK 1223
-#define ER_MIXING_NOT_ALLOWED 1224
-#define ER_DUP_ARGUMENT 1225
-#define ER_USER_LIMIT_REACHED 1226
-#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
-#define ER_LOCAL_VARIABLE 1228
-#define ER_GLOBAL_VARIABLE 1229
-#define ER_NO_DEFAULT 1230
-#define ER_WRONG_VALUE_FOR_VAR 1231
-#define ER_WRONG_TYPE_FOR_VAR 1232
-#define ER_VAR_CANT_BE_READ 1233
-#define ER_CANT_USE_OPTION_HERE 1234
-#define ER_NOT_SUPPORTED_YET 1235
-#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
-#define ER_SLAVE_IGNORED_TABLE 1237
-#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238
-#define ER_WRONG_FK_DEF 1239
-#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240
-#define ER_OPERAND_COLUMNS 1241
-#define ER_SUBQUERY_NO_1_ROW 1242
-#define ER_UNKNOWN_STMT_HANDLER 1243
-#define ER_CORRUPT_HELP_DB 1244
-#define ER_CYCLIC_REFERENCE 1245
-#define ER_AUTO_CONVERT 1246
-#define ER_ILLEGAL_REFERENCE 1247
-#define ER_DERIVED_MUST_HAVE_ALIAS 1248
-#define ER_SELECT_REDUCED 1249
-#define ER_TABLENAME_NOT_ALLOWED_HERE 1250
-#define ER_NOT_SUPPORTED_AUTH_MODE 1251
-#define ER_SPATIAL_CANT_HAVE_NULL 1252
-#define ER_COLLATION_CHARSET_MISMATCH 1253
-#define ER_SLAVE_WAS_RUNNING 1254
-#define ER_SLAVE_WAS_NOT_RUNNING 1255
-#define ER_TOO_BIG_FOR_UNCOMPRESS 1256
-#define ER_ZLIB_Z_MEM_ERROR 1257
-#define ER_ZLIB_Z_BUF_ERROR 1258
-#define ER_ZLIB_Z_DATA_ERROR 1259
-#define ER_CUT_VALUE_GROUP_CONCAT 1260
-#define ER_WARN_TOO_FEW_RECORDS 1261
-#define ER_WARN_TOO_MANY_RECORDS 1262
-#define ER_WARN_NULL_TO_NOTNULL 1263
-#define ER_WARN_DATA_OUT_OF_RANGE 1264
-#define ER_WARN_DATA_TRUNCATED 1265
-#define ER_WARN_USING_OTHER_HANDLER 1266
-#define ER_CANT_AGGREGATE_2COLLATIONS 1267
-#define ER_DROP_USER 1268
-#define ER_REVOKE_GRANTS 1269
-#define ER_CANT_AGGREGATE_3COLLATIONS 1270
-#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
-#define ER_VARIABLE_IS_NOT_STRUCT 1272
-#define ER_UNKNOWN_COLLATION 1273
-#define ER_SLAVE_IGNORED_SSL_PARAMS 1274
-#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275
-#define ER_WARN_FIELD_RESOLVED 1276
-#define ER_BAD_SLAVE_UNTIL_COND 1277
-#define ER_MISSING_SKIP_SLAVE 1278
-#define ER_UNTIL_COND_IGNORED 1279
-#define ER_WRONG_NAME_FOR_INDEX 1280
-#define ER_WRONG_NAME_FOR_CATALOG 1281
-#define ER_WARN_QC_RESIZE 1282
-#define ER_BAD_FT_COLUMN 1283
-#define ER_UNKNOWN_KEY_CACHE 1284
-#define ER_WARN_HOSTNAME_WONT_WORK 1285
-#define ER_UNKNOWN_STORAGE_ENGINE 1286
-#define ER_WARN_DEPRECATED_SYNTAX 1287
-#define ER_NON_UPDATABLE_TABLE 1288
-#define ER_FEATURE_DISABLED 1289
-#define ER_OPTION_PREVENTS_STATEMENT 1290
-#define ER_DUPLICATED_VALUE_IN_TYPE 1291
-#define ER_TRUNCATED_WRONG_VALUE 1292
-#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
-#define ER_INVALID_ON_UPDATE 1294
-#define ER_UNSUPPORTED_PS 1295
-#define ER_GET_ERRMSG 1296
-#define ER_GET_TEMPORARY_ERRMSG 1297
-#define ER_UNKNOWN_TIME_ZONE 1298
-#define ER_WARN_INVALID_TIMESTAMP 1299
-#define ER_INVALID_CHARACTER_STRING 1300
-#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
-#define ER_CONFLICTING_DECLARATIONS 1302
-#define ER_ERROR_MESSAGES 303
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 19106dc3553..341e6950792 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -20,14 +20,20 @@
extern "C" {
#endif
-#define GLOB 0 /* Error maps */
-#define GLOBERRS 29 /* Max number of error messages in map's */
-#define EE(X) globerrs[ X ] /* Defines to add error to right map */
+#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
+#define EE(X) (globerrs[(X) - EE_ERROR_FIRST])
extern const char * NEAR globerrs[]; /* my_error_messages is here */
/* Error message numbers in global map */
-#define EE_FILENOTFOUND 0
+/*
+ Do not add error numbers before EE_ERROR_FIRST.
+ If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
+
+ We start with error 1 to not confuse peoples with 'error 0'
+*/
+
+#define EE_ERROR_FIRST 1 /*Copy first error nr.*/
#define EE_CANTCREATEFILE 1
#define EE_READ 2
#define EE_WRITE 3
@@ -55,6 +61,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_REALPATH 26
#define EE_SYNC 27
#define EE_UNKNOWN_COLLATION 28
+#define EE_FILENOTFOUND 29
+#define EE_ERROR_LAST 29 /*Copy last error nr.*/
+/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
diff --git a/include/nisam.h b/include/nisam.h
deleted file mode 100644
index e8f29991a4e..00000000000
--- a/include/nisam.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* This file should be included when using nisam_funktions */
-/* Author: Michael Widenius */
-
-#ifndef _nisam_h
-#define _nisam_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _my_base_h
-#include <my_base.h>
-#endif
- /* defines used by nisam-funktions */
-
-#define N_MAXKEY 16 /* Max allowed keys */
-#define N_MAXKEY_SEG 16 /* Max segments for key */
-#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */
-#define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1)
-#define N_MAX_POSSIBLE_KEY_BUFF 500+9
-
-#define N_NAME_IEXT ".ISM"
-#define N_NAME_DEXT ".ISD"
-#define NI_POS_ERROR (~ (ulong) 0)
-
-
- /* Param to/from nisam_info */
-
-typedef struct st_n_isaminfo /* Struct from h_info */
-{
- ulong records; /* Records in database */
- ulong deleted; /* Deleted records in database */
- ulong recpos; /* Pos for last used record */
- ulong newrecpos; /* Pos if we write new record */
- ulong dupp_key_pos; /* Position to record with dupp key */
- ulong data_file_length, /* Length of data file */
- max_data_file_length,
- index_file_length,
- max_index_file_length,
- delete_length;
- uint reclength; /* Recordlength */
- uint mean_reclength; /* Mean recordlength (if packed) */
- uint keys; /* How many keys used */
- uint options; /* HA_OPTION_... used */
- int errkey, /* With key was dupplicated on err */
- sortkey; /* clustered by this key */
- File filenr; /* (uniq) filenr for datafile */
- time_t create_time; /* When table was created */
- time_t isamchk_time;
- time_t update_time;
- ulong *rec_per_key; /* for sql optimizing */
-} N_ISAMINFO;
-
-
- /* Info saved on file for each info-part */
-
-#ifdef __WATCOMC__
-#pragma pack(2)
-#define uint uint16 /* Same format as in MSDOS */
-#endif
-
-#ifdef __ZTC__
-#pragma ZTC align 2
-#define uint uint16 /* Same format as in MSDOS */
-#endif
-
-typedef struct st_n_save_keyseg /* Key-portion */
-{
- uint8 type; /* Typ av nyckel (f|r sort) */
- uint8 flag; /* HA_DIFF_LENGTH */
- uint16 start; /* Start of key in record */
- uint16 length; /* Keylength */
-} N_SAVE_KEYSEG;
-
-typedef struct st_n_save_keydef /* Key definition with create & info */
-{
- uint8 flag; /* NOSAME, PACK_USED */
- uint8 keysegs; /* Number of key-segment */
- uint16 block_length; /* Length of keyblock (auto) */
- uint16 keylength; /* Tot length of keyparts (auto) */
- uint16 minlength; /* min length of (packed) key (auto) */
- uint16 maxlength; /* max length of (packed) key (auto) */
-} N_SAVE_KEYDEF;
-
-typedef struct st_n_save_recinfo /* Info of record */
-{
- int16 type; /* en_fieldtype */
- uint16 length; /* length of field */
-} N_SAVE_RECINFO;
-
-
-#ifdef __ZTC__
-#pragma ZTC align
-#undef uint
-#endif
-
-#ifdef __WATCOMC__
-#pragma pack()
-#undef uint
-#endif
-
-
-struct st_isam_info; /* For referense */
-
-#ifndef ISAM_LIBRARY
-typedef struct st_isam_info N_INFO;
-#endif
-
-typedef struct st_n_keyseg /* Key-portion */
-{
- N_SAVE_KEYSEG base;
-} N_KEYSEG;
-
-
-typedef struct st_n_keydef /* Key definition with open & info */
-{
- N_SAVE_KEYDEF base;
- N_KEYSEG seg[N_MAXKEY_SEG+1];
- int (*bin_search)(struct st_isam_info *info,struct st_n_keydef *keyinfo,
- uchar *page,uchar *key,
- uint key_len,uint comp_flag,uchar * *ret_pos,
- uchar *buff);
- uint (*get_key)(struct st_n_keydef *keyinfo,uint nod_flag,uchar * *page,
- uchar *key);
-} N_KEYDEF;
-
-
-typedef struct st_decode_tree /* Decode huff-table */
-{
- uint16 *table;
- uint quick_table_bits;
- byte *intervalls;
-} DECODE_TREE;
-
-
-struct st_bit_buff;
-
-typedef struct st_n_recinfo /* Info of record */
-{
- N_SAVE_RECINFO base;
-#ifndef NOT_PACKED_DATABASES
- void (*unpack)(struct st_n_recinfo *rec,struct st_bit_buff *buff,
- uchar *start,uchar *end);
- enum en_fieldtype base_type;
- uint space_length_bits,pack_type;
- DECODE_TREE *huff_tree;
-#endif
-} N_RECINFO;
-
-
-extern my_string nisam_log_filename; /* Name of logfile */
-extern uint nisam_block_size;
-extern my_bool nisam_flush;
-
- /* Prototypes for nisam-functions */
-
-extern int nisam_close(struct st_isam_info *file);
-extern int nisam_delete(struct st_isam_info *file,const byte *buff);
-extern struct st_isam_info *nisam_open(const char *name,int mode,
- uint wait_if_locked);
-extern int nisam_panic(enum ha_panic_function function);
-extern int nisam_rfirst(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rkey(struct st_isam_info *file,byte *buf,int inx,
- const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int nisam_rlast(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rnext(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rprev(struct st_isam_info *file,byte *buf,int inx);
-extern int nisam_rrnd(struct st_isam_info *file,byte *buf,ulong pos);
-extern int nisam_rsame(struct st_isam_info *file,byte *record,int inx);
-extern int nisam_rsame_with_pos(struct st_isam_info *file,byte *record,
- int inx,ulong pos);
-extern int nisam_update(struct st_isam_info *file,const byte *old,
- const byte *new_record);
-extern int nisam_write(struct st_isam_info *file,const byte *buff);
-extern int nisam_info(struct st_isam_info *file,N_ISAMINFO *x,int flag);
-extern ulong nisam_position(struct st_isam_info *info);
-extern int nisam_lock_database(struct st_isam_info *file,int lock_type);
-extern int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo,
- N_RECINFO *recinfo,ulong records,
- ulong reloc,uint flags,uint options,
- ulong data_file_length);
-extern int nisam_extra(struct st_isam_info *file,
- enum ha_extra_function function);
-extern ulong nisam_records_in_range(struct st_isam_info *info,int inx,
- const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
-extern int nisam_log(int activate_log);
-extern int nisam_is_changed(struct st_isam_info *info);
-extern uint _calc_blob_length(uint length , const byte *pos);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/queues.h b/include/queues.h
index ac15b09719b..02ab768198e 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -53,6 +53,7 @@ int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,byte *element);
byte *queue_remove(QUEUE *queue,uint idx);
+#define queue_remove_all(queue) { (queue)->elements= 0; }
void _downheap(QUEUE *queue,uint idx);
void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0)
diff --git a/include/sql_state.h b/include/sql_state.h
deleted file mode 100644
index 52a359405e1..00000000000
--- a/include/sql_state.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Copyright (C) 2000-2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- This file includes a mapping from mysql_errno.h to sql_state (as used by
- MyODBC) and jdbc_state.
- It's suitable to include into a C struct for further processing
-
- The first column is the mysqld server error (declared in mysqld_error.h),
- the second column is the ODBC state (which the 4.1 server sends out by
- default) and the last is the state used by the JDBC driver.
- If the last column is "" then it means that the JDBC driver is using the
- ODBC state.
-
- The errors in this file are sorted in the same order as in mysqld_error.h
- to allow one to do binary searches for the sqlstate.
-*/
-
-ER_DUP_KEY, "23000", "",
-ER_OUTOFMEMORY, "HY001", "S1001",
-ER_OUT_OF_SORTMEMORY, "HY001", "S1001",
-ER_CON_COUNT_ERROR, "08004", "",
-ER_BAD_HOST_ERROR, "08S01", "",
-ER_HANDSHAKE_ERROR, "08S01", "",
-ER_DBACCESS_DENIED_ERROR, "42000", "",
-ER_ACCESS_DENIED_ERROR, "28000", "",
-ER_NO_DB_ERROR, "3D000", "",
-ER_UNKNOWN_COM_ERROR, "08S01", "",
-ER_BAD_NULL_ERROR, "23000", "",
-ER_BAD_DB_ERROR, "42000", "",
-ER_TABLE_EXISTS_ERROR, "42S01", "",
-ER_BAD_TABLE_ERROR, "42S02", "",
-ER_NON_UNIQ_ERROR, "23000", "",
-ER_SERVER_SHUTDOWN, "08S01", "",
-ER_BAD_FIELD_ERROR, "42S22", "S0022",
-ER_WRONG_FIELD_WITH_GROUP, "42000", "S1009",
-ER_WRONG_GROUP_FIELD, "42000", "S1009",
-ER_WRONG_SUM_SELECT, "42000", "S1009",
-ER_WRONG_VALUE_COUNT, "21S01", "",
-ER_TOO_LONG_IDENT, "42000", "S1009",
-ER_DUP_FIELDNAME, "42S21", "S1009",
-ER_DUP_KEYNAME, "42000", "S1009",
-ER_DUP_ENTRY, "23000", "S1009",
-ER_WRONG_FIELD_SPEC, "42000", "S1009",
-ER_PARSE_ERROR, "42000", "",
-ER_EMPTY_QUERY, "42000" , "",
-ER_NONUNIQ_TABLE, "42000", "S1009",
-ER_INVALID_DEFAULT, "42000", "S1009",
-ER_MULTIPLE_PRI_KEY, "42000", "S1009",
-ER_TOO_MANY_KEYS, "42000", "S1009",
-ER_TOO_MANY_KEY_PARTS, "42000", "S1009",
-ER_TOO_LONG_KEY, "42000", "S1009",
-ER_KEY_COLUMN_DOES_NOT_EXITS, "42000", "S1009",
-ER_BLOB_USED_AS_KEY, "42000", "S1009",
-ER_TOO_BIG_FIELDLENGTH, "42000", "S1009",
-ER_WRONG_AUTO_KEY, "42000", "S1009",
-ER_FORCING_CLOSE, "08S01", "",
-ER_IPSOCK_ERROR, "08S01", "",
-ER_NO_SUCH_INDEX, "42S12", "S1009",
-ER_WRONG_FIELD_TERMINATORS, "42000", "S1009",
-ER_BLOBS_AND_NO_TERMINATED, "42000", "S1009",
-ER_CANT_REMOVE_ALL_FIELDS, "42000", "",
-ER_CANT_DROP_FIELD_OR_KEY, "42000", "",
-ER_BLOB_CANT_HAVE_DEFAULT, "42000", "",
-ER_WRONG_DB_NAME, "42000", "",
-ER_WRONG_TABLE_NAME, "42000", "",
-ER_TOO_BIG_SELECT, "42000", "",
-ER_UNKNOWN_PROCEDURE, "42000", "",
-ER_WRONG_PARAMCOUNT_TO_PROCEDURE, "42000", "",
-ER_UNKNOWN_TABLE, "42S02", "",
-ER_FIELD_SPECIFIED_TWICE, "42000", "",
-ER_UNSUPPORTED_EXTENSION, "42000", "",
-ER_TABLE_MUST_HAVE_COLUMNS, "42000", "",
-ER_UNKNOWN_CHARACTER_SET, "42000", "",
-ER_TOO_BIG_ROWSIZE, "42000", "",
-ER_WRONG_OUTER_JOIN, "42000", "",
-ER_NULL_COLUMN_IN_INDEX, "42000", "",
-ER_PASSWORD_ANONYMOUS_USER, "42000", "",
-ER_PASSWORD_NOT_ALLOWED, "42000", "",
-ER_PASSWORD_NO_MATCH, "42000", "",
-ER_WRONG_VALUE_COUNT_ON_ROW, "21S01", "",
-ER_INVALID_USE_OF_NULL, "42000", "",
-ER_REGEXP_ERROR, "42000", "",
-ER_MIX_OF_GROUP_FUNC_AND_FIELDS,"42000", "",
-ER_NONEXISTING_GRANT, "42000", "",
-ER_TABLEACCESS_DENIED_ERROR, "42000", "",
-ER_COLUMNACCESS_DENIED_ERROR, "42000", "",
-ER_ILLEGAL_GRANT_FOR_TABLE, "42000", "",
-ER_GRANT_WRONG_HOST_OR_USER, "42000", "",
-ER_NO_SUCH_TABLE, "42S02", "",
-ER_NONEXISTING_TABLE_GRANT, "42000", "",
-ER_NOT_ALLOWED_COMMAND, "42000", "",
-ER_SYNTAX_ERROR, "42000", "",
-ER_ABORTING_CONNECTION, "08S01", "",
-ER_NET_PACKET_TOO_LARGE, "08S01", "",
-ER_NET_READ_ERROR_FROM_PIPE, "08S01", "",
-ER_NET_FCNTL_ERROR, "08S01", "",
-ER_NET_PACKETS_OUT_OF_ORDER, "08S01", "",
-ER_NET_UNCOMPRESS_ERROR, "08S01", "",
-ER_NET_READ_ERROR, "08S01", "",
-ER_NET_READ_INTERRUPTED, "08S01", "",
-ER_NET_ERROR_ON_WRITE, "08S01", "",
-ER_NET_WRITE_INTERRUPTED, "08S01", "",
-ER_TOO_LONG_STRING, "42000", "",
-ER_TABLE_CANT_HANDLE_BLOB, "42000", "",
-ER_TABLE_CANT_HANDLE_AUTO_INCREMENT, "42000", "",
-ER_WRONG_COLUMN_NAME, "42000", "",
-ER_WRONG_KEY_COLUMN, "42000", "",
-ER_DUP_UNIQUE, "23000", "",
-ER_BLOB_KEY_WITHOUT_LENGTH, "42000", "",
-ER_PRIMARY_CANT_HAVE_NULL, "42000", "",
-ER_TOO_MANY_ROWS, "42000", "",
-ER_REQUIRES_PRIMARY_KEY, "42000", "",
-ER_CHECK_NO_SUCH_TABLE, "42000", "",
-ER_CHECK_NOT_IMPLEMENTED, "42000", "",
-ER_CANT_DO_THIS_DURING_AN_TRANSACTION, "25000", "",
-ER_NEW_ABORTING_CONNECTION, "08S01", "",
-ER_MASTER_NET_READ, "08S01", "",
-ER_MASTER_NET_WRITE, "08S01", "",
-ER_TOO_MANY_USER_CONNECTIONS, "42000", "",
-ER_READ_ONLY_TRANSACTION, "25000", "",
-ER_NO_PERMISSION_TO_CREATE_USER,"42000", "",
-ER_LOCK_DEADLOCK, "40001", "",
-ER_NO_REFERENCED_ROW, "23000", "",
-ER_ROW_IS_REFERENCED, "23000", "",
-ER_CONNECT_TO_MASTER, "08S01", "",
-ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,"21000", "",
-ER_USER_LIMIT_REACHED, "42000", "",
-ER_NO_DEFAULT, "42000", "",
-ER_WRONG_VALUE_FOR_VAR, "42000", "",
-ER_WRONG_TYPE_FOR_VAR, "42000", "",
-ER_CANT_USE_OPTION_HERE, "42000", "",
-ER_NOT_SUPPORTED_YET, "42000", "",
-ER_WRONG_FK_DEF, "42000", "",
-ER_OPERAND_COLUMNS, "21000", "",
-ER_SUBQUERY_NO_1_ROW, "21000", "",
-ER_ILLEGAL_REFERENCE, "42S22", "",
-ER_DERIVED_MUST_HAVE_ALIAS, "42000", "",
-ER_SELECT_REDUCED, "01000", "",
-ER_TABLENAME_NOT_ALLOWED_HERE, "42000", "",
-ER_NOT_SUPPORTED_AUTH_MODE, "08004", "",
-ER_SPATIAL_CANT_HAVE_NULL, "42000", "",
-ER_COLLATION_CHARSET_MISMATCH, "42000", "",
-ER_WARN_TOO_FEW_RECORDS, "01000", "",
-ER_WARN_TOO_MANY_RECORDS, "01000", "",
-ER_WARN_NULL_TO_NOTNULL, "01000", "",
-ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
-ER_WARN_DATA_TRUNCATED, "01000", "",
-ER_WRONG_NAME_FOR_INDEX, "42000", "",
-ER_WRONG_NAME_FOR_CATALOG, "42000", "",
-ER_UNKNOWN_STORAGE_ENGINE, "42000", "",
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 7459ab7aefc..251d8e7c9cf 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -62,17 +62,45 @@ enum thr_lock_type { TL_IGNORE=-1,
/* Abort new lock request with an error */
TL_WRITE_ONLY};
+enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
+ THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 };
+
+
extern ulong max_write_lock_count;
+extern ulong table_lock_wait_timeout;
extern my_bool thr_lock_inited;
extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
-typedef struct st_thr_lock_data {
+/*
+ A description of the thread which owns the lock. The address
+ of an instance of this structure is used to uniquely identify the thread.
+*/
+
+typedef struct st_thr_lock_info
+{
pthread_t thread;
+ ulong thread_id;
+ ulong n_cursors;
+} THR_LOCK_INFO;
+
+/*
+ Lock owner identifier. Globally identifies the lock owner within the
+ thread and among all the threads. The address of an instance of this
+ structure is used as id.
+*/
+
+typedef struct st_thr_lock_owner
+{
+ THR_LOCK_INFO *info;
+} THR_LOCK_OWNER;
+
+
+typedef struct st_thr_lock_data {
+ THR_LOCK_OWNER *owner;
struct st_thr_lock_data *next,**prev;
struct st_thr_lock *lock;
pthread_cond_t *cond;
enum thr_lock_type type;
- ulong thread_id;
void *status_param; /* Param to status functions */
void *debug_print_param;
} THR_LOCK_DATA;
@@ -88,10 +116,10 @@ typedef struct st_thr_lock {
struct st_lock_list read;
struct st_lock_list write_wait;
struct st_lock_list write;
-/* write_lock_count is incremented for write locks and reset on read locks */
+ /* write_lock_count is incremented for write locks and reset on read locks */
ulong write_lock_count;
uint read_no_write_count;
- void (*get_status)(void*); /* When one gets a lock */
+ void (*get_status)(void*, int); /* When one gets a lock */
void (*copy_status)(void*,void*);
void (*update_status)(void*); /* Before release of write */
my_bool (*check_status)(void *);
@@ -102,13 +130,18 @@ extern LIST *thr_lock_thread_list;
extern pthread_mutex_t THR_LOCK_lock;
my_bool init_thr_lock(void); /* Must be called once/thread */
+#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg)
+void thr_lock_info_init(THR_LOCK_INFO *info);
void thr_lock_init(THR_LOCK *lock);
void thr_lock_delete(THR_LOCK *lock);
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param);
-int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type);
+enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
+ THR_LOCK_OWNER *owner,
+ enum thr_lock_type lock_type);
void thr_unlock(THR_LOCK_DATA *data);
-int thr_multi_lock(THR_LOCK_DATA **data,uint count);
+enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
+ uint count, THR_LOCK_OWNER *owner);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void thr_abort_locks(THR_LOCK *lock);
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
diff --git a/include/violite.h b/include/violite.h
index fbc6a546cc5..b48f3724f5b 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -37,7 +37,12 @@ enum enum_vio_type
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY
};
-Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
+
+#define VIO_LOCALHOST 1 /* a localhost connection */
+#define VIO_BUFFERED_READ 2 /* use buffered read */
+#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
+
+Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
@@ -57,8 +62,9 @@ int vio_close_pipe(Vio * vio);
void vio_delete(Vio* vio);
int vio_close(Vio* vio);
void vio_reset(Vio* vio, enum enum_vio_type type,
- my_socket sd, HANDLE hPipe, my_bool localhost);
+ my_socket sd, HANDLE hPipe, uint flags);
int vio_read(Vio *vio, gptr buf, int size);
+int vio_read_buff(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
@@ -95,6 +101,7 @@ void vio_timeout(Vio *vio,uint which, uint timeout);
#endif
#define HEADER_DES_LOCL_H dummy_something
+#define YASSL_MYSQL_COMPATIBLE
#include <openssl/ssl.h>
#include <openssl/err.h>
@@ -137,7 +144,7 @@ int vio_close_shared_memory(Vio * vio);
}
#endif
-#if defined(HAVE_VIO) && !defined(DONT_MAP_VIO)
+#if !defined(DONT_MAP_VIO)
#define vio_delete(vio) (vio)->viodelete(vio)
#define vio_errno(vio) (vio)->vioerrno(vio)
#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size)
@@ -153,7 +160,7 @@ int vio_close_shared_memory(Vio * vio);
#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds)
-#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
+#endif /* !defined(DONT_MAP_VIO) */
/* This enumerator is used in parser - should be always visible */
enum SSL_type
@@ -178,7 +185,10 @@ struct st_vio
struct sockaddr_in remote; /* Remote internet address */
enum enum_vio_type type; /* Type of connection */
char desc[30]; /* String description */
-#ifdef HAVE_VIO
+ char *read_buffer; /* buffer for vio_read_buff */
+ char *read_pos; /* start of unfetched data in the
+ read buffer */
+ char *read_end; /* end of unfetched data */
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
@@ -207,6 +217,5 @@ struct st_vio
char *shared_memory_pos;
NET *net;
#endif /* HAVE_SMEM */
-#endif /* HAVE_VIO */
};
#endif /* vio_violite_h_ */