summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h3
-rw-r--r--include/errmsg.h45
-rw-r--r--include/ft_global.h3
-rw-r--r--include/heap.h1
-rw-r--r--include/m_ctype.h75
-rw-r--r--include/m_string.h10
-rw-r--r--include/my_base.h20
-rw-r--r--include/my_global.h43
-rw-r--r--include/my_handler.h2
-rw-r--r--include/my_pthread.h5
-rw-r--r--include/my_sys.h55
-rw-r--r--include/my_tree.h4
-rw-r--r--include/myisam.h4
-rw-r--r--include/mysql.h153
-rw-r--r--include/mysql_com.h3
-rw-r--r--include/mysql_version.h.in5
-rw-r--r--include/mysqld_error.h185
-rw-r--r--include/sql_common.h2
18 files changed, 377 insertions, 241 deletions
diff --git a/include/config-win.h b/include/config-win.h
index 10490fd2f91..518f445861a 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -95,6 +95,7 @@ functions */
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
#define LL(A) ((__int64) A)
+#define ULL(A) ((unsigned __int64) A)
/* Type information */
@@ -323,7 +324,7 @@ inline double ulonglong2double(ulonglong value)
#define FN_ROOTDIR "\\"
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
-#define MY_NFILE 1024
+#define OS_FILE_LIMIT 2048
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
diff --git a/include/errmsg.h b/include/errmsg.h
index 8f3ddfa9796..140ff531248 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -63,27 +63,30 @@ extern const char *client_errors[]; /* Error messages */
#define CR_PROBE_MASTER_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027
+#define CR_WRONG_LICENSE 2028
/* new 4.1 error codes */
-#define CR_NULL_POINTER 2028
-#define CR_NO_PREPARE_STMT 2029
-#define CR_NOT_ALL_PARAMS_BOUND 2030
-#define CR_DATA_TRUNCATED 2031
-#define CR_NO_PARAMETERS_EXISTS 2032
-#define CR_INVALID_PARAMETER_NO 2033
-#define CR_INVALID_BUFFER_USE 2034
-#define CR_UNSUPPORTED_PARAM_TYPE 2035
+#define CR_NULL_POINTER 2029
+#define CR_NO_PREPARE_STMT 2030
+#define CR_PARAMS_NOT_BOUND 2031
+#define CR_DATA_TRUNCATED 2032
+#define CR_NO_PARAMETERS_EXISTS 2033
+#define CR_INVALID_PARAMETER_NO 2034
+#define CR_INVALID_BUFFER_USE 2035
+#define CR_UNSUPPORTED_PARAM_TYPE 2036
-#define CR_SHARED_MEMORY_CONNECTION 2036
-#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2037
-#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2038
-#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2039
-#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2040
-#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2041
-#define CR_SHARED_MEMORY_MAP_ERROR 2042
-#define CR_SHARED_MEMORY_EVENT_ERROR 2043
-#define CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR 2044
-#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045
-#define CR_CONN_UNKNOW_PROTOCOL 2046
-#define CR_INVALID_CONN_HANDLE 2047
-#define CR_SECURE_AUTH 2048
+#define CR_SHARED_MEMORY_CONNECTION 2037
+#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038
+#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039
+#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040
+#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041
+#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042
+#define CR_SHARED_MEMORY_MAP_ERROR 2043
+#define CR_SHARED_MEMORY_EVENT_ERROR 2044
+#define CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR 2045
+#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046
+#define CR_CONN_UNKNOW_PROTOCOL 2047
+#define CR_INVALID_CONN_HANDLE 2048
+#define CR_SECURE_AUTH 2049
+#define CR_FETCH_CANCELLED 2050
+#define CR_NO_DATA 2051
diff --git a/include/ft_global.h b/include/ft_global.h
index c30b0665216..94f6ad9ef51 100644
--- a/include/ft_global.h
+++ b/include/ft_global.h
@@ -52,7 +52,7 @@ extern const char *ft_precompiled_stopwords[];
extern ulong ft_min_word_len;
extern ulong ft_max_word_len;
extern ulong ft_query_expansion_limit;
-extern const char *ft_boolean_syntax;
+extern char ft_boolean_syntax[15];
int ft_init_stopwords(void);
void ft_free_stopwords(void);
@@ -63,6 +63,7 @@ void ft_free_stopwords(void);
#define FT_EXPAND 4 /* query expansion */
FT_INFO *ft_init_search(uint,void *, uint, byte *, uint, byte *);
+my_bool ft_boolean_check_syntax_string(const byte *);
#ifdef __cplusplus
}
diff --git a/include/heap.h b/include/heap.h
index 3702d88ac70..c5f2be81fb7 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -138,6 +138,7 @@ typedef struct st_heap_info
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
TREE_ELEMENT **last_pos;
uint lastkey_len;
+ my_bool implicit_emptied;
#ifdef THREAD
THR_LOCK_DATA lock;
#endif
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 88c3418fc0d..e5f1c4fc3c0 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -111,7 +111,7 @@ typedef struct my_collation_handler_st
uchar *, uint, const uchar *, uint);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
- int w_prefix, int w_one, int w_many,
+ pchar w_prefix, pchar w_one, pchar w_many,
uint res_length,
char *min_str, char *max_str,
uint *min_len, uint *max_len);
@@ -135,6 +135,7 @@ typedef struct my_collation_handler_st
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
+extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
typedef struct my_charset_handler_st
@@ -144,7 +145,7 @@ typedef struct my_charset_handler_st
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
- uint (*wellformedlen)(struct charset_info_st *,
+ uint (*well_formed_len)(struct charset_info_st *,
const char *b,const char *e, uint nchars);
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
@@ -210,7 +211,8 @@ typedef struct charset_info_st
uint strxfrm_multiply;
uint mbminlen;
uint mbmaxlen;
- char max_sort_char; /* For LIKE optimization */
+ uint16 min_sort_char;
+ uint16 max_sort_char; /* For LIKE optimization */
MY_CHARSET_HANDLER *cset;
MY_COLLATION_HANDLER *coll;
@@ -237,13 +239,13 @@ extern CHARSET_INFO my_charset_tis620_thai_ci;
extern CHARSET_INFO my_charset_tis620_bin;
extern CHARSET_INFO my_charset_ucs2_general_ci;
extern CHARSET_INFO my_charset_ucs2_bin;
+extern CHARSET_INFO my_charset_ucs2_general_uca;
extern CHARSET_INFO my_charset_ujis_japanese_ci;
extern CHARSET_INFO my_charset_ujis_bin;
extern CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf8_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
-
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
uint);
@@ -300,11 +302,18 @@ void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
my_bool my_like_range_simple(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
- int escape, int w_one, int w_many,
+ pbool escape, pbool w_one, pbool w_many,
uint res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
+my_bool my_like_range_ucs2(CHARSET_INFO *cs,
+ const char *ptr, uint ptr_length,
+ pbool escape, pbool w_one, pbool w_many,
+ uint res_length,
+ char *min_str, char *max_str,
+ uint *min_length, uint *max_length);
+
int my_wildcmp_8bit(CHARSET_INFO *,
const char *str,const char *str_end,
@@ -313,7 +322,7 @@ int my_wildcmp_8bit(CHARSET_INFO *,
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
-uint my_wellformedlen_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
+uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
@@ -330,7 +339,7 @@ int my_wildcmp_mb(CHARSET_INFO *,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
-uint my_wellformedlen_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
+uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_instr_mb(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
@@ -340,23 +349,14 @@ uint my_instr_mb(struct charset_info_st *,
extern my_bool my_parse_charset_xml(const char *bug, uint len,
int (*add)(CHARSET_INFO *cs));
-#undef _U
-#undef _L
-#undef _NMR
-#undef _SPC
-#undef _PNT
-#undef _CTR
-#undef _B
-#undef _X
-
-#define _U 01 /* Upper case */
-#define _L 02 /* Lower case */
-#define _NMR 04 /* Numeral (digit) */
-#define _SPC 010 /* Spacing character */
-#define _PNT 020 /* Punctuation */
-#define _CTR 040 /* Control character */
-#define _B 0100 /* Blank */
-#define _X 0200 /* heXadecimal digit */
+#define _MY_U 01 /* Upper case */
+#define _MY_L 02 /* Lower case */
+#define _MY_NMR 04 /* Numeral (digit) */
+#define _MY_SPC 010 /* Spacing character */
+#define _MY_PNT 020 /* Punctuation */
+#define _MY_CTR 040 /* Control character */
+#define _MY_B 0100 /* Blank */
+#define _MY_X 0200 /* heXadecimal digit */
#define my_isascii(c) (!((c) & ~0177))
@@ -365,22 +365,23 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
#define my_toprint(c) ((c) | 64)
#define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)])
#define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)])
-#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L))
-#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U)
-#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L)
-#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _NMR)
-#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X)
-#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _NMR))
-#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _SPC)
-#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _PNT)
-#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B))
-#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR))
-#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _CTR)
+#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L))
+#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U)
+#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L)
+#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR)
+#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X)
+#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR))
+#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC)
+#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT)
+#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B))
+#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR))
+#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR)
/* Some macros that should be cleaned up a little */
#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_')
#define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_')
+#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
#define my_strnxfrm(s, a, b, c, d) ((s)->coll->strnxfrm((s), (a), (b), (c), (d)))
#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d)))
@@ -391,7 +392,11 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len,
#define use_mb(s) ((s)->cset->ismbchar != NULL)
#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
+#ifdef USE_MB
#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a)))
+#else
+#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)))
diff --git a/include/m_string.h b/include/m_string.h
index d72342fb3c1..c86801ae2d2 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -125,8 +125,8 @@ extern void bmove_align(gptr dst,const gptr src,uint len);
#ifdef HAVE_purify
#include <assert.h>
#define memcpy_overlap(A,B,C) \
-DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \
-bmove((byte*) key,(byte*) from,(size_t) length);
+DBUG_ASSERT((A) <= (B) || ((B)+(C)) <= (A)); \
+bmove((byte*) (A),(byte*) (B),(size_t) (C));
#else
#define memcpy_overlap(A,B,C) memcpy((A), (B), (C))
#endif /* HAVE_purify */
@@ -201,7 +201,7 @@ extern int strcmp(const char *, const char *);
extern size_t strlen(const char *);
#endif
#endif
-#ifndef HAVE_STRNLEN
+#ifndef HAVE_STRNLEN
extern uint strnlen(const char *s, uint n);
#endif
@@ -215,7 +215,9 @@ extern char *strstr(const char *, const char *);
#endif
extern int is_prefix(const char *, const char *);
-/* Conversion rutins */
+/* Conversion routines */
+double my_strtod(const char *str, char **end);
+double my_atof(const char *nptr);
#ifdef USE_MY_ITOA
extern char *my_itoa(int val,char *dst,int radix);
diff --git a/include/my_base.h b/include/my_base.h
index 89b46de520f..d23a70b8a55 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -28,6 +28,11 @@
#include <my_sys.h>
#include <m_string.h>
#include <errno.h>
+
+#ifndef EOVERFLOW
+#define EOVERFLOW 84
+#endif
+
#ifdef MSDOS
#include <share.h> /* Neaded for sopen() */
#endif
@@ -126,13 +131,22 @@ enum ha_extra_function {
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY,
/*
- Instructs InnoDB to retrieve all columns, not just those where
- field->query_id is the same as the current query id
+ Instructs InnoDB to retrieve all columns (except in key read), not just
+ those where field->query_id is the same as the current query id
*/
HA_EXTRA_RETRIEVE_ALL_COLS,
+ /*
+ Instructs InnoDB to retrieve at least all the primary key columns
+ */
+ HA_EXTRA_RETRIEVE_PRIMARY_KEY,
HA_EXTRA_PREPARE_FOR_DELETE,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
- HA_EXTRA_PRELOAD_BUFFER_SIZE /* Set buffer size for preloading */
+ HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
+ /*
+ On-the-fly switching between unique and non-unique key inserting.
+ */
+ HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
+ HA_EXTRA_CHANGE_KEY_TO_DUP
};
/* The following is parameter to ha_panic() */
diff --git a/include/my_global.h b/include/my_global.h
index 8523df629a2..e1ae49aeb3e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -300,7 +300,9 @@ C_MODE_END
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
+C_MODE_START
#include <asm/atomic.h>
+C_MODE_END
#endif
#include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
@@ -389,8 +391,8 @@ typedef unsigned short ushort;
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
#define test(a) ((a) ? 1 : 0)
-#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
-#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
+#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
+#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
@@ -529,7 +531,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_EXTCHAR '.'
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
-#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */
+#define FN_PARENTDIR ".." /* Parent directory; Must be a string */
#define FN_DEVCHAR ':'
#ifndef FN_LIBCHAR
@@ -540,7 +542,10 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_LIBCHAR '/'
#define FN_ROOTDIR "/"
#endif
-#define MY_NFILE 1024 /* This is only used to save filenames */
+#endif
+#define MY_NFILE 64 /* This is only used to save filenames */
+#ifndef OS_FILE_LIMIT
+#define OS_FILE_LIMIT 65535
#endif
/* #define EXT_IN_LIBNAME */
@@ -588,14 +593,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
/* Some defines of functions for portability */
-#ifndef HAVE_ATOD
-#define atod atof
-#endif
-#ifdef USE_MY_ATOF
-#define atof my_atof
-extern void init_my_atof(void);
-extern double my_atof(const char*);
-#endif
#undef remove /* Crashes MySQL on SCO 5.0.0 */
#ifndef __WIN__
#ifdef OS2
@@ -684,6 +681,10 @@ extern double my_atof(const char*);
#define FLT_MAX ((float)3.40282346638528860e+38)
#endif
+#ifndef HAVE_ISINF
+#define isinf(X) 0
+#endif
+
/* Define missing math constants. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -709,7 +710,7 @@ typedef long long my_ptrdiff_t;
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
- /* Offset of filed f in structure t */
+ /* Offset of field f in structure t */
#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
@@ -859,6 +860,14 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#endif
#endif
+#ifndef ULL
+#ifdef HAVE_LONG_LONG
+#define ULL(A) A ## ULL
+#else
+#define ULL(A) A ## UL
+#endif
+#endif
+
/*
Defines to make it possible to prioritize register assignments. No
longer that important with modern compilers.
@@ -1129,10 +1138,10 @@ typedef union {
*((T)+1)=(((A) >> 16));\
*((T)+0)=(((A) >> 24)); }
-#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double))
-#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong))
+#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
+#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
+#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
+#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
#else
diff --git a/include/my_handler.h b/include/my_handler.h
index 618d1df1a6e..18a6234d3f6 100644
--- a/include/my_handler.h
+++ b/include/my_handler.h
@@ -58,7 +58,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
}
extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
- my_bool);
+ my_bool, my_bool);
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag,
uint *diff_pos);
diff --git a/include/my_pthread.h b/include/my_pthread.h
index cf04d078c70..602a4439575 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -392,6 +392,11 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res);
#define pthread_condattr_destroy pthread_condattr_delete
#endif
+/* FSU THREADS */
+#if !defined(HAVE_PTHREAD_KEY_DELETE) && !defined(pthread_key_delete)
+#define pthread_key_delete(A) pthread_dummy(0)
+#endif
+
#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
#define pthread_cond_destroy(A) pthread_dummy(0)
#define pthread_mutex_destroy(A) pthread_dummy(0)
diff --git a/include/my_sys.h b/include/my_sys.h
index d24bef11182..f08ac6a1fef 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -202,26 +202,13 @@ 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;
/* charsets */
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
-extern uint get_charset_number(const char *cs_name, uint cs_flags);
-extern uint get_collation_number(const char *name);
-extern const char *get_charset_name(uint cs_number);
-
-extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
-extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
-extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
- uint cs_flags, myf my_flags);
-extern void free_charsets(void);
-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);
-
/* statistics */
extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests,
my_cache_read;
@@ -288,14 +275,16 @@ enum file_type
FILE_BY_MKSTEMP, FILE_BY_DUP
};
-extern struct my_file_info
+struct st_my_file_info
{
my_string name;
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_t mutex;
#endif
-} my_file_info[MY_NFILE];
+};
+
+extern struct st_my_file_info *my_file_info;
typedef struct st_my_tmpdir
{
@@ -423,6 +412,11 @@ typedef struct st_io_cache /* Used when cacheing files */
IO_CACHE_CALLBACK pre_read;
IO_CACHE_CALLBACK post_read;
IO_CACHE_CALLBACK pre_close;
+ /*
+ Counts the number of times, when we were forced to use disk. We use it to
+ increase the binlog_cache_disk_use status variable.
+ */
+ ulong disk_writes;
void* arg; /* for use by pre/post_read */
char *file_name; /* if used with 'open_cached_file' */
char *dir,*prefix;
@@ -618,7 +612,7 @@ extern void pack_dirname(my_string to,const char *from);
extern uint unpack_dirname(my_string to,const char *from);
extern uint cleanup_dirname(my_string to,const char *from);
extern uint system_filename(my_string to,const char *from);
-extern my_string unpack_filename(my_string to,const char *from);
+extern uint unpack_filename(my_string to,const char *from);
extern my_string intern_filename(my_string to,const char *from);
extern my_string directory_file_name(my_string dst, const char *src);
extern int pack_filename(my_string to, const char *name, size_s max_length);
@@ -675,9 +669,9 @@ extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
uint Count, my_off_t pos);
-extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
+extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
-#define flush_io_cache(info) _flush_io_cache((info),1)
+#define flush_io_cache(info) my_b_flush_io_cache((info),1)
extern int end_io_cache(IO_CACHE *info);
extern uint my_b_fill(IO_CACHE *info);
@@ -726,11 +720,14 @@ extern void my_free_lock(byte *ptr,myf flags);
#define my_free_lock(A,B) my_free((A),(B))
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
+#define clear_alloc_root(A) bzero((void *) (A), sizeof(MEM_ROOT))
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 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,
+ uint prealloc_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);
@@ -746,6 +743,26 @@ extern uint my_bit_log2(ulong value);
extern uint my_count_bits(ulonglong 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);
+void my_free_open_file_info(void);
+
+ulonglong my_getsystime(void);
+my_bool my_gethwaddr(uchar *to);
+
+/* character sets */
+extern uint get_charset_number(const char *cs_name, uint cs_flags);
+extern uint get_collation_number(const char *name);
+extern const char *get_charset_name(uint cs_number);
+
+extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
+extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
+extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
+ uint cs_flags, myf my_flags);
+extern void free_charsets(void);
+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);
#ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */
diff --git a/include/my_tree.h b/include/my_tree.h
index 0e705e19bba..14d8593b6dc 100644
--- a/include/my_tree.h
+++ b/include/my_tree.h
@@ -22,7 +22,9 @@ extern "C" {
#include "my_base.h" /* get 'enum ha_rkey_function' */
-#define MAX_TREE_HEIGHT 40 /* = max 1048576 leafs in tree */
+/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */
+#define MAX_TREE_HEIGHT 64
+
#define ELEMENT_KEY(tree,element)\
(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
*((void**) (element+1)))
diff --git a/include/myisam.h b/include/myisam.h
index 2285f996464..ed4f4aff8fe 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -38,7 +38,7 @@ extern "C" {
/* The following defines can be increased if necessary */
#define MI_MAX_KEY 32 /* Max allowed keys */
#define MI_MAX_KEY_SEG 16 /* Max segments for key */
-#define MI_MAX_KEY_LENGTH 500
+#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 */
@@ -93,7 +93,7 @@ typedef struct st_mi_isaminfo /* Struct from h_info */
typedef struct st_mi_create_info
{
- char *index_file_name, *data_file_name; /* If using symlinks */
+ const char *index_file_name, *data_file_name; /* If using symlinks */
ha_rows max_rows;
ha_rows reloc_rows;
ulonglong auto_increment;
diff --git a/include/mysql.h b/include/mysql.h
index cd5d01d6f44..852d633facf 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -77,6 +77,8 @@ extern char *mysql_unix_port;
#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)
+#define HAVE_DEPRECATED_411_API 1
+
typedef struct st_mysql_field {
char *name; /* Name of column */
char *org_name; /* Original column name, if an alias */
@@ -183,6 +185,12 @@ 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;
+
+ /* function pointers for local infile support */
+ int (*local_infile_init)(void **, const char *);
+ int (*local_infile_read)(void *, char *, unsigned int);
+ void (*local_infile_end)(void *);
+ int (*local_infile_error)(void *, char *, unsigned int);
};
enum mysql_status
@@ -254,6 +262,11 @@ typedef struct st_mysql
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
void *thd;
+ /*
+ Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag
+ from mysql_stmt_close if close had to cancel result set of this object.
+ */
+ my_bool *unbuffered_fetch_owner;
} MYSQL;
typedef struct st_mysql_res {
@@ -268,6 +281,8 @@ typedef struct st_mysql_res {
MYSQL_ROW row; /* If unbuffered read */
MYSQL_ROW current_row; /* buffer to current row */
my_bool eof; /* Used by mysql_fetch_row */
+ /* mysql_stmt_close() had to cancel this result */
+ my_bool unbuffered_fetch_cancelled;
const struct st_mysql_methods *methods;
} MYSQL_RES;
@@ -375,6 +390,23 @@ my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
+/* local infile support */
+
+#define LOCAL_INFILE_ERROR_LEN 512
+
+void
+mysql_set_local_infile_handler(MYSQL *mysql,
+ int (*local_infile_init)(void **, const char *),
+ int (*local_infile_read)(void *, char *,
+ unsigned int),
+ void (*local_infile_end)(void *),
+ int (*local_infile_error)(void *, char*,
+ unsigned int));
+
+void
+mysql_set_local_infile_default(MYSQL *mysql);
+
+
/*
enable/disable parsing of all queries to decide if they go on master or
slave
@@ -477,7 +509,11 @@ my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
*/
/* statement state */
-enum PREP_STMT_STATE { MY_ST_UNKNOWN, MY_ST_PREPARE, MY_ST_EXECUTE };
+enum enum_mysql_stmt_state
+{
+ MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
+ MYSQL_STMT_FETCH_DONE
+};
/*
client TIME structure to handle TIME, DATE and TIMESTAMP directly in
@@ -523,31 +559,36 @@ typedef struct st_mysql_bind
/* statement handler */
typedef struct st_mysql_stmt
{
- MYSQL *mysql; /* connection handle */
- MYSQL_BIND *params; /* input parameters */
- MYSQL_RES *result; /* resultset */
- MYSQL_BIND *bind; /* row binding */
- MYSQL_FIELD *fields; /* prepare meta info */
+ MEM_ROOT mem_root; /* root allocations */
LIST list; /* list to keep track of all stmts */
- unsigned char *current_row; /* unbuffered row */
- unsigned char *last_fetched_buffer; /* last fetched column buffer */
- char *query; /* query buffer */
- MEM_ROOT mem_root; /* root allocations */
- my_ulonglong last_fetched_column; /* last fetched column */
- my_ulonglong affected_rows; /* copy of mysql->affected_rows
- after statement execution */
+ MYSQL *mysql; /* connection handle */
+ MYSQL_BIND *params; /* input parameters */
+ MYSQL_BIND *bind; /* output parameters */
+ MYSQL_FIELD *fields; /* result set metadata */
+ MYSQL_DATA result; /* cached result set */
+ MYSQL_ROWS *data_cursor; /* current row in cached result */
+ /* copy of mysql->affected_rows after statement execution */
+ my_ulonglong affected_rows;
+ my_ulonglong insert_id; /* copy of mysql->insert_id */
+ /*
+ mysql_stmt_fetch() calls this function to fetch one row (it's different
+ for buffered, unbuffered and cursor fetch).
+ */
+ int (*read_row_func)(struct st_mysql_stmt *stmt,
+ unsigned char **row);
unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */
- unsigned int param_count; /* parameters count */
- unsigned int field_count; /* fields count */
- enum PREP_STMT_STATE state; /* statement state */
+ unsigned int param_count; /* inpute parameters count */
+ unsigned int field_count; /* number of columns in result set */
+ enum enum_mysql_stmt_state state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */
char sqlstate[SQLSTATE_LENGTH+1];
- my_bool long_alloced; /* flag to indicate long alloced */
- my_bool send_types_to_server; /* Types sent to server */
- my_bool param_buffers; /* param bound buffers */
- my_bool res_buffers; /* output bound buffers */
- my_bool result_buffered; /* Results buffered */
+ /* 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 */
+ /* mysql_stmt_close() had to cancel this result */
+ my_bool unbuffered_fetch_cancelled;
} MYSQL_STMT;
@@ -570,48 +611,70 @@ typedef struct st_mysql_methods
MYSQL_FIELD * (*list_fields)(MYSQL *mysql);
my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (*stmt_execute)(MYSQL_STMT *stmt);
- MYSQL_DATA *(*read_binary_rows)(MYSQL_STMT *stmt);
+ int (*read_binary_rows)(MYSQL_STMT *stmt);
int (*unbuffered_fetch)(MYSQL *mysql, char **row);
void (*free_embedded_thd)(MYSQL *mysql);
- const char *(*read_statistic)(MYSQL *mysql);
- int (*next_result)(MYSQL *mysql);
+ const char *(*read_statistics)(MYSQL *mysql);
+ my_bool (*next_result)(MYSQL *mysql);
+ int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
#endif
} MYSQL_METHODS;
+#ifdef HAVE_DEPRECATED_411_API
+/* Deprecated calls (since MySQL 4.1.2) */
+
+/* Use mysql_stmt_init + mysql_stmt_prepare instead */
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
unsigned long length);
-int STDCALL mysql_execute(MYSQL_STMT * stmt);
-unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt);
-my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
-my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
+#define mysql_execute mysql_stmt_execute
+#define mysql_fetch mysql_stmt_fetch
+#define mysql_fetch_column mysql_stmt_fetch_column
+#define mysql_bind_param mysql_stmt_bind_param
+#define mysql_bind_result mysql_stmt_bind_result
+#define mysql_param_count mysql_stmt_param_count
+#define mysql_param_result mysql_stmt_param_metadata
+#define mysql_get_metadata mysql_stmt_result_metadata
+#define mysql_send_long_data mysql_stmt_send_long_data
+
+#endif /* HAVE_DEPRECATED_411_API */
+
+MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
+int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
+ unsigned long length);
+int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
+int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
+int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
+ unsigned int column,
+ unsigned long offset);
+int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
+unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt);
+my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
+my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
+my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
+ unsigned int param_number,
+ const char *data,
+ unsigned long length);
+MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
+MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);
-my_bool STDCALL mysql_commit(MYSQL * mysql);
-my_bool STDCALL mysql_rollback(MYSQL * mysql);
-my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
-int STDCALL mysql_fetch(MYSQL_STMT *stmt);
-int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
- unsigned int column,
- unsigned long offset);
-my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
- unsigned int param_number,
- const char *data,
- unsigned long length);
-MYSQL_RES *STDCALL mysql_get_metadata(MYSQL_STMT *stmt);
-MYSQL_RES *STDCALL mysql_param_result(MYSQL_STMT *stmt);
-my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
-int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
-my_bool STDCALL mysql_more_results(MYSQL *mysql);
-int STDCALL mysql_next_result(MYSQL *mysql);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt,
MYSQL_ROW_OFFSET offset);
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt);
void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
+my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
+my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
+
+my_bool STDCALL mysql_commit(MYSQL * mysql);
+my_bool STDCALL mysql_rollback(MYSQL * mysql);
+my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
+my_bool STDCALL mysql_more_results(MYSQL *mysql);
+int STDCALL mysql_next_result(MYSQL *mysql);
void STDCALL mysql_close(MYSQL *sock);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index cc2e1056a9e..7de4c782989 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -78,6 +78,7 @@ enum enum_server_command
#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
#define GROUP_FLAG 32768 /* Intern: Group field */
#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
+#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
@@ -118,7 +119,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
-#define CLIENT_REMEMBER_OPTIONS ((ulong) (1L << 31))
+#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
diff --git a/include/mysql_version.h.in b/include/mysql_version.h.in
index 095531d527d..c440c1298d4 100644
--- a/include/mysql_version.h.in
+++ b/include/mysql_version.h.in
@@ -23,4 +23,9 @@
/* mysqld compile time options */
#endif /* _CUSTOMCONFIG_ */
+
+#ifndef LICENSE
+#define LICENSE "GPL"
+#endif /* LICENSE */
+
#endif /* _mysql_version_h */
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index b4d7edf3e96..2f2b8d9b6fb 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -254,93 +254,98 @@
#define ER_NOT_SUPPORTED_YET 1235
#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
#define ER_SLAVE_IGNORED_TABLE 1237
-#define ER_WRONG_FK_DEF 1238
-#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1239
-#define ER_OPERAND_COLUMNS 1240
-#define ER_SUBQUERY_NO_1_ROW 1241
-#define ER_UNKNOWN_STMT_HANDLER 1242
-#define ER_CORRUPT_HELP_DB 1243
-#define ER_CYCLIC_REFERENCE 1244
-#define ER_AUTO_CONVERT 1245
-#define ER_ILLEGAL_REFERENCE 1246
-#define ER_DERIVED_MUST_HAVE_ALIAS 1247
-#define ER_SELECT_REDUCED 1248
-#define ER_TABLENAME_NOT_ALLOWED_HERE 1249
-#define ER_NOT_SUPPORTED_AUTH_MODE 1250
-#define ER_SPATIAL_CANT_HAVE_NULL 1251
-#define ER_COLLATION_CHARSET_MISMATCH 1252
-#define ER_SLAVE_WAS_RUNNING 1253
-#define ER_SLAVE_WAS_NOT_RUNNING 1254
-#define ER_TOO_BIG_FOR_UNCOMPRESS 1255
-#define ER_ZLIB_Z_MEM_ERROR 1256
-#define ER_ZLIB_Z_BUF_ERROR 1257
-#define ER_ZLIB_Z_DATA_ERROR 1258
-#define ER_CUT_VALUE_GROUP_CONCAT 1259
-#define ER_WARN_TOO_FEW_RECORDS 1260
-#define ER_WARN_TOO_MANY_RECORDS 1261
-#define ER_WARN_NULL_TO_NOTNULL 1262
-#define ER_WARN_DATA_OUT_OF_RANGE 1263
-#define ER_WARN_DATA_TRUNCATED 1264
-#define ER_WARN_USING_OTHER_HANDLER 1265
-#define ER_CANT_AGGREGATE_2COLLATIONS 1266
-#define ER_DROP_USER 1267
-#define ER_REVOKE_GRANTS 1268
-#define ER_CANT_AGGREGATE_3COLLATIONS 1269
-#define ER_CANT_AGGREGATE_NCOLLATIONS 1270
-#define ER_VARIABLE_IS_NOT_STRUCT 1271
-#define ER_UNKNOWN_COLLATION 1272
-#define ER_SLAVE_IGNORED_SSL_PARAMS 1273
-#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1274
-#define ER_WARN_FIELD_RESOLVED 1275
-#define ER_BAD_SLAVE_UNTIL_COND 1276
-#define ER_MISSING_SKIP_SLAVE 1277
-#define ER_UNTIL_COND_IGNORED 1278
-#define ER_WRONG_NAME_FOR_INDEX 1279
-#define ER_WRONG_NAME_FOR_CATALOG 1280
-#define ER_WARN_QC_RESIZE 1281
-#define ER_BAD_FT_COLUMN 1282
-#define ER_UNKNOWN_KEY_CACHE 1283
-#define ER_WARN_HOSTNAME_WONT_WORK 1284
-#define ER_UNKNOWN_STORAGE_ENGINE 1285
-#define ER_WARN_DEPRECATED_SYNTAX 1286
-#define ER_NON_UPDATABLE_TABLE 1287
-#define ER_FEATURE_DISABLED 1288
-#define ER_SKIP_GRANT_TABLES 1289
-#define ER_SP_NO_RECURSIVE_CREATE 1290
-#define ER_SP_ALREADY_EXISTS 1291
-#define ER_SP_DOES_NOT_EXIST 1292
-#define ER_SP_DROP_FAILED 1293
-#define ER_SP_STORE_FAILED 1294
-#define ER_SP_LILABEL_MISMATCH 1295
-#define ER_SP_LABEL_REDEFINE 1296
-#define ER_SP_LABEL_MISMATCH 1297
-#define ER_SP_UNINIT_VAR 1298
-#define ER_SP_BADSELECT 1299
-#define ER_SP_BADRETURN 1300
-#define ER_SP_BADSTATEMENT 1301
-#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1302
-#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1303
-#define ER_QUERY_INTERRUPTED 1304
-#define ER_SP_WRONG_NO_OF_ARGS 1305
-#define ER_SP_COND_MISMATCH 1306
-#define ER_SP_NORETURN 1307
-#define ER_SP_NORETURNEND 1308
-#define ER_SP_BAD_CURSOR_QUERY 1309
-#define ER_SP_BAD_CURSOR_SELECT 1310
-#define ER_SP_CURSOR_MISMATCH 1311
-#define ER_SP_CURSOR_ALREADY_OPEN 1312
-#define ER_SP_CURSOR_NOT_OPEN 1313
-#define ER_SP_UNDECLARED_VAR 1314
-#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1315
-#define ER_SP_FETCH_NO_DATA 1316
-#define ER_SP_DUP_PARAM 1317
-#define ER_SP_DUP_VAR 1318
-#define ER_SP_DUP_COND 1319
-#define ER_SP_DUP_CURS 1320
-#define ER_SP_CANT_ALTER 1321
-#define ER_SP_SUBSELECT_NYI 1322
-#define ER_SP_NO_USE 1323
-#define ER_SP_VARCOND_AFTER_CURSHNDLR 1324
-#define ER_SP_CURSOR_AFTER_HANDLER 1325
-#define ER_SP_CASE_NOT_FOUND 1326
-#define ER_ERROR_MESSAGES 327
+#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_SP_NO_RECURSIVE_CREATE 1294
+#define ER_SP_ALREADY_EXISTS 1295
+#define ER_SP_DOES_NOT_EXIST 1296
+#define ER_SP_DROP_FAILED 1297
+#define ER_SP_STORE_FAILED 1298
+#define ER_SP_LILABEL_MISMATCH 1299
+#define ER_SP_LABEL_REDEFINE 1300
+#define ER_SP_LABEL_MISMATCH 1301
+#define ER_SP_UNINIT_VAR 1302
+#define ER_SP_BADSELECT 1303
+#define ER_SP_BADRETURN 1304
+#define ER_SP_BADSTATEMENT 1305
+#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1306
+#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1307
+#define ER_QUERY_INTERRUPTED 1308
+#define ER_SP_WRONG_NO_OF_ARGS 1309
+#define ER_SP_COND_MISMATCH 1310
+#define ER_SP_NORETURN 1311
+#define ER_SP_NORETURNEND 1312
+#define ER_SP_BAD_CURSOR_QUERY 1313
+#define ER_SP_BAD_CURSOR_SELECT 1314
+#define ER_SP_CURSOR_MISMATCH 1315
+#define ER_SP_CURSOR_ALREADY_OPEN 1316
+#define ER_SP_CURSOR_NOT_OPEN 1317
+#define ER_SP_UNDECLARED_VAR 1318
+#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1319
+#define ER_SP_FETCH_NO_DATA 1320
+#define ER_SP_DUP_PARAM 1321
+#define ER_SP_DUP_VAR 1322
+#define ER_SP_DUP_COND 1323
+#define ER_SP_DUP_CURS 1324
+#define ER_SP_CANT_ALTER 1325
+#define ER_SP_SUBSELECT_NYI 1326
+#define ER_SP_NO_USE 1327
+#define ER_SP_VARCOND_AFTER_CURSHNDLR 1328
+#define ER_SP_CURSOR_AFTER_HANDLER 1329
+#define ER_SP_CASE_NOT_FOUND 1330
+#define ER_ERROR_MESSAGES 331
diff --git a/include/sql_common.h b/include/sql_common.h
index fef573f7450..3f50008a922 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -25,6 +25,7 @@ extern "C" {
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
+void flush_use_result(MYSQL *mysql);
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);
@@ -38,6 +39,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
const char *sqlstate);
+void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate);
#ifdef __cplusplus
}
#endif