summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am6
-rw-r--r--include/config-win.h3
-rw-r--r--include/decimal.h94
-rw-r--r--include/errmsg.h7
-rw-r--r--include/m_ctype.h8
-rw-r--r--include/my_base.h53
-rw-r--r--include/my_bitmap.h2
-rw-r--r--include/my_dbug.h4
-rw-r--r--include/my_global.h12
-rw-r--r--include/my_handler.h34
-rw-r--r--include/my_net.h5
-rw-r--r--include/my_pthread.h35
-rw-r--r--include/my_sys.h73
-rw-r--r--include/my_time.h17
-rw-r--r--include/myisam.h3
-rw-r--r--include/mysql.h104
-rw-r--r--include/mysql_com.h40
-rw-r--r--include/mysqld_error.h322
-rw-r--r--include/mysys_err.h10
-rw-r--r--include/queues.h1
-rw-r--r--include/sql_state.h164
21 files changed, 463 insertions, 534 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 0c845900a4f..e11ca2b4647 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -17,12 +17,12 @@
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\
myisam.h myisampack.h myisammrg.h ft_global.h\
@@ -30,7 +30,7 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.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
+ mysql_version.h.in my_handler.h my_time.h decimal.h
# mysql_version.h are generated
SUPERCLEANFILES = mysql_version.h my_config.h
diff --git a/include/config-win.h b/include/config-win.h
index 946a91d7d42..1d54a4bf9ec 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -303,6 +303,9 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_SETFILEPOINTER
#define HAVE_VIO
+#define HAME_MMAP /* in mysys/my_mmap.c */
+#define HAVE_GETPAGESIZE /* in mysys/my_mmap.c */
+
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf
diff --git a/include/decimal.h b/include/decimal.h
new file mode 100644
index 00000000000..4d1fbfddc01
--- /dev/null
+++ b/include/decimal.h
@@ -0,0 +1,94 @@
+/* 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;
+
+typedef struct st_decimal {
+ int intg, frac, len;
+ my_bool sign;
+ decimal_digit *buf;
+} decimal;
+
+int decimal2string(decimal *from, char *to, int *to_len);
+int string2decimal(char *from, decimal *to, char **end);
+int string2decimal_fixed(char *from, decimal *to, char **end);
+int decimal2ulonglong(decimal *from, ulonglong *to);
+int ulonglong2decimal(ulonglong from, decimal *to);
+int decimal2longlong(decimal *from, longlong *to);
+int longlong2decimal(longlong from, decimal *to);
+int decimal2double(decimal *from, double *to);
+int double2decimal(double from, decimal *to);
+int decimal2bin(decimal *from, char *to, int precision, int scale);
+int bin2decimal(char *from, decimal *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 *from1, decimal *from2, char op, int param);
+
+int decimal_add(decimal *from1, decimal *from2, decimal *to);
+int decimal_sub(decimal *from1, decimal *from2, decimal *to);
+int decimal_cmp(decimal *from1, decimal *from2);
+int decimal_mul(decimal *from1, decimal *from2, decimal *to);
+int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr);
+int decimal_mod(decimal *from1, decimal *from2, decimal *to);
+int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode);
+int decimal_is_zero(decimal *from);
+
+/* set a decimal 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)->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..ae3b04b4f3a 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,6 @@ 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_ERROR_LAST /*Copy last error nr:*/ 2052
+/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
+
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 26e285b9683..50673b6d494 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -85,7 +85,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,7 +106,8 @@ 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);
my_bool (*like_range)(struct charset_info_st *,
@@ -259,7 +260,8 @@ 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,
diff --git a/include/my_base.h b/include/my_base.h
index 7290d0da09b..1713a07f6ec 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
@@ -256,6 +273,9 @@ enum ha_base_keytype {
/* 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 +312,9 @@ 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_LAST 158 /*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 */
@@ -340,6 +363,7 @@ enum ha_base_keytype {
#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
#define HA_STATE_EXTEND_BLOCK 2048
+#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */
enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
@@ -353,6 +377,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;
@@ -360,6 +393,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
@@ -379,4 +420,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..fb1c3c69563 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -46,6 +46,8 @@ 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 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);
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 711ece4335c..cf32102b34b 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);
@@ -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 ff59f7bfc55..e8f93ee5d7a 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -661,6 +661,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
@@ -676,6 +677,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.
diff --git a/include/my_handler.h b/include/my_handler.h
index 18a6234d3f6..cad15d5471f 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,28 @@ 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_ofs)) - 1)) | \
+ ((bits) << (bit_ofs)); \
+ if ((bit_ofs) + (bit_len) > 8) \
+ (bit_ptr)[1]= ((bits) & ((1 << (bit_len)) - 1)) >> (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 cd0cf49a891..b483b68d5cb 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -674,21 +674,42 @@ 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_dec_and_test(V, L) atomic_dec_and_test((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)))
+#if defined (__GNUC__) || defined (__cplusplus)
+static inline bool thread_safe_dec_and_test(ulong V, pthread_mutex_t *L)
+{
+ ulong res;
+ pthread_mutex_lock(L);
+ res=V--;
+ pthread_mutex_unlock(L);
+ return res==0;
+}
+#else
+/*
+ what should we do ? define it as static ?
+ a regular function somewhere in mysys/ ?
+ for now it's only used in c++ code, so there's no need to bother
+*/
+#endif
#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 a8e21ea2f98..cbcd6f0f833 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)
@@ -121,6 +119,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 +136,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;
@@ -157,8 +163,19 @@ extern char *my_strdup_with_length(const byte *from, uint length,
#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
@@ -194,7 +211,6 @@ void __CDECL hfree(void *ptr);
#else
extern int errno; /* declare errno */
#endif
-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) */
@@ -204,6 +220,11 @@ 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];
@@ -499,12 +520,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 */
@@ -581,6 +607,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);
@@ -652,6 +680,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);
@@ -696,7 +726,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*);
@@ -740,6 +771,9 @@ 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 int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
+extern int process_default_option_files(const char *conf_file,
+ Process_option_func func,
+ void *func_ctx);
extern void free_defaults(char **argv);
extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(byte *, ulong *, ulong *);
@@ -748,6 +782,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);
@@ -756,6 +791,32 @@ void my_free_open_file_info(void);
ulonglong my_getsystime(void);
my_bool my_gethwaddr(uchar *to);
+#ifdef HAVE_MMAP
+#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)
+#define my_getpagesize() getpagesize()
+#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_NOSYNC 0x800
+#define MAP_FAILED ((void *)-1)
+#define MS_SYNC 0x0000
+
+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);
@@ -773,6 +834,10 @@ extern void add_compiled_collation(CHARSET_INFO *cs);
extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to,
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 */
#endif
diff --git a/include/my_time.h b/include/my_time.h
index 94701e159c4..8058df8fe4e 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -41,17 +41,30 @@ 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,
+ my_bool fuzzy_date, 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);
long calc_daynr(uint year,uint month,uint day);
+uint calc_days_in_year(uint year);
void init_time(void);
diff --git a/include/myisam.h b/include/myisam.h
index 6d097770646..fd75af2d997 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -107,12 +107,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 */
diff --git a/include/mysql.h b/include/mysql.h
index 2c0197e2300..58c314207c1 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -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
};
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 *);
@@ -537,26 +540,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;
@@ -583,6 +651,12 @@ 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 */
+ /*
+ 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 */
@@ -592,7 +666,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;
/*
@@ -611,7 +685,12 @@ 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
};
@@ -693,7 +772,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 6a6136bd974..59b2ee743ec 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,
@@ -44,7 +49,7 @@ enum enum_server_command
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_RESET_STMT, COM_SET_OPTION, COM_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,12 +136,25 @@ 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 client request and open read-only
+ non-scrollable cursor for the query. This flag comes in server
+ status with reply to COM_EXECUTE and COM_EXECUTE_DIRECT commands.
+*/
+#define SERVER_STATUS_CURSOR_EXISTS 64
+/*
+ This flag is sent with last row of read-only cursor, in reply to
+ COM_FETCH command.
+*/
+#define SERVER_STATUS_LAST_ROW_SENT 128
#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;
@@ -166,7 +185,8 @@ 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 */
/*
Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet
@@ -189,7 +209,8 @@ 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_ENUM=247,
MYSQL_TYPE_SET=248,
MYSQL_TYPE_TINY_BLOB=249,
@@ -230,6 +251,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 */
@@ -264,6 +286,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
{
@@ -318,6 +350,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 */
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 230be5f4720..1fd7c2eddc6 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -20,13 +20,15 @@
extern "C" {
#endif
-#define GLOB 0 /* Error maps */
-#define GLOBERRS 28 /* 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 */
+/* Do not add error numbers before EE_ERROR_FIRST. */
+/* If necessary to add lower numbers, change EE_ERROR_FIRST accordingly. */
+#define EE_ERROR_FIRST 0 /*Copy first error nr.*/
#define EE_FILENOTFOUND 0
#define EE_CANTCREATEFILE 1
#define EE_READ 2
@@ -54,6 +56,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
#define EE_SYNC 27
+#define EE_ERROR_LAST 27 /*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/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", "",