diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 17 | ||||
-rw-r--r-- | include/config-netware.h | 1 | ||||
-rw-r--r-- | include/config-win.h | 9 | ||||
-rw-r--r-- | include/decimal.h | 107 | ||||
-rw-r--r-- | include/errmsg.h | 9 | ||||
-rw-r--r-- | include/m_ctype.h | 21 | ||||
-rw-r--r-- | include/merge.h | 93 | ||||
-rw-r--r-- | include/my_base.h | 54 | ||||
-rw-r--r-- | include/my_bitmap.h | 4 | ||||
-rw-r--r-- | include/my_dbug.h | 10 | ||||
-rw-r--r-- | include/my_global.h | 59 | ||||
-rw-r--r-- | include/my_handler.h | 35 | ||||
-rw-r--r-- | include/my_net.h | 5 | ||||
-rw-r--r-- | include/my_pthread.h | 18 | ||||
-rw-r--r-- | include/my_sys.h | 100 | ||||
-rw-r--r-- | include/my_time.h | 17 | ||||
-rw-r--r-- | include/myisam.h | 13 | ||||
-rw-r--r-- | include/mysql.h | 112 | ||||
-rw-r--r-- | include/mysql_com.h | 53 | ||||
-rw-r--r-- | include/mysql_embed.h | 1 | ||||
-rw-r--r-- | include/mysqld_error.h | 322 | ||||
-rw-r--r-- | include/mysys_err.h | 17 | ||||
-rw-r--r-- | include/nisam.h | 212 | ||||
-rw-r--r-- | include/queues.h | 1 | ||||
-rw-r--r-- | include/sql_state.h | 164 | ||||
-rw-r--r-- | include/thr_lock.h | 4 | ||||
-rw-r--r-- | include/violite.h | 21 |
27 files changed, 588 insertions, 891 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 0c845900a4f..5f426843950 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -17,31 +17,26 @@ BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \ - mysql.h mysql_com.h mysqld_error.h mysql_embed.h \ + mysql.h mysql_com.h mysql_embed.h \ my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ errmsg.h my_global.h my_net.h my_alloc.h \ my_getopt.h sslopt-longopts.h my_dir.h typelib.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ - sql_state.h mysql_time.h $(BUILT_SOURCES) + mysql_time.h $(BUILT_SOURCES) noinst_HEADERS = config-win.h config-os2.h config-netware.h \ - nisam.h heap.h merge.h my_bitmap.h\ + heap.h my_bitmap.h\ myisam.h myisampack.h myisammrg.h ft_global.h\ mysys_err.h my_base.h help_start.h help_end.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_aes.h my_tree.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h md5.h \ - mysql_version.h.in my_handler.h my_time.h + mysql_version.h.in my_handler.h my_time.h decimal.h # mysql_version.h are generated -SUPERCLEANFILES = mysql_version.h my_config.h +CLEANFILES = mysql_version.h my_config.h readline # Some include files that may be moved and patched by configure -DISTCLEANFILES = sched.h $(SUPERCLEANFILES) - -clean: - $(RM) -fr readline -distclean: - $(RM) -fr readline +DISTCLEANFILES = sched.h $(CLEANFILES) all-local: my_config.h diff --git a/include/config-netware.h b/include/config-netware.h index c48aff70f3b..4a6dc3b1bb9 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -45,6 +45,7 @@ extern "C" { #undef HAVE_SCHED_H #undef HAVE_SYS_MMAN_H #undef HAVE_SYNCH_H +#undef HAVE_MMAP #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 #define HAVE_PTHREAD_SIGMASK 1 #define HAVE_PTHREAD_YIELD_ZERO_ARG 1 diff --git a/include/config-win.h b/include/config-win.h index b3865c1fda7..a4f81a0ec6a 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -321,7 +321,7 @@ inline double ulonglong2double(ulonglong value) #define HAVE_QUERY_CACHE #define SPRINTF_RETURNS_INT #define HAVE_SETFILEPOINTER -#define HAVE_VIO +#define HAVE_VIO_READ_BUFF #ifdef NOT_USED #define HAVE_SNPRINTF /* Gave link error */ @@ -349,6 +349,9 @@ inline double ulonglong2double(ulonglong value) #define SHAREDIR "share" #define DEFAULT_CHARSET_HOME "C:/mysql/" #endif +#ifndef DEFAULT_HOME_ENV +#define DEFAULT_HOME_ENV MYSQL_HOME +#endif /* File name handling */ @@ -360,6 +363,7 @@ inline double ulonglong2double(ulonglong value) #define DO_NOT_REMOVE_THREAD_WRAPPERS #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) +#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) /* The following is only used for statistics, so it should be good enough */ #ifdef __NT__ /* This should also work on Win98 but .. */ #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) @@ -373,6 +377,7 @@ inline double ulonglong2double(ulonglong value) #define statistic_add(V,C,L) (V)+=(C) #endif #define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) #define shared_memory_buffer_length 16000 #define default_shared_memory_base_name "MYSQL" @@ -386,6 +391,7 @@ inline double ulonglong2double(ulonglong value) /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ #define HAVE_CHARSET_big5 1 +#define HAVE_CHARSET_cp932 #define HAVE_CHARSET_cp1250 1 /* #undef HAVE_CHARSET_cp1251 */ /* #undef HAVE_CHARSET_cp1256 */ @@ -394,6 +400,7 @@ inline double ulonglong2double(ulonglong value) /* #undef HAVE_CHARSET_cp852 */ /* #undef HAVE_CHARSET_cp866 */ /* #undef HAVE_CHARSET_dec8 */ +#define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gbk 1 diff --git a/include/decimal.h b/include/decimal.h new file mode 100644 index 00000000000..2648e04c1cf --- /dev/null +++ b/include/decimal.h @@ -0,0 +1,107 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _decimal_h +#define _decimal_h + +typedef enum +{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} + decimal_round_mode; +typedef int32 decimal_digit_t; + +typedef struct st_decimal_t { + int intg, frac, len; + my_bool sign; + decimal_digit_t *buf; +} decimal_t; + +int internal_str2dec(const char *from, decimal_t *to, char **end, + my_bool fixed); +int decimal2string(decimal_t *from, char *to, int *to_len, + int fixed_precision, int fixed_decimals, + char filler); +int decimal2ulonglong(decimal_t *from, ulonglong *to); +int ulonglong2decimal(ulonglong from, decimal_t *to); +int decimal2longlong(decimal_t *from, longlong *to); +int longlong2decimal(longlong from, decimal_t *to); +int decimal2double(decimal_t *from, double *to); +int double2decimal(double from, decimal_t *to); +int decimal_actual_fraction(decimal_t *from); +int decimal2bin(decimal_t *from, char *to, int precision, int scale); +int bin2decimal(char *from, decimal_t *to, int precision, int scale); + +int decimal_size(int precision, int scale); +int decimal_bin_size(int precision, int scale); +int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, + int param); + +int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_cmp(decimal_t *from1, decimal_t *from2); +int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to, + int scale_incr); +int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_round(decimal_t *from, decimal_t *to, int new_scale, + decimal_round_mode mode); +int decimal_is_zero(decimal_t *from); +void max_decimal(int precision, int frac, decimal_t *to); + +#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0) +#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1) + +/* set a decimal_t to zero */ + +#define decimal_make_zero(dec) do { \ + (dec)->buf[0]=0; \ + (dec)->intg=1; \ + (dec)->frac=0; \ + (dec)->sign=0; \ + } while(0) + +/* + returns the length of the buffer to hold string representation + of the decimal (including decimal dot, possible sign and \0) +*/ + +#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ + (dec)->frac + ((dec)->frac > 0) + 2) + +/* negate a decimal */ +#define decimal_neg(dec) do { (dec)->sign^=1; } while(0) + +/* + conventions: + + decimal_smth() == 0 -- everything's ok + decimal_smth() <= 1 -- result is usable, but precision loss is possible + decimal_smth() <= 2 -- result can be unusable, most significant digits + could've been lost + decimal_smth() > 2 -- no result was generated +*/ + +#define E_DEC_OK 0 +#define E_DEC_TRUNCATED 1 +#define E_DEC_OVERFLOW 2 +#define E_DEC_DIV_ZERO 4 +#define E_DEC_BAD_NUM 8 +#define E_DEC_OOM 16 + +#define E_DEC_ERROR 31 +#define E_DEC_FATAL_ERROR 30 + +#endif + diff --git a/include/errmsg.h b/include/errmsg.h index 96977227666..1dd5759c104 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -21,6 +21,7 @@ extern "C" { #endif void init_client_errs(void); +void finish_client_errs(void); extern const char *client_errors[]; /* Error messages */ #ifdef __cplusplus } @@ -35,6 +36,9 @@ extern const char *client_errors[]; /* Error messages */ #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ +/* Do not add error numbers before CR_ERROR_FIRST. */ +/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */ +#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/ #define CR_UNKNOWN_ERROR 2000 #define CR_SOCKET_CREATE_ERROR 2001 #define CR_CONNECTION_ERROR 2002 @@ -91,3 +95,8 @@ extern const char *client_errors[]; /* Error messages */ #define CR_FETCH_CANCELED 2050 #define CR_NO_DATA 2051 #define CR_NO_STMT_METADATA 2052 +#define CR_NO_RESULT_SET 2053 +#define CR_NOT_IMPLEMENTED 2054 +#define CR_ERROR_LAST /*Copy last error nr:*/ 2054 +/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ + diff --git a/include/m_ctype.h b/include/m_ctype.h index ab63a1e0db1..6f304f4ba43 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,9 +106,11 @@ typedef struct my_collation_handler_st int (*strnncoll)(struct charset_info_st *, const uchar *, uint, const uchar *, uint, my_bool); int (*strnncollsp)(struct charset_info_st *, - const uchar *, uint, const uchar *, uint); + const uchar *, uint, const uchar *, uint, + my_bool diff_if_only_endspace_difference); int (*strnxfrm)(struct charset_info_st *, uchar *, uint, const uchar *, uint); + uint (*strnxfrmlen)(struct charset_info_st *, uint); my_bool (*like_range)(struct charset_info_st *, const char *s, uint s_length, pchar w_prefix, pchar w_one, pchar w_many, @@ -130,6 +132,7 @@ typedef struct my_collation_handler_st /* Hash calculation */ void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2); + my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len); } MY_COLLATION_HANDLER; extern MY_COLLATION_HANDLER my_collation_mb_bin_handler; @@ -185,7 +188,7 @@ typedef struct my_charset_handler_st int base, char **e, int *err); double (*strntod)(struct charset_info_st *, char *s, uint l, char **e, int *err); - longlong (*my_strtoll10)(struct charset_info_st *cs, + longlong (*strtoll10)(struct charset_info_st *cs, const char *nptr, char **endptr, int *error); ulong (*scan)(struct charset_info_st *, const char *b, const char *e, int sq); @@ -232,6 +235,8 @@ extern CHARSET_INFO my_charset_big5_chinese_ci; extern CHARSET_INFO my_charset_big5_bin; extern CHARSET_INFO my_charset_cp932_japanese_ci; extern CHARSET_INFO my_charset_cp932_bin; +extern CHARSET_INFO my_charset_eucjpms_japanese_ci; +extern CHARSET_INFO my_charset_eucjpms_bin; extern CHARSET_INFO my_charset_euckr_korean_ci; extern CHARSET_INFO my_charset_euckr_bin; extern CHARSET_INFO my_charset_gb2312_chinese_ci; @@ -257,12 +262,14 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci; /* declarations for simple charsets */ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, - uint); + uint); +uint my_strnxfrmlen_simple(CHARSET_INFO *, uint); extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, const uchar *, uint, my_bool); extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint, - const uchar *, uint); + const uchar *, uint, + my_bool diff_if_only_endspace_difference); extern void my_hash_sort_simple(CHARSET_INFO *cs, const uchar *key, uint len, @@ -379,6 +386,10 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, extern my_bool my_parse_charset_xml(const char *bug, uint len, int (*add)(CHARSET_INFO *cs)); +my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len); +my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len); + + #define _MY_U 01 /* Upper case */ #define _MY_L 02 /* Lower case */ #define _MY_NMR 04 /* Numeral (digit) */ diff --git a/include/merge.h b/include/merge.h deleted file mode 100644 index 97cea5fabb1..00000000000 --- a/include/merge.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* This file should be included when using merge_isam_funktions */ -/* Author: Michael Widenius */ - -#ifndef _merge_h -#define _merge_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _my_base_h -#include <my_base.h> -#endif -#ifndef _nisam_h -#include <nisam.h> -#endif - -#define MRG_NAME_EXT ".MRG" - - /* Param to/from mrg_info */ - -typedef struct st_mrg_info /* Struct from h_info */ -{ - ulonglong records; /* Records in database */ - ulonglong deleted; /* Deleted records in database */ - ulonglong recpos; /* Pos for last used record */ - ulonglong data_file_length; - uint reclength; /* Recordlength */ - int errkey; /* With key was dupplicated on err */ - uint options; /* HA_OPTION_... used */ -} MERGE_INFO; - -typedef struct st_mrg_table_info -{ - N_INFO *table; - ulonglong file_offset; -} MRG_TABLE; - -typedef struct st_merge -{ - MRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; - ulonglong records; /* records in tables */ - ulonglong del; /* Removed records */ - ulonglong data_file_length; - uint tables,options,reclength; - my_bool cache_in_use; - LIST open_list; -} MRG_INFO; - -typedef ulong mrg_off_t; - - /* Prototypes for merge-functions */ - -extern int mrg_close(MRG_INFO *file); -extern int mrg_delete(MRG_INFO *file,const byte *buff); -extern MRG_INFO *mrg_open(const char *name,int mode,int wait_if_locked); -extern int mrg_panic(enum ha_panic_function function); -extern int mrg_rfirst(MRG_INFO *file,byte *buf,int inx); -extern int mrg_rkey(MRG_INFO *file,byte *buf,int inx,const byte *key, - uint key_len, enum ha_rkey_function search_flag); -extern int mrg_rrnd(MRG_INFO *file,byte *buf, mrg_off_t pos); -extern int mrg_rsame(MRG_INFO *file,byte *record,int inx); -extern int mrg_update(MRG_INFO *file,const byte *old,const byte *new_rec); -extern int mrg_info(MRG_INFO *file,MERGE_INFO *x,int flag); -extern int mrg_lock_database(MRG_INFO *file,int lock_type); -extern int mrg_create(const char *name,const char **table_names); -extern int mrg_extra(MRG_INFO *file,enum ha_extra_function function); -extern ha_rows mrg_records_in_range(MRG_INFO *info,int inx, - const byte *start_key,uint start_key_len, - enum ha_rkey_function start_search_flag, - const byte *end_key,uint end_key_len, - enum ha_rkey_function end_search_flag); - -extern mrg_off_t mrg_position(MRG_INFO *info); -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/my_base.h b/include/my_base.h index d702ec45140..25fa683744e 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,11 @@ enum ha_base_keytype { #define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ #define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */ +#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ + +#define HA_ERR_LAST 159 /*Copy last error nr.*/ +/* Add error numbers before HA_ERR_LAST and change it accordingly. */ +#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) /* Other constants */ @@ -354,6 +379,15 @@ enum data_file_type { /* For key ranges */ +#define NO_MIN_RANGE 1 +#define NO_MAX_RANGE 2 +#define NEAR_MIN 4 +#define NEAR_MAX 8 +#define UNIQUE_RANGE 16 +#define EQ_RANGE 32 +#define NULL_RANGE 64 +#define GEOM_FLAG 128 + typedef struct st_key_range { const byte *key; @@ -361,6 +395,14 @@ typedef struct st_key_range enum ha_rkey_function flag; } key_range; +typedef struct st_key_multi_range +{ + key_range start_key; + key_range end_key; + char *ptr; /* Free to use by caller (ptr to row etc) */ + uint range_flag; /* key range flags see above */ +} KEY_MULTI_RANGE; + /* For number of records */ #ifdef BIG_TABLES @@ -380,4 +422,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..4caa3b85456 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -24,7 +24,7 @@ typedef struct st_bitmap { uchar *bitmap; - uint bitmap_size; + uint bitmap_size; /* number of bytes occupied by the above */ /* mutex will be acquired for the duration of each bitmap operation if thread_safe flag in bitmap_init was set. Otherwise, we optimize by not @@ -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..b76a3fcc8c9 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -25,6 +25,7 @@ extern int _db_on_,_no_db_; extern FILE *_db_fp_; extern char *_db_process_; extern int _db_keyword_(const char *keyword); +extern int _db_strict_keyword_(const char *keyword); extern void _db_setjmp_(void); extern void _db_longjmp_(void); extern void _db_push_(const char *control); @@ -38,9 +39,9 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); -extern void _db_output_(); -extern void _db_lock_file(); -extern void _db_unlock_file(); +extern void _db_output_(uint flag); +extern void _db_lock_file(void); +extern void _db_unlock_file(void); #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ char **_db_framep_; \ @@ -69,12 +70,15 @@ extern void _db_unlock_file(); #define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_ASSERT(A) assert(A) +#define DBUG_EXECUTE_IF(keyword,a1) \ + {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}} #else /* No debugger */ #define DBUG_ENTER(a1) #define DBUG_RETURN(a1) return(a1) #define DBUG_VOID_RETURN return #define DBUG_EXECUTE(keyword,a1) {} +#define DBUG_EXECUTE_IF(keyword,a1) {} #define DBUG_PRINT(keyword,arglist) {} #define DBUG_PUSH(a1) {} #define DBUG_POP() {} diff --git a/include/my_global.h b/include/my_global.h index 62c6a5d1e4a..068832e927d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -126,6 +126,38 @@ #define __STDC_EXT__ 1 /* To get large file support on hpux */ #endif +/* + Solaris 9 include file <sys/feature_tests.h> refers to X/Open document + + System Interfaces and Headers, Issue 5 + + saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes, + but apparently other systems (namely FreeBSD) don't agree. + + On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600. + Furthermore, it tests that if a program requires older standard + (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be + run on a new compiler (that defines _STDC_C99) and issues an #error. + It's also an #error if a program requires new standard (_XOPEN_SOURCE=600 + or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99. + + To add more to this mess, Sun Studio C compiler defines _STDC_C99 while + C++ compiler does not! + + So, in a desperate attempt to get correct prototypes for both + C and C++ code, we define either _XOPEN_SOURCE=600 or _XOPEN_SOURCE=500 + depending on the compiler's announced C standard support. + + Cleaner solutions are welcome. +*/ +#ifdef __sun +#if __STDC_VERSION__ - 0 >= 199901L +#define _XOPEN_SOURCE 600 +#else +#define _XOPEN_SOURCE 500 +#endif +#endif + #if defined(THREAD) && !defined(__WIN__) && !defined(OS2) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ @@ -203,17 +235,6 @@ C_MODE_END #define __LONG_MAX__ 2147483647 #endif -/* Fix problem when linking c++ programs with gcc 3.x */ -#ifdef DEFINE_CXA_PURE_VIRTUAL -#define FIX_GCC_LINKING_PROBLEM \ -C_MODE_START int __cxa_pure_virtual() {\ - DBUG_ASSERT("Pure virtual method called." == "Aborted");\ - return 0;\ -} C_MODE_END -#else -#define FIX_GCC_LINKING_PROBLEM -#endif - /* egcs 1.1.2 has a problem with memcpy on Alpha */ #if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) #define BAD_MEMCPY @@ -264,7 +285,7 @@ C_MODE_START int __cxa_pure_virtual() {\ # endif #endif /* TIME_WITH_SYS_TIME */ #ifdef HAVE_UNISTD_H -#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) +#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) && !defined(__APPLE__) #define crypt unistd_crypt #endif #include <unistd.h> @@ -676,6 +697,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 @@ -691,6 +713,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. @@ -754,7 +787,7 @@ typedef long int32; #endif typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */ #else -error "Neither int or long is of 4 bytes width" +#error "Neither int or long is of 4 bytes width" #endif #if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC) diff --git a/include/my_handler.h b/include/my_handler.h index 18a6234d3f6..c076ba0c2c9 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -25,15 +25,17 @@ typedef struct st_HA_KEYSEG /* Key-portion */ { + CHARSET_INFO *charset; + uint32 start; /* Start of key in record */ + uint32 null_pos; /* position to NULL indicator */ + uint16 bit_pos; /* Position to bit part */ + uint16 flag; + uint16 length; /* Keylength */ uint8 type; /* Type of key (for sort) */ uint8 language; uint8 null_bit; /* bitmask to test for NULL */ uint8 bit_start,bit_end; /* if bit field */ - uint16 flag; - uint16 length; /* Keylength */ - uint32 start; /* Start of key in record */ - uint32 null_pos; /* position to NULL indicator */ - CHARSET_INFO *charset; + uint8 bit_length; /* Length of bit part */ } HA_KEYSEG; #define get_key_length(length,key) \ @@ -57,6 +59,29 @@ typedef struct st_HA_KEYSEG /* Key-portion */ { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \ } +#define store_key_length_inc(key,length) \ +{ if ((length) < 255) \ + { *(key)++=(length); } \ + else \ + { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \ +} + +#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \ + (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \ + ((1 << (bit_len)) - 1)) + +#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \ +{ \ + (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \ + ((bits) << (bit_ofs)); \ + if ((bit_ofs) + (bit_len) > 8) \ + (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \ + ((bits) >> (8 - (bit_ofs))); \ +} + +#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \ + set_rec_bits(0, bit_ptr, bit_ofs, bit_len) + extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , my_bool, my_bool); extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, diff --git a/include/my_net.h b/include/my_net.h index 7b42afa1f3a..71914964e46 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -72,6 +72,11 @@ C_MODE_START #define in_addr_t uint32 #endif +/* On some operating systems (e.g. Solaris) INADDR_NONE is not defined */ +#ifndef INADDR_NONE +#define INADDR_NONE -1 /* Error value from inet_addr */ +#endif + /* Thread safe or portable version of some functions */ void my_inet_ntoa(struct in_addr in, char *buf); diff --git a/include/my_pthread.h b/include/my_pthread.h index fde62655c5f..47a38d1a642 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -676,21 +676,25 @@ extern pthread_t shutdown_th, main_th, signal_th; #ifndef thread_safe_increment #ifdef HAVE_ATOMIC_ADD -#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V); -#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V); -#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V); +#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V) +#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V) +#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V) +#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V) #else #define thread_safe_increment(V,L) \ - pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L)); -#define thread_safe_add(V,C,L) \ - pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); + (pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L))) +#define thread_safe_decrement(V,L) \ + (pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L))) +#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L))) #define thread_safe_sub(V,C,L) \ - pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); + (pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L))) #endif /* HAVE_ATOMIC_ADD */ #ifdef SAFE_STATISTICS #define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) #define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) #else +#define statistic_decrement(V,L) (V)-- #define statistic_increment(V,L) (V)++ #define statistic_add(V,C,L) (V)+=(C) #endif /* SAFE_STATISTICS */ diff --git a/include/my_sys.h b/include/my_sys.h index a0a008056ae..10358470c77 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -43,8 +43,6 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} #define MY_INIT(name); { my_progname= name; my_init(); } -#define MAXMAPS (4) /* Number of error message maps */ -#define ERRMOD (1000) /* Max number of errors in a map */ #define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ #define NRERRBUFFS (2) /* Buffers for parameters */ #define MY_FILE_ERROR ((uint) ~0) @@ -56,11 +54,10 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_FAE 8 /* Fatal if any error */ #define MY_WME 16 /* Write message on error */ #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ -#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */ -#define MY_FULL_IO 512 /* For my_read - loop intil I/O - is complete - */ -#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ +#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ +#define MY_RAID 64 /* Support for RAID */ +#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ +#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ #define MY_COPYTIME 64 /* my_redel() copys time */ #define MY_DELETE_OLD 256 /* my_create_with_symlink() */ @@ -74,7 +71,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ -#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ +#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ @@ -121,6 +118,13 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_ERRNO_EDOM 33 #define MY_ERRNO_ERANGE 34 + /* Bits for get_date timeflag */ +#define GETDATE_DATE_TIME 1 +#define GETDATE_SHORT_DATE 2 +#define GETDATE_HHMMSSTIME 4 +#define GETDATE_GMT 8 +#define GETDATE_FIXEDLENGTH 16 + /* defines when allocating data */ #ifdef SAFEMALLOC #define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) @@ -131,6 +135,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) #define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) #define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C) +#define TRASH(A,B) bfill(A, B, 0x8F) #define QUICK_SAFEMALLOC sf_malloc_quick=1 #define NORMAL_SAFEMALLOC sf_malloc_quick=0 extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; @@ -157,8 +162,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 @@ -200,7 +216,6 @@ void __CDECL hfree(void *ptr); extern int errno; /* declare errno */ #endif #endif /* #ifndef errno */ -extern const char ** NEAR my_errmsg[]; extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; extern char *home_dir; /* Home directory for user */ extern char *my_progname; /* program-name (printed in errors) */ @@ -210,6 +225,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]; @@ -244,6 +264,8 @@ extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; extern char *defaults_extra_file; +extern my_bool timed_mutexes; + typedef struct wild_file_pack /* Struct to hold info when selecting files */ { uint wilds; /* How many wildcards */ @@ -505,12 +527,17 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); /* tell write offset in the SEQ_APPEND cache */ my_off_t my_b_append_tell(IO_CACHE* info); +my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ #define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \ *(info)->current_pos) typedef uint32 ha_checksum; +/* Define the type of function to be passed to process_default_option_files */ +typedef int (*Process_option_func)(void *ctx, const char *group_name, + const char *option); + #include <my_alloc.h> /* Prototypes for mysys and my_func functions */ @@ -592,6 +619,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); @@ -664,6 +693,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); @@ -709,7 +740,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*); @@ -755,7 +787,14 @@ extern void get_defaults_files(int argc, char **argv, char **defaults, char **extra_defaults); extern int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); +extern int modify_defaults_file(const char *file_location, const char *option, + const char *option_value, + const char *section_name, int remove_option); +extern int my_search_option_files(const char *conf_file, int *argc, + char ***argv, uint *args_used, + Process_option_func func, void *func_ctx); extern void free_defaults(char **argv); +extern void my_print_default_files(const char *conf_file); extern void print_defaults(const char *conf_file, const char **groups); extern my_bool my_compress(byte *, ulong *, ulong *); extern my_bool my_uncompress(byte *, ulong *, ulong *); @@ -763,6 +802,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); @@ -771,6 +811,39 @@ void my_free_open_file_info(void); ulonglong my_getsystime(void); my_bool my_gethwaddr(uchar *to); +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> + +#ifndef MAP_NOSYNC +#define MAP_NOSYNC 0 +#endif + +#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +#ifdef HAVE_GETPAGESIZE +#define my_getpagesize() getpagesize() +#else +/* qnx ? */ +#define my_getpagesize() 8192 +#endif +#define my_munmap(a,b) munmap((a),(b)) + +#else +/* not a complete set of mmap() flags, but only those that nesessary */ +#define PROT_READ 1 +#define PROT_WRITE 2 +#define MAP_SHARED 0x0001 +#define MAP_NOSYNC 0x0800 +#define MAP_FAILED ((void *)-1) +#define MS_SYNC 0x0000 +#define HAVE_MMAP + +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); @@ -785,9 +858,14 @@ extern char *get_charsets_dir(char *buf); extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2); extern my_bool init_compiled_charsets(myf flags); extern void add_compiled_collation(CHARSET_INFO *cs); -extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, +extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, + char *to, ulong to_length, const char *from, ulong length); +extern void thd_increment_bytes_sent(ulong length); +extern void thd_increment_bytes_received(ulong length); +extern void thd_increment_net_big_packet_count(ulong length); + #ifdef __WIN__ extern my_bool have_tcpip; /* Is set if tcpip is used */ diff --git a/include/my_time.h b/include/my_time.h index 94701e159c4..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..7d3f0e0c801 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 */ @@ -189,10 +190,10 @@ typedef struct st_columndef /* column information */ typedef void (* invalidator_by_filename)(const char * filename); extern my_string myisam_log_filename; /* Name of logfile */ -extern uint myisam_block_size; +extern ulong myisam_block_size; +extern ulong myisam_concurrent_insert; extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user; -extern my_bool myisam_concurrent_insert; -extern my_off_t myisam_max_temp_length,myisam_max_extra_temp_length; +extern my_off_t myisam_max_temp_length; extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size; /* Prototypes for myisam-functions */ @@ -339,8 +340,8 @@ typedef struct st_mi_check_param ha_checksum key_crc[MI_MAX_POSSIBLE_KEY]; ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY]; void *thd; - char *db_name,*table_name; - char *op_name; + const char *db_name, *table_name; + const char *op_name; } MI_CHECK; typedef struct st_sort_ft_buf diff --git a/include/mysql.h b/include/mysql.h index ab61fe694d9..b2b2e239758 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 *); @@ -228,7 +231,7 @@ typedef struct st_mysql MEM_ROOT field_alloc; my_ulonglong affected_rows; my_ulonglong insert_id; /* id if insert on table with NEXTNR */ - my_ulonglong extra_info; /* Used by mysqlshow */ + my_ulonglong extra_info; /* Not used */ unsigned long thread_id; /* Id for connection in server */ unsigned long packet_length; unsigned int port; @@ -549,26 +552,91 @@ enum enum_mysql_stmt_state }; -/* bind structure */ +/* + This structure is used to define bind information, and + internally by the client library. + Public members with their descriptions are listed below + (conventionally `On input' refers to the binds given to + mysql_stmt_bind_param, `On output' refers to the binds given + to mysql_stmt_bind_result): + + buffer_type - One of the MYSQL_* types, used to describe + the host language type of buffer. + On output: if column type is different from + buffer_type, column value is automatically converted + to buffer_type before it is stored in the buffer. + buffer - On input: points to the buffer with input data. + On output: points to the buffer capable to store + output data. + The type of memory pointed by buffer must correspond + to buffer_type. See the correspondence table in + the comment to mysql_stmt_bind_param. + + The two above members are mandatory for any kind of bind. + + buffer_length - the length of the buffer. You don't have to set + it for any fixed length buffer: float, double, + int, etc. It must be set however for variable-length + types, such as BLOBs or STRINGs. + + length - On input: in case when lengths of input values + are different for each execute, you can set this to + point at a variable containining value length. This + way the value length can be different in each execute. + If length is not NULL, buffer_length is not used. + Note, length can even point at buffer_length if + you keep bind structures around while fetching: + this way you can change buffer_length before + each execution, everything will work ok. + On output: if length is set, mysql_stmt_fetch will + write column length into it. + + is_null - On input: points to a boolean variable that should + be set to TRUE for NULL values. + This member is useful only if your data may be + NULL in some but not all cases. + If your data is never NULL, is_null should be set to 0. + If your data is always NULL, set buffer_type + to MYSQL_TYPE_NULL, and is_null will not be used. + + is_unsigned - On input: used to signify that values provided for one + of numeric types are unsigned. + On output describes signedness of the output buffer. + If, taking into account is_unsigned flag, column data + is out of range of the output buffer, data for this column + is regarded truncated. Note that this has no correspondence + to the sign of result set column, if you need to find it out + use mysql_stmt_result_metadata. + error - where to write a truncation error if it is present. + possible error value is: + 0 no truncation + 1 value is out of range or buffer is too small + + Please note that MYSQL_BIND also has internals members. +*/ + typedef struct st_mysql_bind { unsigned long *length; /* output length pointer */ my_bool *is_null; /* Pointer to null indicator */ void *buffer; /* buffer to get/put data */ + /* set this if you want to track data truncations happened during fetch */ + my_bool *error; enum enum_field_types buffer_type; /* buffer type */ - unsigned long buffer_length; /* buffer length, must be set for str/binary */ - - /* Following are for internal use. Set by mysql_stmt_bind_param */ - unsigned char *inter_buffer; /* for the current data position */ + /* output buffer length, must be set when fetching str/binary */ + unsigned long buffer_length; + unsigned char *row_ptr; /* for the current data position */ unsigned long offset; /* offset position for char/binary fetch */ - unsigned long internal_length; /* Used if length is 0 */ + unsigned long length_value; /* Used if length is 0 */ unsigned int param_number; /* For null count and error messages */ unsigned int pack_length; /* Internal length for packed data */ + my_bool error_value; /* used if error is 0 */ my_bool is_unsigned; /* set if integer type is unsigned */ my_bool long_data_used; /* If used with mysql_send_long_data */ - my_bool internal_is_null; /* Used if is_null is 0 */ + my_bool is_null_value; /* Used if is_null is 0 */ void (*store_param_func)(NET *net, struct st_mysql_bind *param); - void (*fetch_result)(struct st_mysql_bind *, unsigned char **row); + void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, + unsigned char **row); void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char **row); } MYSQL_BIND; @@ -595,6 +663,13 @@ typedef struct st_mysql_stmt int (*read_row_func)(struct st_mysql_stmt *stmt, unsigned char **row); unsigned long stmt_id; /* Id for prepared statement */ + unsigned long flags; /* i.e. type of cursor to open */ + unsigned long prefetch_rows; /* number of rows per one COM_FETCH */ + /* + Copied from mysql->server_status after execute/fetch to know + server-side cursor status for this statement. + */ + unsigned int server_status; unsigned int last_errno; /* error code */ unsigned int param_count; /* input parameter count */ unsigned int field_count; /* number of columns in result set */ @@ -604,7 +679,7 @@ typedef struct st_mysql_stmt /* Types of input parameters should be sent to server */ my_bool send_types_to_server; my_bool bind_param_done; /* input buffers were supplied */ - my_bool bind_result_done; /* output buffers were supplied */ + unsigned char bind_result_done; /* output buffers were supplied */ /* mysql_stmt_close() had to cancel this result */ my_bool unbuffered_fetch_cancelled; /* @@ -623,7 +698,17 @@ enum enum_stmt_attr_type In the new API we do that only by request because it slows down mysql_stmt_store_result sufficiently. */ - STMT_ATTR_UPDATE_MAX_LENGTH + STMT_ATTR_UPDATE_MAX_LENGTH, + /* + unsigned long with combination of cursor flags (read only, for update, + etc) + */ + STMT_ATTR_CURSOR_TYPE, + /* + Amount of rows to retrieve from server per one fetch if using cursors. + Accepts unsigned long attribute in the range 1 - ulong_max + */ + STMT_ATTR_PREFETCH_ROWS }; @@ -705,7 +790,8 @@ void STDCALL mysql_close(MYSQL *sock); /* status return codes */ -#define MYSQL_NO_DATA 100 +#define MYSQL_NO_DATA 100 +#define MYSQL_DATA_TRUNCATED 101 #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) diff --git a/include/mysql_com.h b/include/mysql_com.h index 56c7f7d2ab5..c608a2e7724 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,6 +136,17 @@ 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 SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ #define MYSQL_ERRMSG_SIZE 512 @@ -137,6 +154,8 @@ enum enum_server_command #define NET_WRITE_TIMEOUT 60 /* Timeout on write */ #define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ +#define ONLY_KILL_QUERY 1 + struct st_vio; /* Only C */ typedef struct st_vio Vio; @@ -167,7 +186,13 @@ typedef struct st_net { unsigned int *return_status; unsigned char reading_or_writing; char save_char; - my_bool no_send_ok; + my_bool no_send_ok; /* For SPs and other things that do multiple stmts */ + my_bool no_send_eof; /* For SPs' first version read-only cursors */ + /* + Set if OK packet is already sent, and we do not need to send error + messages + */ + my_bool no_send_error; /* Pointer to query object in query cache, do not equal NULL (0) for queries in cache that have not stored its results yet @@ -190,7 +215,9 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, + MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, + MYSQL_TYPE_BIT, + MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, @@ -206,6 +233,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, /* For backward compatibility */ #define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS #define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL +#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL #define FIELD_TYPE_TINY MYSQL_TYPE_TINY #define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT #define FIELD_TYPE_LONG MYSQL_TYPE_LONG @@ -231,6 +259,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, #define FIELD_TYPE_CHAR MYSQL_TYPE_TINY #define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM #define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY +#define FIELD_TYPE_BIT MYSQL_TYPE_BIT /* Shutdown/kill enums and constants */ @@ -265,6 +294,16 @@ enum mysql_enum_shutdown_level { KILL_CONNECTION= 255 }; + +enum enum_cursor_type +{ + CURSOR_TYPE_NO_CURSOR= 0, + CURSOR_TYPE_READ_ONLY= 1, + CURSOR_TYPE_FOR_UPDATE= 2, + CURSOR_TYPE_SCROLLABLE= 4 +}; + + /* options for mysql_set_option */ enum enum_mysql_set_option { @@ -310,7 +349,8 @@ struct rand_struct { /* The following is for user defined functions */ -enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT}; +enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, + DECIMAL_RESULT}; typedef struct st_udf_args { @@ -319,6 +359,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 */ @@ -375,6 +417,9 @@ const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); /* Some other useful functions */ my_bool my_init(void); +extern int modify_defaults_file(const char *file_location, const char *option, + const char *option_value, + const char *section_name, int remove_option); int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); my_bool my_thread_init(void); diff --git a/include/mysql_embed.h b/include/mysql_embed.h index 603af8e83b8..311d95eda73 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -24,7 +24,6 @@ #undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_OPENSSL -#undef HAVE_ISAM #undef HAVE_SMEM /* No shared memory */ #undef HAVE_NDBCLUSTER_DB /* No NDB cluster */ diff --git a/include/mysqld_error.h b/include/mysqld_error.h deleted file mode 100644 index 776869ff045..00000000000 --- a/include/mysqld_error.h +++ /dev/null @@ -1,322 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* Definefile for error messagenumbers */ - -#define ER_HASHCHK 1000 -#define ER_NISAMCHK 1001 -#define ER_NO 1002 -#define ER_YES 1003 -#define ER_CANT_CREATE_FILE 1004 -#define ER_CANT_CREATE_TABLE 1005 -#define ER_CANT_CREATE_DB 1006 -#define ER_DB_CREATE_EXISTS 1007 -#define ER_DB_DROP_EXISTS 1008 -#define ER_DB_DROP_DELETE 1009 -#define ER_DB_DROP_RMDIR 1010 -#define ER_CANT_DELETE_FILE 1011 -#define ER_CANT_FIND_SYSTEM_REC 1012 -#define ER_CANT_GET_STAT 1013 -#define ER_CANT_GET_WD 1014 -#define ER_CANT_LOCK 1015 -#define ER_CANT_OPEN_FILE 1016 -#define ER_FILE_NOT_FOUND 1017 -#define ER_CANT_READ_DIR 1018 -#define ER_CANT_SET_WD 1019 -#define ER_CHECKREAD 1020 -#define ER_DISK_FULL 1021 -#define ER_DUP_KEY 1022 -#define ER_ERROR_ON_CLOSE 1023 -#define ER_ERROR_ON_READ 1024 -#define ER_ERROR_ON_RENAME 1025 -#define ER_ERROR_ON_WRITE 1026 -#define ER_FILE_USED 1027 -#define ER_FILSORT_ABORT 1028 -#define ER_FORM_NOT_FOUND 1029 -#define ER_GET_ERRNO 1030 -#define ER_ILLEGAL_HA 1031 -#define ER_KEY_NOT_FOUND 1032 -#define ER_NOT_FORM_FILE 1033 -#define ER_NOT_KEYFILE 1034 -#define ER_OLD_KEYFILE 1035 -#define ER_OPEN_AS_READONLY 1036 -#define ER_OUTOFMEMORY 1037 -#define ER_OUT_OF_SORTMEMORY 1038 -#define ER_UNEXPECTED_EOF 1039 -#define ER_CON_COUNT_ERROR 1040 -#define ER_OUT_OF_RESOURCES 1041 -#define ER_BAD_HOST_ERROR 1042 -#define ER_HANDSHAKE_ERROR 1043 -#define ER_DBACCESS_DENIED_ERROR 1044 -#define ER_ACCESS_DENIED_ERROR 1045 -#define ER_NO_DB_ERROR 1046 -#define ER_UNKNOWN_COM_ERROR 1047 -#define ER_BAD_NULL_ERROR 1048 -#define ER_BAD_DB_ERROR 1049 -#define ER_TABLE_EXISTS_ERROR 1050 -#define ER_BAD_TABLE_ERROR 1051 -#define ER_NON_UNIQ_ERROR 1052 -#define ER_SERVER_SHUTDOWN 1053 -#define ER_BAD_FIELD_ERROR 1054 -#define ER_WRONG_FIELD_WITH_GROUP 1055 -#define ER_WRONG_GROUP_FIELD 1056 -#define ER_WRONG_SUM_SELECT 1057 -#define ER_WRONG_VALUE_COUNT 1058 -#define ER_TOO_LONG_IDENT 1059 -#define ER_DUP_FIELDNAME 1060 -#define ER_DUP_KEYNAME 1061 -#define ER_DUP_ENTRY 1062 -#define ER_WRONG_FIELD_SPEC 1063 -#define ER_PARSE_ERROR 1064 -#define ER_EMPTY_QUERY 1065 -#define ER_NONUNIQ_TABLE 1066 -#define ER_INVALID_DEFAULT 1067 -#define ER_MULTIPLE_PRI_KEY 1068 -#define ER_TOO_MANY_KEYS 1069 -#define ER_TOO_MANY_KEY_PARTS 1070 -#define ER_TOO_LONG_KEY 1071 -#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 -#define ER_BLOB_USED_AS_KEY 1073 -#define ER_TOO_BIG_FIELDLENGTH 1074 -#define ER_WRONG_AUTO_KEY 1075 -#define ER_READY 1076 -#define ER_NORMAL_SHUTDOWN 1077 -#define ER_GOT_SIGNAL 1078 -#define ER_SHUTDOWN_COMPLETE 1079 -#define ER_FORCING_CLOSE 1080 -#define ER_IPSOCK_ERROR 1081 -#define ER_NO_SUCH_INDEX 1082 -#define ER_WRONG_FIELD_TERMINATORS 1083 -#define ER_BLOBS_AND_NO_TERMINATED 1084 -#define ER_TEXTFILE_NOT_READABLE 1085 -#define ER_FILE_EXISTS_ERROR 1086 -#define ER_LOAD_INFO 1087 -#define ER_ALTER_INFO 1088 -#define ER_WRONG_SUB_KEY 1089 -#define ER_CANT_REMOVE_ALL_FIELDS 1090 -#define ER_CANT_DROP_FIELD_OR_KEY 1091 -#define ER_INSERT_INFO 1092 -#define ER_UPDATE_TABLE_USED 1093 -#define ER_NO_SUCH_THREAD 1094 -#define ER_KILL_DENIED_ERROR 1095 -#define ER_NO_TABLES_USED 1096 -#define ER_TOO_BIG_SET 1097 -#define ER_NO_UNIQUE_LOGFILE 1098 -#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 -#define ER_TABLE_NOT_LOCKED 1100 -#define ER_BLOB_CANT_HAVE_DEFAULT 1101 -#define ER_WRONG_DB_NAME 1102 -#define ER_WRONG_TABLE_NAME 1103 -#define ER_TOO_BIG_SELECT 1104 -#define ER_UNKNOWN_ERROR 1105 -#define ER_UNKNOWN_PROCEDURE 1106 -#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 -#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 -#define ER_UNKNOWN_TABLE 1109 -#define ER_FIELD_SPECIFIED_TWICE 1110 -#define ER_INVALID_GROUP_FUNC_USE 1111 -#define ER_UNSUPPORTED_EXTENSION 1112 -#define ER_TABLE_MUST_HAVE_COLUMNS 1113 -#define ER_RECORD_FILE_FULL 1114 -#define ER_UNKNOWN_CHARACTER_SET 1115 -#define ER_TOO_MANY_TABLES 1116 -#define ER_TOO_MANY_FIELDS 1117 -#define ER_TOO_BIG_ROWSIZE 1118 -#define ER_STACK_OVERRUN 1119 -#define ER_WRONG_OUTER_JOIN 1120 -#define ER_NULL_COLUMN_IN_INDEX 1121 -#define ER_CANT_FIND_UDF 1122 -#define ER_CANT_INITIALIZE_UDF 1123 -#define ER_UDF_NO_PATHS 1124 -#define ER_UDF_EXISTS 1125 -#define ER_CANT_OPEN_LIBRARY 1126 -#define ER_CANT_FIND_DL_ENTRY 1127 -#define ER_FUNCTION_NOT_DEFINED 1128 -#define ER_HOST_IS_BLOCKED 1129 -#define ER_HOST_NOT_PRIVILEGED 1130 -#define ER_PASSWORD_ANONYMOUS_USER 1131 -#define ER_PASSWORD_NOT_ALLOWED 1132 -#define ER_PASSWORD_NO_MATCH 1133 -#define ER_UPDATE_INFO 1134 -#define ER_CANT_CREATE_THREAD 1135 -#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 -#define ER_CANT_REOPEN_TABLE 1137 -#define ER_INVALID_USE_OF_NULL 1138 -#define ER_REGEXP_ERROR 1139 -#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 -#define ER_NONEXISTING_GRANT 1141 -#define ER_TABLEACCESS_DENIED_ERROR 1142 -#define ER_COLUMNACCESS_DENIED_ERROR 1143 -#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 -#define ER_GRANT_WRONG_HOST_OR_USER 1145 -#define ER_NO_SUCH_TABLE 1146 -#define ER_NONEXISTING_TABLE_GRANT 1147 -#define ER_NOT_ALLOWED_COMMAND 1148 -#define ER_SYNTAX_ERROR 1149 -#define ER_DELAYED_CANT_CHANGE_LOCK 1150 -#define ER_TOO_MANY_DELAYED_THREADS 1151 -#define ER_ABORTING_CONNECTION 1152 -#define ER_NET_PACKET_TOO_LARGE 1153 -#define ER_NET_READ_ERROR_FROM_PIPE 1154 -#define ER_NET_FCNTL_ERROR 1155 -#define ER_NET_PACKETS_OUT_OF_ORDER 1156 -#define ER_NET_UNCOMPRESS_ERROR 1157 -#define ER_NET_READ_ERROR 1158 -#define ER_NET_READ_INTERRUPTED 1159 -#define ER_NET_ERROR_ON_WRITE 1160 -#define ER_NET_WRITE_INTERRUPTED 1161 -#define ER_TOO_LONG_STRING 1162 -#define ER_TABLE_CANT_HANDLE_BLOB 1163 -#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 -#define ER_DELAYED_INSERT_TABLE_LOCKED 1165 -#define ER_WRONG_COLUMN_NAME 1166 -#define ER_WRONG_KEY_COLUMN 1167 -#define ER_WRONG_MRG_TABLE 1168 -#define ER_DUP_UNIQUE 1169 -#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 -#define ER_PRIMARY_CANT_HAVE_NULL 1171 -#define ER_TOO_MANY_ROWS 1172 -#define ER_REQUIRES_PRIMARY_KEY 1173 -#define ER_NO_RAID_COMPILED 1174 -#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 -#define ER_KEY_DOES_NOT_EXITS 1176 -#define ER_CHECK_NO_SUCH_TABLE 1177 -#define ER_CHECK_NOT_IMPLEMENTED 1178 -#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 -#define ER_ERROR_DURING_COMMIT 1180 -#define ER_ERROR_DURING_ROLLBACK 1181 -#define ER_ERROR_DURING_FLUSH_LOGS 1182 -#define ER_ERROR_DURING_CHECKPOINT 1183 -#define ER_NEW_ABORTING_CONNECTION 1184 -#define ER_DUMP_NOT_IMPLEMENTED 1185 -#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 -#define ER_INDEX_REBUILD 1187 -#define ER_MASTER 1188 -#define ER_MASTER_NET_READ 1189 -#define ER_MASTER_NET_WRITE 1190 -#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 -#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 -#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 -#define ER_CRASHED_ON_USAGE 1194 -#define ER_CRASHED_ON_REPAIR 1195 -#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 -#define ER_TRANS_CACHE_FULL 1197 -#define ER_SLAVE_MUST_STOP 1198 -#define ER_SLAVE_NOT_RUNNING 1199 -#define ER_BAD_SLAVE 1200 -#define ER_MASTER_INFO 1201 -#define ER_SLAVE_THREAD 1202 -#define ER_TOO_MANY_USER_CONNECTIONS 1203 -#define ER_SET_CONSTANTS_ONLY 1204 -#define ER_LOCK_WAIT_TIMEOUT 1205 -#define ER_LOCK_TABLE_FULL 1206 -#define ER_READ_ONLY_TRANSACTION 1207 -#define ER_DROP_DB_WITH_READ_LOCK 1208 -#define ER_CREATE_DB_WITH_READ_LOCK 1209 -#define ER_WRONG_ARGUMENTS 1210 -#define ER_NO_PERMISSION_TO_CREATE_USER 1211 -#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 -#define ER_LOCK_DEADLOCK 1213 -#define ER_TABLE_CANT_HANDLE_FT 1214 -#define ER_CANNOT_ADD_FOREIGN 1215 -#define ER_NO_REFERENCED_ROW 1216 -#define ER_ROW_IS_REFERENCED 1217 -#define ER_CONNECT_TO_MASTER 1218 -#define ER_QUERY_ON_MASTER 1219 -#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 -#define ER_WRONG_USAGE 1221 -#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 -#define ER_CANT_UPDATE_WITH_READLOCK 1223 -#define ER_MIXING_NOT_ALLOWED 1224 -#define ER_DUP_ARGUMENT 1225 -#define ER_USER_LIMIT_REACHED 1226 -#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 -#define ER_LOCAL_VARIABLE 1228 -#define ER_GLOBAL_VARIABLE 1229 -#define ER_NO_DEFAULT 1230 -#define ER_WRONG_VALUE_FOR_VAR 1231 -#define ER_WRONG_TYPE_FOR_VAR 1232 -#define ER_VAR_CANT_BE_READ 1233 -#define ER_CANT_USE_OPTION_HERE 1234 -#define ER_NOT_SUPPORTED_YET 1235 -#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 -#define ER_SLAVE_IGNORED_TABLE 1237 -#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 -#define ER_WRONG_FK_DEF 1239 -#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 -#define ER_OPERAND_COLUMNS 1241 -#define ER_SUBQUERY_NO_1_ROW 1242 -#define ER_UNKNOWN_STMT_HANDLER 1243 -#define ER_CORRUPT_HELP_DB 1244 -#define ER_CYCLIC_REFERENCE 1245 -#define ER_AUTO_CONVERT 1246 -#define ER_ILLEGAL_REFERENCE 1247 -#define ER_DERIVED_MUST_HAVE_ALIAS 1248 -#define ER_SELECT_REDUCED 1249 -#define ER_TABLENAME_NOT_ALLOWED_HERE 1250 -#define ER_NOT_SUPPORTED_AUTH_MODE 1251 -#define ER_SPATIAL_CANT_HAVE_NULL 1252 -#define ER_COLLATION_CHARSET_MISMATCH 1253 -#define ER_SLAVE_WAS_RUNNING 1254 -#define ER_SLAVE_WAS_NOT_RUNNING 1255 -#define ER_TOO_BIG_FOR_UNCOMPRESS 1256 -#define ER_ZLIB_Z_MEM_ERROR 1257 -#define ER_ZLIB_Z_BUF_ERROR 1258 -#define ER_ZLIB_Z_DATA_ERROR 1259 -#define ER_CUT_VALUE_GROUP_CONCAT 1260 -#define ER_WARN_TOO_FEW_RECORDS 1261 -#define ER_WARN_TOO_MANY_RECORDS 1262 -#define ER_WARN_NULL_TO_NOTNULL 1263 -#define ER_WARN_DATA_OUT_OF_RANGE 1264 -#define ER_WARN_DATA_TRUNCATED 1265 -#define ER_WARN_USING_OTHER_HANDLER 1266 -#define ER_CANT_AGGREGATE_2COLLATIONS 1267 -#define ER_DROP_USER 1268 -#define ER_REVOKE_GRANTS 1269 -#define ER_CANT_AGGREGATE_3COLLATIONS 1270 -#define ER_CANT_AGGREGATE_NCOLLATIONS 1271 -#define ER_VARIABLE_IS_NOT_STRUCT 1272 -#define ER_UNKNOWN_COLLATION 1273 -#define ER_SLAVE_IGNORED_SSL_PARAMS 1274 -#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 -#define ER_WARN_FIELD_RESOLVED 1276 -#define ER_BAD_SLAVE_UNTIL_COND 1277 -#define ER_MISSING_SKIP_SLAVE 1278 -#define ER_UNTIL_COND_IGNORED 1279 -#define ER_WRONG_NAME_FOR_INDEX 1280 -#define ER_WRONG_NAME_FOR_CATALOG 1281 -#define ER_WARN_QC_RESIZE 1282 -#define ER_BAD_FT_COLUMN 1283 -#define ER_UNKNOWN_KEY_CACHE 1284 -#define ER_WARN_HOSTNAME_WONT_WORK 1285 -#define ER_UNKNOWN_STORAGE_ENGINE 1286 -#define ER_WARN_DEPRECATED_SYNTAX 1287 -#define ER_NON_UPDATABLE_TABLE 1288 -#define ER_FEATURE_DISABLED 1289 -#define ER_OPTION_PREVENTS_STATEMENT 1290 -#define ER_DUPLICATED_VALUE_IN_TYPE 1291 -#define ER_TRUNCATED_WRONG_VALUE 1292 -#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 -#define ER_INVALID_ON_UPDATE 1294 -#define ER_UNSUPPORTED_PS 1295 -#define ER_GET_ERRMSG 1296 -#define ER_GET_TEMPORARY_ERRMSG 1297 -#define ER_UNKNOWN_TIME_ZONE 1298 -#define ER_WARN_INVALID_TIMESTAMP 1299 -#define ER_INVALID_CHARACTER_STRING 1300 -#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 -#define ER_CONFLICTING_DECLARATIONS 1302 -#define ER_ERROR_MESSAGES 303 diff --git a/include/mysys_err.h b/include/mysys_err.h index 19106dc3553..341e6950792 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -20,14 +20,20 @@ extern "C" { #endif -#define GLOB 0 /* Error maps */ -#define GLOBERRS 29 /* Max number of error messages in map's */ -#define EE(X) globerrs[ X ] /* Defines to add error to right map */ +#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ +#define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) extern const char * NEAR globerrs[]; /* my_error_messages is here */ /* Error message numbers in global map */ -#define EE_FILENOTFOUND 0 +/* + Do not add error numbers before EE_ERROR_FIRST. + If necessary to add lower numbers, change EE_ERROR_FIRST accordingly. + + We start with error 1 to not confuse peoples with 'error 0' +*/ + +#define EE_ERROR_FIRST 1 /*Copy first error nr.*/ #define EE_CANTCREATEFILE 1 #define EE_READ 2 #define EE_WRITE 3 @@ -55,6 +61,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_REALPATH 26 #define EE_SYNC 27 #define EE_UNKNOWN_COLLATION 28 +#define EE_FILENOTFOUND 29 +#define EE_ERROR_LAST 29 /*Copy last error nr.*/ +/* Add error numbers before EE_ERROR_LAST and change it accordingly. */ /* exit codes for all MySQL programs */ diff --git a/include/nisam.h b/include/nisam.h deleted file mode 100644 index e8f29991a4e..00000000000 --- a/include/nisam.h +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* This file should be included when using nisam_funktions */ -/* Author: Michael Widenius */ - -#ifndef _nisam_h -#define _nisam_h -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _my_base_h -#include <my_base.h> -#endif - /* defines used by nisam-funktions */ - -#define N_MAXKEY 16 /* Max allowed keys */ -#define N_MAXKEY_SEG 16 /* Max segments for key */ -#define N_MAX_KEY_LENGTH 256 /* May be increased up to 500 */ -#define N_MAX_KEY_BUFF (N_MAX_KEY_LENGTH+N_MAXKEY_SEG+sizeof(double)-1) -#define N_MAX_POSSIBLE_KEY_BUFF 500+9 - -#define N_NAME_IEXT ".ISM" -#define N_NAME_DEXT ".ISD" -#define NI_POS_ERROR (~ (ulong) 0) - - - /* Param to/from nisam_info */ - -typedef struct st_n_isaminfo /* Struct from h_info */ -{ - ulong records; /* Records in database */ - ulong deleted; /* Deleted records in database */ - ulong recpos; /* Pos for last used record */ - ulong newrecpos; /* Pos if we write new record */ - ulong dupp_key_pos; /* Position to record with dupp key */ - ulong data_file_length, /* Length of data file */ - max_data_file_length, - index_file_length, - max_index_file_length, - delete_length; - uint reclength; /* Recordlength */ - uint mean_reclength; /* Mean recordlength (if packed) */ - uint keys; /* How many keys used */ - uint options; /* HA_OPTION_... used */ - int errkey, /* With key was dupplicated on err */ - sortkey; /* clustered by this key */ - File filenr; /* (uniq) filenr for datafile */ - time_t create_time; /* When table was created */ - time_t isamchk_time; - time_t update_time; - ulong *rec_per_key; /* for sql optimizing */ -} N_ISAMINFO; - - - /* Info saved on file for each info-part */ - -#ifdef __WATCOMC__ -#pragma pack(2) -#define uint uint16 /* Same format as in MSDOS */ -#endif - -#ifdef __ZTC__ -#pragma ZTC align 2 -#define uint uint16 /* Same format as in MSDOS */ -#endif - -typedef struct st_n_save_keyseg /* Key-portion */ -{ - uint8 type; /* Typ av nyckel (f|r sort) */ - uint8 flag; /* HA_DIFF_LENGTH */ - uint16 start; /* Start of key in record */ - uint16 length; /* Keylength */ -} N_SAVE_KEYSEG; - -typedef struct st_n_save_keydef /* Key definition with create & info */ -{ - uint8 flag; /* NOSAME, PACK_USED */ - uint8 keysegs; /* Number of key-segment */ - uint16 block_length; /* Length of keyblock (auto) */ - uint16 keylength; /* Tot length of keyparts (auto) */ - uint16 minlength; /* min length of (packed) key (auto) */ - uint16 maxlength; /* max length of (packed) key (auto) */ -} N_SAVE_KEYDEF; - -typedef struct st_n_save_recinfo /* Info of record */ -{ - int16 type; /* en_fieldtype */ - uint16 length; /* length of field */ -} N_SAVE_RECINFO; - - -#ifdef __ZTC__ -#pragma ZTC align -#undef uint -#endif - -#ifdef __WATCOMC__ -#pragma pack() -#undef uint -#endif - - -struct st_isam_info; /* For referense */ - -#ifndef ISAM_LIBRARY -typedef struct st_isam_info N_INFO; -#endif - -typedef struct st_n_keyseg /* Key-portion */ -{ - N_SAVE_KEYSEG base; -} N_KEYSEG; - - -typedef struct st_n_keydef /* Key definition with open & info */ -{ - N_SAVE_KEYDEF base; - N_KEYSEG seg[N_MAXKEY_SEG+1]; - int (*bin_search)(struct st_isam_info *info,struct st_n_keydef *keyinfo, - uchar *page,uchar *key, - uint key_len,uint comp_flag,uchar * *ret_pos, - uchar *buff); - uint (*get_key)(struct st_n_keydef *keyinfo,uint nod_flag,uchar * *page, - uchar *key); -} N_KEYDEF; - - -typedef struct st_decode_tree /* Decode huff-table */ -{ - uint16 *table; - uint quick_table_bits; - byte *intervalls; -} DECODE_TREE; - - -struct st_bit_buff; - -typedef struct st_n_recinfo /* Info of record */ -{ - N_SAVE_RECINFO base; -#ifndef NOT_PACKED_DATABASES - void (*unpack)(struct st_n_recinfo *rec,struct st_bit_buff *buff, - uchar *start,uchar *end); - enum en_fieldtype base_type; - uint space_length_bits,pack_type; - DECODE_TREE *huff_tree; -#endif -} N_RECINFO; - - -extern my_string nisam_log_filename; /* Name of logfile */ -extern uint nisam_block_size; -extern my_bool nisam_flush; - - /* Prototypes for nisam-functions */ - -extern int nisam_close(struct st_isam_info *file); -extern int nisam_delete(struct st_isam_info *file,const byte *buff); -extern struct st_isam_info *nisam_open(const char *name,int mode, - uint wait_if_locked); -extern int nisam_panic(enum ha_panic_function function); -extern int nisam_rfirst(struct st_isam_info *file,byte *buf,int inx); -extern int nisam_rkey(struct st_isam_info *file,byte *buf,int inx, - const byte *key, - uint key_len, enum ha_rkey_function search_flag); -extern int nisam_rlast(struct st_isam_info *file,byte *buf,int inx); -extern int nisam_rnext(struct st_isam_info *file,byte *buf,int inx); -extern int nisam_rprev(struct st_isam_info *file,byte *buf,int inx); -extern int nisam_rrnd(struct st_isam_info *file,byte *buf,ulong pos); -extern int nisam_rsame(struct st_isam_info *file,byte *record,int inx); -extern int nisam_rsame_with_pos(struct st_isam_info *file,byte *record, - int inx,ulong pos); -extern int nisam_update(struct st_isam_info *file,const byte *old, - const byte *new_record); -extern int nisam_write(struct st_isam_info *file,const byte *buff); -extern int nisam_info(struct st_isam_info *file,N_ISAMINFO *x,int flag); -extern ulong nisam_position(struct st_isam_info *info); -extern int nisam_lock_database(struct st_isam_info *file,int lock_type); -extern int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, - N_RECINFO *recinfo,ulong records, - ulong reloc,uint flags,uint options, - ulong data_file_length); -extern int nisam_extra(struct st_isam_info *file, - enum ha_extra_function function); -extern ulong nisam_records_in_range(struct st_isam_info *info,int inx, - const byte *start_key,uint start_key_len, - enum ha_rkey_function start_search_flag, - const byte *end_key,uint end_key_len, - enum ha_rkey_function end_search_flag); -extern int nisam_log(int activate_log); -extern int nisam_is_changed(struct st_isam_info *info); -extern uint _calc_blob_length(uint length , const byte *pos); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/queues.h b/include/queues.h index ac15b09719b..02ab768198e 100644 --- a/include/queues.h +++ b/include/queues.h @@ -53,6 +53,7 @@ int resize_queue(QUEUE *queue, uint max_elements); void delete_queue(QUEUE *queue); void queue_insert(QUEUE *queue,byte *element); byte *queue_remove(QUEUE *queue,uint idx); +#define queue_remove_all(queue) { (queue)->elements= 0; } void _downheap(QUEUE *queue,uint idx); void queue_fix(QUEUE *queue); #define is_queue_inited(queue) ((queue)->root != 0) diff --git a/include/sql_state.h b/include/sql_state.h deleted file mode 100644 index 52a359405e1..00000000000 --- a/include/sql_state.h +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - This file includes a mapping from mysql_errno.h to sql_state (as used by - MyODBC) and jdbc_state. - It's suitable to include into a C struct for further processing - - The first column is the mysqld server error (declared in mysqld_error.h), - the second column is the ODBC state (which the 4.1 server sends out by - default) and the last is the state used by the JDBC driver. - If the last column is "" then it means that the JDBC driver is using the - ODBC state. - - The errors in this file are sorted in the same order as in mysqld_error.h - to allow one to do binary searches for the sqlstate. -*/ - -ER_DUP_KEY, "23000", "", -ER_OUTOFMEMORY, "HY001", "S1001", -ER_OUT_OF_SORTMEMORY, "HY001", "S1001", -ER_CON_COUNT_ERROR, "08004", "", -ER_BAD_HOST_ERROR, "08S01", "", -ER_HANDSHAKE_ERROR, "08S01", "", -ER_DBACCESS_DENIED_ERROR, "42000", "", -ER_ACCESS_DENIED_ERROR, "28000", "", -ER_NO_DB_ERROR, "3D000", "", -ER_UNKNOWN_COM_ERROR, "08S01", "", -ER_BAD_NULL_ERROR, "23000", "", -ER_BAD_DB_ERROR, "42000", "", -ER_TABLE_EXISTS_ERROR, "42S01", "", -ER_BAD_TABLE_ERROR, "42S02", "", -ER_NON_UNIQ_ERROR, "23000", "", -ER_SERVER_SHUTDOWN, "08S01", "", -ER_BAD_FIELD_ERROR, "42S22", "S0022", -ER_WRONG_FIELD_WITH_GROUP, "42000", "S1009", -ER_WRONG_GROUP_FIELD, "42000", "S1009", -ER_WRONG_SUM_SELECT, "42000", "S1009", -ER_WRONG_VALUE_COUNT, "21S01", "", -ER_TOO_LONG_IDENT, "42000", "S1009", -ER_DUP_FIELDNAME, "42S21", "S1009", -ER_DUP_KEYNAME, "42000", "S1009", -ER_DUP_ENTRY, "23000", "S1009", -ER_WRONG_FIELD_SPEC, "42000", "S1009", -ER_PARSE_ERROR, "42000", "", -ER_EMPTY_QUERY, "42000" , "", -ER_NONUNIQ_TABLE, "42000", "S1009", -ER_INVALID_DEFAULT, "42000", "S1009", -ER_MULTIPLE_PRI_KEY, "42000", "S1009", -ER_TOO_MANY_KEYS, "42000", "S1009", -ER_TOO_MANY_KEY_PARTS, "42000", "S1009", -ER_TOO_LONG_KEY, "42000", "S1009", -ER_KEY_COLUMN_DOES_NOT_EXITS, "42000", "S1009", -ER_BLOB_USED_AS_KEY, "42000", "S1009", -ER_TOO_BIG_FIELDLENGTH, "42000", "S1009", -ER_WRONG_AUTO_KEY, "42000", "S1009", -ER_FORCING_CLOSE, "08S01", "", -ER_IPSOCK_ERROR, "08S01", "", -ER_NO_SUCH_INDEX, "42S12", "S1009", -ER_WRONG_FIELD_TERMINATORS, "42000", "S1009", -ER_BLOBS_AND_NO_TERMINATED, "42000", "S1009", -ER_CANT_REMOVE_ALL_FIELDS, "42000", "", -ER_CANT_DROP_FIELD_OR_KEY, "42000", "", -ER_BLOB_CANT_HAVE_DEFAULT, "42000", "", -ER_WRONG_DB_NAME, "42000", "", -ER_WRONG_TABLE_NAME, "42000", "", -ER_TOO_BIG_SELECT, "42000", "", -ER_UNKNOWN_PROCEDURE, "42000", "", -ER_WRONG_PARAMCOUNT_TO_PROCEDURE, "42000", "", -ER_UNKNOWN_TABLE, "42S02", "", -ER_FIELD_SPECIFIED_TWICE, "42000", "", -ER_UNSUPPORTED_EXTENSION, "42000", "", -ER_TABLE_MUST_HAVE_COLUMNS, "42000", "", -ER_UNKNOWN_CHARACTER_SET, "42000", "", -ER_TOO_BIG_ROWSIZE, "42000", "", -ER_WRONG_OUTER_JOIN, "42000", "", -ER_NULL_COLUMN_IN_INDEX, "42000", "", -ER_PASSWORD_ANONYMOUS_USER, "42000", "", -ER_PASSWORD_NOT_ALLOWED, "42000", "", -ER_PASSWORD_NO_MATCH, "42000", "", -ER_WRONG_VALUE_COUNT_ON_ROW, "21S01", "", -ER_INVALID_USE_OF_NULL, "42000", "", -ER_REGEXP_ERROR, "42000", "", -ER_MIX_OF_GROUP_FUNC_AND_FIELDS,"42000", "", -ER_NONEXISTING_GRANT, "42000", "", -ER_TABLEACCESS_DENIED_ERROR, "42000", "", -ER_COLUMNACCESS_DENIED_ERROR, "42000", "", -ER_ILLEGAL_GRANT_FOR_TABLE, "42000", "", -ER_GRANT_WRONG_HOST_OR_USER, "42000", "", -ER_NO_SUCH_TABLE, "42S02", "", -ER_NONEXISTING_TABLE_GRANT, "42000", "", -ER_NOT_ALLOWED_COMMAND, "42000", "", -ER_SYNTAX_ERROR, "42000", "", -ER_ABORTING_CONNECTION, "08S01", "", -ER_NET_PACKET_TOO_LARGE, "08S01", "", -ER_NET_READ_ERROR_FROM_PIPE, "08S01", "", -ER_NET_FCNTL_ERROR, "08S01", "", -ER_NET_PACKETS_OUT_OF_ORDER, "08S01", "", -ER_NET_UNCOMPRESS_ERROR, "08S01", "", -ER_NET_READ_ERROR, "08S01", "", -ER_NET_READ_INTERRUPTED, "08S01", "", -ER_NET_ERROR_ON_WRITE, "08S01", "", -ER_NET_WRITE_INTERRUPTED, "08S01", "", -ER_TOO_LONG_STRING, "42000", "", -ER_TABLE_CANT_HANDLE_BLOB, "42000", "", -ER_TABLE_CANT_HANDLE_AUTO_INCREMENT, "42000", "", -ER_WRONG_COLUMN_NAME, "42000", "", -ER_WRONG_KEY_COLUMN, "42000", "", -ER_DUP_UNIQUE, "23000", "", -ER_BLOB_KEY_WITHOUT_LENGTH, "42000", "", -ER_PRIMARY_CANT_HAVE_NULL, "42000", "", -ER_TOO_MANY_ROWS, "42000", "", -ER_REQUIRES_PRIMARY_KEY, "42000", "", -ER_CHECK_NO_SUCH_TABLE, "42000", "", -ER_CHECK_NOT_IMPLEMENTED, "42000", "", -ER_CANT_DO_THIS_DURING_AN_TRANSACTION, "25000", "", -ER_NEW_ABORTING_CONNECTION, "08S01", "", -ER_MASTER_NET_READ, "08S01", "", -ER_MASTER_NET_WRITE, "08S01", "", -ER_TOO_MANY_USER_CONNECTIONS, "42000", "", -ER_READ_ONLY_TRANSACTION, "25000", "", -ER_NO_PERMISSION_TO_CREATE_USER,"42000", "", -ER_LOCK_DEADLOCK, "40001", "", -ER_NO_REFERENCED_ROW, "23000", "", -ER_ROW_IS_REFERENCED, "23000", "", -ER_CONNECT_TO_MASTER, "08S01", "", -ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,"21000", "", -ER_USER_LIMIT_REACHED, "42000", "", -ER_NO_DEFAULT, "42000", "", -ER_WRONG_VALUE_FOR_VAR, "42000", "", -ER_WRONG_TYPE_FOR_VAR, "42000", "", -ER_CANT_USE_OPTION_HERE, "42000", "", -ER_NOT_SUPPORTED_YET, "42000", "", -ER_WRONG_FK_DEF, "42000", "", -ER_OPERAND_COLUMNS, "21000", "", -ER_SUBQUERY_NO_1_ROW, "21000", "", -ER_ILLEGAL_REFERENCE, "42S22", "", -ER_DERIVED_MUST_HAVE_ALIAS, "42000", "", -ER_SELECT_REDUCED, "01000", "", -ER_TABLENAME_NOT_ALLOWED_HERE, "42000", "", -ER_NOT_SUPPORTED_AUTH_MODE, "08004", "", -ER_SPATIAL_CANT_HAVE_NULL, "42000", "", -ER_COLLATION_CHARSET_MISMATCH, "42000", "", -ER_WARN_TOO_FEW_RECORDS, "01000", "", -ER_WARN_TOO_MANY_RECORDS, "01000", "", -ER_WARN_NULL_TO_NOTNULL, "01000", "", -ER_WARN_DATA_OUT_OF_RANGE, "01000", "", -ER_WARN_DATA_TRUNCATED, "01000", "", -ER_WRONG_NAME_FOR_INDEX, "42000", "", -ER_WRONG_NAME_FOR_CATALOG, "42000", "", -ER_UNKNOWN_STORAGE_ENGINE, "42000", "", diff --git a/include/thr_lock.h b/include/thr_lock.h index 947b17bf2b6..dc4f9968cb7 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -88,10 +88,10 @@ typedef struct st_thr_lock { struct st_lock_list read; struct st_lock_list write_wait; struct st_lock_list write; -/* write_lock_count is incremented for write locks and reset on read locks */ + /* write_lock_count is incremented for write locks and reset on read locks */ ulong write_lock_count; uint read_no_write_count; - void (*get_status)(void*); /* When one gets a lock */ + void (*get_status)(void*, int); /* When one gets a lock */ void (*copy_status)(void*,void*); void (*update_status)(void*); /* Before release of write */ my_bool (*check_status)(void *); diff --git a/include/violite.h b/include/violite.h index 4b644051dd2..48046346f8c 100644 --- a/include/violite.h +++ b/include/violite.h @@ -37,7 +37,12 @@ enum enum_vio_type VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY }; -Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost); + +#define VIO_LOCALHOST 1 /* a localhost connection */ +#define VIO_BUFFERED_READ 2 /* use buffered read */ +#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */ + +Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); #ifdef __WIN__ Vio* vio_new_win32pipe(HANDLE hPipe); Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, @@ -57,8 +62,9 @@ int vio_close_pipe(Vio * vio); void vio_delete(Vio* vio); int vio_close(Vio* vio); void vio_reset(Vio* vio, enum enum_vio_type type, - my_socket sd, HANDLE hPipe, my_bool localhost); + my_socket sd, HANDLE hPipe, uint flags); int vio_read(Vio *vio, gptr buf, int size); +int vio_read_buff(Vio *vio, gptr buf, int size); int vio_write(Vio *vio, const gptr buf, int size); int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); my_bool vio_is_blocking(Vio *vio); @@ -93,6 +99,7 @@ void vio_timeout(Vio *vio,uint which, uint timeout); #endif #define HEADER_DES_LOCL_H dummy_something +#define YASSL_MYSQL_COMPATIBLE #include <openssl/ssl.h> #include <openssl/err.h> @@ -135,7 +142,7 @@ int vio_close_shared_memory(Vio * vio); } #endif -#if defined(HAVE_VIO) && !defined(DONT_MAP_VIO) +#if !defined(DONT_MAP_VIO) #define vio_delete(vio) (vio)->viodelete(vio) #define vio_errno(vio) (vio)->vioerrno(vio) #define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size) @@ -150,7 +157,7 @@ int vio_close_shared_memory(Vio * vio); #define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in) #define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds) -#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */ +#endif /* !defined(DONT_MAP_VIO) */ /* This enumerator is used in parser - should be always visible */ enum SSL_type @@ -175,7 +182,10 @@ struct st_vio struct sockaddr_in remote; /* Remote internet address */ enum enum_vio_type type; /* Type of connection */ char desc[30]; /* String description */ -#ifdef HAVE_VIO + char *read_buffer; /* buffer for vio_read_buff */ + char *read_pos; /* start of unfetched data in the + read buffer */ + char *read_end; /* end of unfetched data */ /* function pointers. They are similar for socket/SSL/whatever */ void (*viodelete)(Vio*); int (*vioerrno)(Vio*); @@ -203,6 +213,5 @@ struct st_vio char *shared_memory_pos; NET *net; #endif /* HAVE_SMEM */ -#endif /* HAVE_VIO */ }; #endif /* vio_violite_h_ */ |