diff options
author | monty@narttu.mysql.fi <> | 2002-08-30 12:40:40 +0300 |
---|---|---|
committer | monty@narttu.mysql.fi <> | 2002-08-30 12:40:40 +0300 |
commit | 7134ffec210edde21860a2b2c2654be481de49b4 (patch) | |
tree | 1bb81fd601075133af9ee99bd7ac94baf5ffc46c /include | |
parent | 921f7c9c551d9e1bdd5083ebe71d204ab6246ba1 (diff) | |
parent | dd5382187e68ff5337e1fe7ba5f86f0d9cdd31d5 (diff) | |
download | mariadb-git-7134ffec210edde21860a2b2c2654be481de49b4.tar.gz |
Merge with 4.0.3
Some simple optimzations, more comments and indentation changes.
Add ` around database in 'use database' in binary log.
Moved max_error_count and max_warning_count to variables struct.
Removed SHOW_WARNS_COUNT and SHOW_ERRORS_COUNT calls.
Changed string functions to use character set of first string argument as default return characterset
(Each string function can change the above assumption if needed)
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 3 | ||||
-rw-r--r-- | include/errmsg.h | 14 | ||||
-rw-r--r-- | include/hash.h | 12 | ||||
-rw-r--r-- | include/heap.h | 48 | ||||
-rw-r--r-- | include/m_ctype.h | 400 | ||||
-rw-r--r-- | include/my_base.h | 4 | ||||
-rw-r--r-- | include/my_handler.h | 59 | ||||
-rw-r--r-- | include/my_sys.h | 23 | ||||
-rw-r--r-- | include/my_tree.h | 29 | ||||
-rw-r--r-- | include/myisam.h | 22 | ||||
-rw-r--r-- | include/mysql.h | 98 | ||||
-rw-r--r-- | include/mysql_com.h | 80 | ||||
-rw-r--r-- | include/mysqld_error.h | 6 |
13 files changed, 613 insertions, 185 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 67132b4c4a4..a3aebfa70e0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -28,7 +28,8 @@ noinst_HEADERS = config-win.h config-os2.h \ my_dir.h mysys_err.h my_base.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_aes.h my_getopt.h my_tree.h hash.h thr_alarm.h \ - thr_lock.h t_ctype.h violite.h md5.h mysql_version.h.in + thr_lock.h t_ctype.h violite.h md5.h \ + mysql_version.h.in my_handler.h # mysql_version.h are generated SUPERCLEANFILES = mysql_version.h my_config.h diff --git a/include/errmsg.h b/include/errmsg.h index 76a57f47611..175089ba371 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -61,3 +61,17 @@ extern const char *client_errors[]; /* Error messages */ #define CR_PROBE_SLAVE_HOSTS 2023 #define CR_PROBE_SLAVE_CONNECT 2024 #define CR_PROBE_MASTER_CONNECT 2025 + +/* new 4.1 error codes */ +#define CR_INVALID_CONN_HANDLE 2026 +#define CR_NULL_POINTER 2027 +#define CR_MEMORY_ERROR 2028 +#define CR_NO_PREPARE_STMT 2029 +#define CR_NOT_ALL_PARAMS_BOUND 2030 +#define CR_DATA_TRUNCATED 2031 +#define CR_NOT_ALL_BUFFERS_BOUND 2032 +#define CR_FAILED_TO_SET_PARAM_DATA 2033 +#define CR_NO_PARAMETERS_EXISTS 2033 +#define CR_INVALID_PARAMETER_NO 2035 +#define CR_INVALID_BUFFER_USE 2036 + diff --git a/include/hash.h b/include/hash.h index e9c8c73c05b..0635d2fd7fc 100644 --- a/include/hash.h +++ b/include/hash.h @@ -40,13 +40,15 @@ typedef struct st_hash { DYNAMIC_ARRAY array; /* Place for hash_keys */ hash_get_key get_key; void (*free)(void *); - uint (*calc_hashnr)(const byte *key,uint length); + uint (*calc_hashnr)(CHARSET_INFO *cs, const byte *key,uint length); + CHARSET_INFO *charset; } HASH; -#define hash_init(A,B,C,D,E,F,G) _hash_init(A,B,C,D,E,F,G CALLER_INFO) -my_bool _hash_init(HASH *hash,uint default_array_elements, uint key_offset, - uint key_length, hash_get_key get_key, - void (*free_element)(void*), uint flags CALLER_INFO_PROTO); +#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO) +my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, + uint default_array_elements, uint key_offset, + uint key_length, hash_get_key get_key, + void (*free_element)(void*), uint flags CALLER_INFO_PROTO); void hash_free(HASH *tree); byte *hash_element(HASH *hash,uint idx); gptr hash_search(HASH *info,const byte *key,uint length); diff --git a/include/heap.h b/include/heap.h index 02b04e2b3ec..359c4346a5d 100644 --- a/include/heap.h +++ b/include/heap.h @@ -14,7 +14,7 @@ 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 heap_database_funktions */ +/* This file should be included when using heap_database_functions */ /* Author: Michael Widenius */ #ifndef _heap_h @@ -31,6 +31,9 @@ extern "C" { #include <thr_lock.h> #endif +#include "my_handler.h" +#include "my_tree.h" + /* defines used by heap-funktions */ #define HP_MAX_LEVELS 4 /* 128^5 records is enough */ @@ -73,22 +76,22 @@ typedef struct st_heap_block /* The data is saved in blocks */ ulong last_allocated; /* Blocks allocated, used by keys */ } HP_BLOCK; -typedef struct st_hp_keyseg /* Key-portion */ -{ - uint start; /* Start of key in record (from 0) */ - uint length; /* Keylength */ - uint type; - uint null_bit; /* bit set in row+null_pos */ - uint null_pos; -} HP_KEYSEG; +struct st_heap_info; /* For referense */ typedef struct st_hp_keydef /* Key definition with open */ { uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */ uint keysegs; /* Number of key-segment */ uint length; /* Length of key (automatic) */ - HP_KEYSEG *seg; + uint8 algorithm; /* HASH / BTREE */ + HA_KEYSEG *seg; HP_BLOCK block; /* Where keys are saved */ + TREE rb_tree; + int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, + const byte *record, byte *recpos); + int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo, + const byte *record, byte *recpos, int flag); + uint (*get_key_length)(struct st_hp_keydef *keydef, const byte *key); } HP_KEYDEF; typedef struct st_heap_share @@ -126,6 +129,11 @@ typedef struct st_heap_info int mode; /* Mode of file (READONLY..) */ uint opt_flag,update; byte *lastkey; /* Last used key with rkey */ + byte *recbuf; /* Record buffer for rb-tree keys */ + enum ha_rkey_function last_find_flag; + TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1]; + TREE_ELEMENT **last_pos; + uint lastkey_len; #ifdef THREAD THR_LOCK_DATA lock; #endif @@ -134,9 +142,7 @@ typedef struct st_heap_info /* Prototypes for heap-functions */ -extern HP_INFO* heap_open(const char *name,int mode,uint keys, - HP_KEYDEF *keydef,uint reclength, - ulong max_records,ulong min_reloc); +extern HP_INFO *heap_open(const char *name, int mode); extern int heap_close(HP_INFO *info); extern int heap_write(HP_INFO *info,const byte *buff); extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata); @@ -145,7 +151,8 @@ extern int heap_scan_init(HP_INFO *info); extern int heap_scan(register HP_INFO *info, byte *record); extern int heap_delete(HP_INFO *info,const byte *buff); extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag); -extern int heap_create(const char *name); +extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, + uint reclength, ulong max_records, ulong min_records); extern int heap_delete_table(const char *name); extern int heap_extra(HP_INFO *info,enum ha_extra_function function); extern int heap_rename(const char *old_name,const char *new_name); @@ -153,10 +160,17 @@ extern int heap_panic(enum ha_panic_function flag); extern int heap_rsame(HP_INFO *info,byte *record,int inx); extern int heap_rnext(HP_INFO *info,byte *record); extern int heap_rprev(HP_INFO *info,byte *record); -extern int heap_rfirst(HP_INFO *info,byte *record); -extern int heap_rlast(HP_INFO *info,byte *record); +extern int heap_rfirst(HP_INFO *info,byte *record,int inx); +extern int heap_rlast(HP_INFO *info,byte *record,int inx); extern void heap_clear(HP_INFO *info); -extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key); + +ha_rows hp_rb_records_in_range(HP_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); +int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, + uint key_len, enum ha_rkey_function find_flag); extern gptr heap_find(HP_INFO *info,int inx,const byte *key); extern int heap_check_heap(HP_INFO *info, my_bool print_status); extern byte *heap_position(HP_INFO *info); diff --git a/include/m_ctype.h b/include/m_ctype.h index fc983d1d580..70acfcb3dec 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -26,68 +26,311 @@ extern "C" { #endif + #define CHARSET_DIR "charsets/" +#define my_wc_t ulong + +typedef struct unicase_info_st { + uint16 toupper; + uint16 tolower; + uint16 sort; +} MY_UNICASE_INFO; + +#define MY_CS_ILSEQ 0 +#define MY_CS_ILUNI 0 +#define MY_CS_TOOSMALL -1 +#define MY_CS_TOOFEW(n) (-1-(n)) + + /* My charsets_list flags */ +#define MY_NO_SETS 0 +#define MY_CS_COMPILED 1 /* compiled-in sets */ +#define MY_CS_CONFIG 2 /* sets that have a *.conf file */ +#define MY_CS_INDEX 4 /* sets listed in the Index file */ +#define MY_CS_LOADED 8 /* sets that are currently loaded */ + + +typedef struct my_uni_idx_st { + uint16 from; + uint16 to; + uchar *tab; +} MY_UNI_IDX; + + typedef struct charset_info_st { - uint number; - const char *name; - uchar *ctype; - uchar *to_lower; - uchar *to_upper; - uchar *sort_order; - - uint strxfrm_multiply; - int (*strcoll)(const uchar *, const uchar *); - int (*strxfrm)(uchar *, const uchar *, int); - int (*strnncoll)(const uchar *, int, const uchar *, int); - int (*strnxfrm)(uchar *, const uchar *, int, int); - my_bool (*like_range)(const char *, uint, pchar, uint, - char *, char *, uint *, uint *); - - uint mbmaxlen; - int (*ismbchar)(const char *, const char *); - my_bool (*ismbhead)(uint); - int (*mbcharlen)(uint); + uint number; + uint state; + const char *name; + const char *comment; + uchar *ctype; + uchar *to_lower; + uchar *to_upper; + uchar *sort_order; + uint16 *tab_to_uni; + MY_UNI_IDX *tab_from_uni; + + /* Collation routines */ + uint strxfrm_multiply; + int (*strnncoll)(struct charset_info_st *, + const uchar *, uint, const uchar *, uint); + int (*strnxfrm)(struct charset_info_st *, + uchar *, uint, const uchar *, uint); + my_bool (*like_range)(struct charset_info_st *, + const char *, uint, pchar, uint, + char *, char *, uint *, uint *); + + /* Multibyte routines */ + uint mbmaxlen; + int (*ismbchar)(struct charset_info_st *, const char *, const char *); + my_bool (*ismbhead)(struct charset_info_st *, uint); + int (*mbcharlen)(struct charset_info_st *, uint); + + /* Unicode convertion */ + int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc, + const unsigned char *s,const unsigned char *e); + int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc, + unsigned char *s,unsigned char *e); + + /* Functions for case convertion */ + void (*caseup_str)(struct charset_info_st *, char *); + void (*casedn_str)(struct charset_info_st *, char *); + void (*caseup)(struct charset_info_st *, char *, uint); + void (*casedn)(struct charset_info_st *, char *, uint); + + /* Functions for case comparison */ + int (*strcasecmp)(struct charset_info_st *, const char *, const char *); + int (*strncasecmp)(struct charset_info_st *, const char *, const char *, + uint); + + /* Hash calculation */ + uint (*hash_caseup)(struct charset_info_st *cs, const byte *key, uint len); + void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len, + ulong *nr1, ulong *nr2); + + char max_sort_char; /* For LIKE optimization */ } CHARSET_INFO; /* strings/ctype.c */ extern CHARSET_INFO *default_charset_info; +extern CHARSET_INFO *system_charset_info; extern CHARSET_INFO *find_compiled_charset(uint cs_number); extern CHARSET_INFO *find_compiled_charset_by_name(const char *name); extern CHARSET_INFO compiled_charsets[]; +extern CHARSET_INFO all_charsets[256]; extern uint compiled_charset_number(const char *name); extern const char *compiled_charset_name(uint charset_number); #define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_CURRENT (default_charset_info->number) -/* Don't include std ctype.h when this is included */ -#define _CTYPE_H -#define _CTYPE_H_ -#define _CTYPE_INCLUDED -#define __CTYPE_INCLUDED -#define _CTYPE_USING /* Don't put names in global namespace. */ - -/* Fix things, if ctype.h would have been included before */ -#undef toupper -#undef _toupper -#undef _tolower -#undef toupper -#undef tolower -#undef isalpha -#undef isupper -#undef islower -#undef isdigit -#undef isxdigit -#undef isalnum -#undef isspace -#undef ispunct -#undef isprint -#undef isgraph -#undef iscntrl -#undef isascii -#undef toascii +/* declarations for simple charsets */ +extern int my_strnxfrm_simple(CHARSET_INFO *, char *, uint, const char *, uint); +extern int my_strnncoll_simple(CHARSET_INFO *, const char *, uint, const char *, uint); + +/* Functions for 8bit */ +extern void my_caseup_str_8bit(CHARSET_INFO *, char *); +extern void my_casedn_str_8bit(CHARSET_INFO *, char *); +extern void my_caseup_8bit(CHARSET_INFO *, char *, uint); +extern void my_casedn_8bit(CHARSET_INFO *, char *, uint); + +extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); +extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint); + +int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); + + +#ifdef USE_MB +/* Functions for multibyte charsets */ +extern void my_caseup_str_mb(CHARSET_INFO *, char *); +extern void my_casedn_str_mb(CHARSET_INFO *, char *); +extern void my_caseup_mb(CHARSET_INFO *, char *, uint); +extern void my_casedn_mb(CHARSET_INFO *, char *, uint); +extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); +extern int my_strncasecmp_mb(CHARSET_INFO * cs,const char *, const char *t, uint); +#endif + +#ifdef HAVE_CHARSET_big5 +/* declarations for the big5 character set */ +extern uchar ctype_big5[], to_lower_big5[], to_upper_big5[], sort_order_big5[]; +extern int my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_big5(CHARSET_INFO *,uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +extern int ismbchar_big5(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_big5(CHARSET_INFO *, uint); +extern int mbcharlen_big5(CHARSET_INFO *, uint); +int my_mb_wc_big5(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_big5(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_czech +/* declarations for the czech character set */ +extern uchar ctype_czech[], to_lower_czech[], to_upper_czech[], sort_order_czech[]; +extern int my_strnncoll_czech(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_czech(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_czech(CHARSET_INFO *, + const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +#endif + + +#ifdef HAVE_CHARSET_win1250ch +/* declarations for the win1250ch character set */ +extern uchar ctype_win1250ch[]; +extern uchar to_lower_win1250ch[]; +extern uchar to_upper_win1250ch[]; +extern uchar sort_order_win1250ch[]; +extern int my_strnncoll_win1250ch(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_win1250ch(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_win1250ch(CHARSET_INFO *, + const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +#endif + + +#ifdef HAVE_CHARSET_euc_kr +/* declarations for the euc_kr character set */ +extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[]; +extern int ismbchar_euc_kr(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_euc_kr(CHARSET_INFO *, uint); +extern int mbcharlen_euc_kr(CHARSET_INFO *, uint); +int my_mb_wc_euc_kr(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_euc_kr(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_gb2312 +/* declarations for the gb2312 character set */ +extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[]; +extern int ismbchar_gb2312(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_gb2312(CHARSET_INFO *, uint); +extern int mbcharlen_gb2312(CHARSET_INFO *, uint); +int my_mb_wc_gb2312(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_gb2312(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_gbk +/* declarations for the gbk character set */ +extern uchar ctype_gbk[], to_lower_gbk[], to_upper_gbk[], sort_order_gbk[]; +extern int my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_gbk(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +extern int ismbchar_gbk(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_gbk(CHARSET_INFO *, uint); +extern int mbcharlen_gbk(CHARSET_INFO *, uint); +int my_mb_wc_gbk(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_gbk(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_latin1_de +/* declarations for the latin1_de character set */ +extern uchar ctype_latin1_de[], to_lower_latin1_de[], to_upper_latin1_de[], sort_order_latin1_de[]; +extern int my_strnncoll_latin1_de(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_latin1_de(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_latin1_de(CHARSET_INFO *, const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +#endif + +#ifdef HAVE_CHARSET_sjis +/* declarations for the sjis character set */ +extern uchar ctype_sjis[], to_lower_sjis[], to_upper_sjis[], sort_order_sjis[]; +extern int my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_sjis(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +extern int ismbchar_sjis(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_sjis(CHARSET_INFO *, uint); +extern int mbcharlen_sjis(CHARSET_INFO *, uint); +int my_mb_wc_sjis(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_sjis(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_tis620 +/* declarations for the tis620 character set */ +extern uchar ctype_tis620[], to_lower_tis620[], to_upper_tis620[], sort_order_tis620[]; +extern int my_strnncoll_tis620(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnxfrm_tis620(CHARSET_INFO *, uchar *, uint, const uchar *, uint); +extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, uint, + char *, char *, uint *, uint *); +#endif + +#ifdef HAVE_CHARSET_ujis +/* declarations for the ujis character set */ +extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[]; +extern int ismbchar_ujis(CHARSET_INFO *, const char *, const char *); +extern my_bool ismbhead_ujis(CHARSET_INFO *, uint); +extern int mbcharlen_ujis(CHARSET_INFO *, uint); +int my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_euc_jp(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); +#endif + +#ifdef HAVE_CHARSET_utf8 + +extern uchar ctype_utf8[]; +extern uchar to_lower_utf8[]; +extern uchar to_upper_utf8[]; + +int my_strnncoll_utf8(CHARSET_INFO *cs, + const uchar *s, uint s_len, const uchar *t, uint t_len); + +int my_strnxfrm_utf8(CHARSET_INFO *cs, + uchar *dest, uint destlen, const uchar *src, uint srclen); + +int my_ismbchar_utf8(CHARSET_INFO *cs, const char *b, const char *e); +my_bool my_ismbhead_utf8(CHARSET_INFO * cs, uint ch); +int my_mbcharlen_utf8(CHARSET_INFO *cs, uint c); + +void my_caseup_str_utf8(CHARSET_INFO * cs, char * s); +void my_casedn_str_utf8(CHARSET_INFO *cs, char * s); +void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint len); +void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint len); + +int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t); +int my_strncasecmp_utf8(CHARSET_INFO *cs, const char *s,const char *t,uint l); + +int my_utf8_uni (CHARSET_INFO *cs, my_wc_t *p, const uchar *s, const uchar *e); +int my_uni_utf8 (CHARSET_INFO *cs, my_wc_t wc, uchar *b, uchar *e); + +uint my_hash_caseup_utf8(struct charset_info_st *cs, const byte *key, uint len); +void my_hash_sort_utf8(struct charset_info_st *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2); + +#endif + + +#ifdef HAVE_CHARSET_ucs2 + +extern uchar ctype_ucs2[]; +extern uchar to_lower_ucs2[]; +extern uchar to_upper_ucs2[]; + +int my_strnncoll_ucs2(CHARSET_INFO *cs, + const uchar *s, uint s_len, const uchar *t, uint t_len); + +int my_strnxfrm_ucs2(CHARSET_INFO *cs, + uchar *dest, uint destlen, const uchar *src, uint srclen); + +int my_ismbchar_ucs2(CHARSET_INFO *cs, const char *b, const char *e); +my_bool my_ismbhead_ucs2(CHARSET_INFO * cs, uint ch); +int my_mbcharlen_ucs2(CHARSET_INFO *cs, uint c); + +void my_caseup_str_ucs2(CHARSET_INFO * cs, char * s); +void my_casedn_str_ucs2(CHARSET_INFO *cs, char * s); +void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint len); +void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint len); + +int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t); +int my_strncasecmp_ucs2(CHARSET_INFO *cs, const char *s,const char *t,uint l); + +int my_ucs2_uni (CHARSET_INFO *cs, my_wc_t *p, const uchar *s, const uchar *e); +int my_uni_ucs2 (CHARSET_INFO *cs, my_wc_t wc, uchar *b, uchar *e); + +uint my_hash_caseup_ucs2(struct charset_info_st *cs, const byte *key, uint len); +void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, ulong *nr1, ulong *nr2); + +#endif + #define _U 01 /* Upper case */ #define _L 02 /* Lower case */ @@ -98,34 +341,13 @@ extern const char *compiled_charset_name(uint charset_number); #define _B 0100 /* Blank */ #define _X 0200 /* heXadecimal digit */ -#define my_ctype (default_charset_info->ctype) -#define my_to_upper (default_charset_info->to_upper) -#define my_to_lower (default_charset_info->to_lower) -#define my_sort_order (default_charset_info->sort_order) - -#define _toupper(c) (char) my_to_upper[(uchar) (c)] -#define _tolower(c) (char) my_to_lower[(uchar) (c)] -#define toupper(c) (char) my_to_upper[(uchar) (c)] -#define tolower(c) (char) my_to_lower[(uchar) (c)] - -#define isalpha(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L)) -#define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U) -#define islower(c) ((my_ctype+1)[(uchar) (c)] & _L) -#define isdigit(c) ((my_ctype+1)[(uchar) (c)] & _NMR) -#define isxdigit(c) ((my_ctype+1)[(uchar) (c)] & _X) -#define isalnum(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L | _NMR)) -#define isspace(c) ((my_ctype+1)[(uchar) (c)] & _SPC) -#define ispunct(c) ((my_ctype+1)[(uchar) (c)] & _PNT) -#define isprint(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B)) -#define isgraph(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR)) -#define iscntrl(c) ((my_ctype+1)[(uchar) (c)] & _CTR) -#define isascii(c) (!((c) & ~0177)) -#define toascii(c) ((c) & 0177) - -#ifdef ctype -#undef ctype -#endif /* ctype */ +#define my_isascii(c) (!((c) & ~0177)) +#define my_toascii(c) ((c) & 0177) +#define my_tocntrl(c) ((c) & 31) +#define my_toprint(c) ((c) | 64) +#define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)]) +#define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)]) #define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L)) #define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U) #define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L) @@ -138,26 +360,28 @@ extern const char *compiled_charset_name(uint charset_number); #define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR)) #define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _CTR) -#define use_strcoll(s) ((s)->strcoll != NULL) -#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply) -#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d))) -#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d))) -#define my_strxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c))) -#define my_strcoll(s, a, b) ((s)->strcoll((a), (b))) +/* Some macros that should be cleaned up a little */ +#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_') +#define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_') + +#define use_strcoll(s) ((s)->strnncoll != NULL) +#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((s), (a), (b), (c), (d))) +#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((s), (a), (b), (c), (d))) #define my_like_range(s, a, b, c, d, e, f, g, h) \ - ((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h))) + ((s)->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h))) #define use_mb(s) ((s)->ismbchar != NULL) -#define MBMAXLEN (default_charset_info->mbmaxlen) -#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b))) -#define my_ismbhead(s, a) ((s)->ismbhead((a))) -#define my_mbcharlen(s, a) ((s)->mbcharlen((a))) +#define my_ismbchar(s, a, b) ((s)->ismbchar((s), (a), (b))) +#define my_ismbhead(s, a) ((s)->ismbhead((s), (a))) +#define my_mbcharlen(s, a) ((s)->mbcharlen((s),(a))) + +#define my_caseup(s, a, l) ((s)->caseup((s), (a), (l))) +#define my_casedn(s, a, l) ((s)->casedn((s), (a), (l))) +#define my_caseup_str(s, a) ((s)->caseup_str((s), (a))) +#define my_casedn_str(s, a) ((s)->casedn_str((s), (a))) +#define my_strcasecmp(s, a, b) ((s)->strcasecmp((s), (a), (b))) +#define my_strncasecmp(s, a, b, l) ((s)->strncasecmp((s), (a), (b), (l))) -/* Some macros that should be cleaned up a little */ -#define isvar(c) (isalnum(c) || (c) == '_') -#define isvar_start(c) (isalpha(c) || (c) == '_') -#define tocntrl(c) ((c) & 31) -#define toprint(c) ((c) | 64) /* XXX: still need to take care of this one */ #ifdef MY_CHARSET_TIS620 diff --git a/include/my_base.h b/include/my_base.h index ae8fc2204d5..22bc3355cd5 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -149,9 +149,9 @@ enum ha_base_keytype { #define HA_PACK_KEY 2 /* Pack string key to previous key */ #define HA_AUTO_KEY 16 #define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */ -#define HA_FULLTEXT 128 /* SerG: for full-text search */ +#define HA_FULLTEXT 128 /* For full-text search */ #define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ -#define HA_SPATIAL 1024 /* Alex Barkov: for spatial search */ +#define HA_SPATIAL 1024 /* For spatial search */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ diff --git a/include/my_handler.h b/include/my_handler.h new file mode 100644 index 00000000000..629a0974d93 --- /dev/null +++ b/include/my_handler.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +#ifndef _my_handler_h +#define _my_handler_h + +#include "my_global.h" +#include "my_base.h" +#include "m_ctype.h" +#include "myisampack.h" + +typedef struct st_HA_KEYSEG /* Key-portion */ +{ + 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; +} HA_KEYSEG; + +#define get_key_length(length,key) \ +{ if ((uchar) *(key) != 255) \ + length= (uint) (uchar) *((key)++); \ + else \ + { length=mi_uint2korr((key)+1); (key)+=3; } \ +} + +#define get_key_pack_length(length,length_pack,key) \ +{ if ((uchar) *(key) != 255) \ + { length= (uint) (uchar) *((key)++); length_pack=1; }\ + else \ + { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \ +} + +extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , + my_bool); +extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, + register uchar *b, uint key_length, uint nextflag, + uint *diff_pos); + +#endif /* _my_handler_h */ diff --git a/include/my_sys.h b/include/my_sys.h index 163fb72a910..21688533412 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -105,13 +105,6 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_SEEK_CUR 1 #define MY_SEEK_END 2 - /* My charsets_list flags */ -#define MY_NO_SETS 0 -#define MY_COMPILED_SETS 1 /* show compiled-in sets */ -#define MY_CONFIG_SETS 2 /* sets that have a *.conf file */ -#define MY_INDEX_SETS 4 /* all sets listed in the Index file */ -#define MY_LOADED_SETS 8 /* the sets that are currently loaded */ - /* Some constants */ #define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ #define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ @@ -583,11 +576,7 @@ extern void allow_break(void); #endif extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); -extern void caseup(my_string str,uint length); -extern void casedn(my_string str,uint length); -extern void caseup_str(my_string str); -extern void casedn_str(my_string str); -extern void case_sort(my_string str,uint length); +extern void case_sort(CHARSET_INFO *cs, my_string str,uint length); extern uint dirname_part(my_string to,const char *name); extern uint dirname_length(const char *name); #define base_name(A) (A+dirname_length(A)) @@ -612,18 +601,14 @@ extern my_string my_path(my_string to,const char *progname, extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); extern int wild_compare(const char *str,const char *wildstr); -extern my_string my_strcasestr(const char *src,const char *suffix); -extern int my_strcasecmp(const char *s,const char *t); -extern int my_strsortcmp(const char *s,const char *t); -extern int my_casecmp(const char *s,const char *t,uint length); -extern int my_sortcmp(const char *s,const char *t,uint length); -extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len); +extern int my_sortcmp(CHARSET_INFO *cs, const char *s,const char *t,uint length); +extern int my_sortncmp(CHARSET_INFO *cs, const char *s,uint s_len, const char *t,uint t_len); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); extern size_s strip_sp(my_string str); extern void get_date(my_string to,int timeflag,time_t use_time); -extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage); +extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, uint reclength,enum cache_type type, pbool use_async_io); diff --git a/include/my_tree.h b/include/my_tree.h index 8b326a19518..05e93df8593 100644 --- a/include/my_tree.h +++ b/include/my_tree.h @@ -20,13 +20,17 @@ extern "C" { #endif -#define MAX_TREE_HIGHT 40 /* = max 1048576 leafs in tree */ +#include "my_base.h" /* get 'enum ha_rkey_function' */ + +#define MAX_TREE_HEIGHT 40 /* = max 1048576 leafs in tree */ #define ELEMENT_KEY(tree,element)\ (tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\ *((void**) (element+1))) #define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr)) +#define TREE_NO_DUPS 1 + typedef enum { left_root_right, right_root_left } TREE_WALK; typedef uint32 element_count; typedef int (*tree_walk_action)(void *,element_count,void *); @@ -48,15 +52,18 @@ typedef struct st_tree_element { } TREE_ELEMENT; #endif /* MSDOS */ +#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) + typedef struct st_tree { TREE_ELEMENT *root,null_element; - TREE_ELEMENT **parents[MAX_TREE_HIGHT]; + TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated; qsort_cmp2 compare; - void* custom_arg; + void *custom_arg; MEM_ROOT mem_root; my_bool with_delete; tree_element_free free; + uint flag; } TREE; /* Functions on whole tree */ @@ -70,12 +77,22 @@ void reset_tree(TREE*); #define is_tree_inited(tree) ((tree)->root != 0) /* Functions on leafs */ -TREE_ELEMENT *tree_insert(TREE *tree,void *key,uint key_size); -void *tree_search(TREE *tree,void *key); +TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size, + void *custom_arg); +void *tree_search(TREE *tree, void *key, void *custom_arg); int tree_walk(TREE *tree,tree_walk_action action, void *argument, TREE_WALK visit); -int tree_delete(TREE *tree,void *key); +int tree_delete(TREE *tree, void *key, void *custom_arg); +void *tree_search_key(TREE *tree, const void *key, + TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos, + enum ha_rkey_function flag, void *custom_arg); +void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents, + TREE_ELEMENT ***last_pos, int child_offs); +void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, + int r_offs); +uint tree_record_pos(TREE *tree, const void *key, + enum ha_rkey_function search_flag, void *custom_arg); #ifdef __cplusplus } #endif diff --git a/include/myisam.h b/include/myisam.h index ff8544ba492..eac517eb28a 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -28,6 +28,7 @@ extern "C" { #ifndef _m_ctype_h #include <m_ctype.h> #endif +#include "my_handler.h" /* defines used by myisam-funktions */ @@ -105,20 +106,6 @@ typedef struct st_mi_create_info struct st_myisam_info; /* For referense */ typedef struct st_myisam_info MI_INFO; -typedef struct st_mi_keyseg /* Key-portion */ -{ - 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; -} MI_KEYSEG; - - struct st_mi_s_param; typedef struct st_mi_keydef /* Key definition with open & info */ @@ -135,7 +122,7 @@ typedef struct st_mi_keydef /* Key definition with open & info */ uint16 block_size; /* block_size (auto) */ uint32 version; /* For concurrent read/write */ - MI_KEYSEG *seg,*end; + HA_KEYSEG *seg,*end; int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo, uchar *page,uchar *key, uint key_len,uint comp_flag,uchar * *ret_pos, @@ -147,6 +134,8 @@ typedef struct st_mi_keydef /* Key definition with open & info */ struct st_mi_s_param *s_temp); void (*store_key)(struct st_mi_keydef *keyinfo, uchar *key_pos, struct st_mi_s_param *s_temp); + int (*ck_insert)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen); + int (*ck_delete)(struct st_myisam_info *inf, uint k_nr, uchar *k, uint klen); } MI_KEYDEF; @@ -157,7 +146,7 @@ typedef struct st_unique_def /* Segment definition of unique */ uint16 keysegs; /* Number of key-segment */ uchar key; /* Mapped to which key */ uint8 null_are_equal; - MI_KEYSEG *seg,*end; + HA_KEYSEG *seg,*end; } MI_UNIQUEDEF; typedef struct st_mi_decode_tree /* Decode huff-table */ @@ -321,6 +310,7 @@ typedef struct st_sort_key_blocks /* Used when sorting */ int inited; } SORT_KEY_BLOCKS; + typedef struct st_mi_check_param { ulonglong auto_increment_value; diff --git a/include/mysql.h b/include/mysql.h index d581df91f64..50543c51f6b 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -68,16 +68,17 @@ extern char *mysql_unix_port; #define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR) typedef struct st_mysql_field { - char *name; /* Name of column */ - char *table; /* Table of column if column was a field */ - char *org_table; /* Org table name if table was an alias */ - char *db; /* Database for table */ - char *def; /* Default value (set by mysql_list_fields) */ - unsigned long length; /* Width of column */ - unsigned long max_length; /* Max width of selected set */ - unsigned int flags; /* Div flags */ - unsigned int decimals; /* Number of decimals in field */ - enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ + char *name; /* Name of column */ + char *org_name; /* Original column name, if an alias */ + char *table; /* Table of column if column was a field */ + char *org_table; /* Org table name, if table was an alias */ + char *db; /* Database for table */ + char *def; /* Default value (set by mysql_list_fields) */ + unsigned long length; /* Width of column */ + unsigned long max_length; /* Max width of selected set */ + unsigned int flags; /* Div flags */ + unsigned int decimals; /* Number of decimals in field */ + enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ } MYSQL_FIELD; typedef char **MYSQL_ROW; /* return data as array of strings */ @@ -398,6 +399,83 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con, int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, char* res_buf, int res_buf_size); + + + +/* + The following definitions are added for the enhanced + client-server protocol +*/ + +/* statement state */ +enum MY_STMT_STATE { MY_ST_UNKNOWN, MY_ST_PREPARE, MY_ST_EXECUTE }; + +/* bind structure */ +typedef struct st_mysql_bind { + + enum enum_field_types buffer_type; /* buffer type */ + enum enum_field_types field_type; /* field type */ + gptr buffer; /* buffer */ + long *length; /* output length pointer */ + unsigned long buffer_length; /* buffer length */ + unsigned long bind_length; /* internal use */ + my_bool is_null; /* NULL indicator */ + my_bool is_long_data; /* long data indicator */ + my_bool long_ended; /* internal use */ + +} MYSQL_BIND; + +/* statement handler */ +typedef struct st_mysql_stmt { + + MYSQL *mysql; /* connection handle */ + MYSQL_BIND *params; /* input parameters */ + MYSQL_RES *result; /* resultset */ + MYSQL_BIND *bind; /* row binding */ + MYSQL_FIELD *fields; /* prepare meta info */ + MEM_ROOT mem_root; /* root allocations */ + unsigned long param_count; /* parameters count */ + unsigned long field_count; /* fields count */ + unsigned long long_length; /* long buffer alloced length */ + uint err_no; /* error code */ + char error[MYSQL_ERRMSG_SIZE]; /* error message */ + char *query; /* query buffer */ + char *long_data; /* long buffer */ + enum MY_STMT_STATE state; /* statement state */ + my_bool long_alloced; /* flag to indicate long alloced */ + my_bool types_supplied; /* to indicate types supply */ + +} MYSQL_STMT; + + +MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query); +int STDCALL mysql_execute(MYSQL_STMT * stmt); +unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt); +int STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bind); +int STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bind); +int STDCALL mysql_stmt_close(MYSQL_STMT * stmt); +uint STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); +const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); +int STDCALL mysql_commit(MYSQL * mysql); +int STDCALL mysql_rollback(MYSQL * mysql); +int STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); +int STDCALL mysql_fetch(MYSQL_STMT *stmt); +my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt, + uint param_number,gptr data, + unsigned long length); +int STDCALL mysql_multi_query(MYSQL *mysql,const char *query,unsigned long len); +MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_prepare_result(MYSQL_STMT *stmt); + + +/* new status messages */ +#define MYSQL_SUCCESS 0 +#define MYSQL_WARNING 1 +#define MYSQL_ERROR -1 +#define MYSQL_NO_DATA 100 +#define MYSQL_NEED_DATA 99 +#define MYSQL_LONG_DATA_END 0xFF + #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) #ifdef USE_OLD_FUNCTIONS diff --git a/include/mysql_com.h b/include/mysql_com.h index a7e73405ac0..9743fc4c3f5 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -41,7 +41,8 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP, COM_CONNECT_OUT, - COM_REGISTER_SLAVE}; + COM_REGISTER_SLAVE, + COM_PREPARE,COM_EXECUTE,COM_LONG_DATA }; #define NOT_NULL_FLAG 1 /* Field can't be NULL */ #define PRI_KEY_FLAG 2 /* Field is part of a primary key */ @@ -95,6 +96,7 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ +#define CLIENT_PROTOCOL_41 16384 /* New 4.1 protocol */ #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ @@ -136,27 +138,64 @@ typedef struct st_net { #define packet_error (~(unsigned long) 0) -enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, - FIELD_TYPE_SHORT, FIELD_TYPE_LONG, - FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE, - FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP, - FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24, - FIELD_TYPE_DATE, FIELD_TYPE_TIME, - FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR, - FIELD_TYPE_NEWDATE, - FIELD_TYPE_ENUM=247, - FIELD_TYPE_SET=248, - FIELD_TYPE_TINY_BLOB=249, - FIELD_TYPE_MEDIUM_BLOB=250, - FIELD_TYPE_LONG_BLOB=251, - FIELD_TYPE_BLOB=252, - FIELD_TYPE_VAR_STRING=253, - FIELD_TYPE_STRING=254, - FIELD_TYPE_GEOMETRY=255 +enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, + MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, + MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, + MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, + MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, + MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, + MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, + MYSQL_TYPE_NEWDATE, + MYSQL_TYPE_ENUM=247, + MYSQL_TYPE_SET=248, + MYSQL_TYPE_TINY_BLOB=249, + MYSQL_TYPE_MEDIUM_BLOB=250, + MYSQL_TYPE_LONG_BLOB=251, + MYSQL_TYPE_BLOB=252, + MYSQL_TYPE_VAR_STRING=253, + MYSQL_TYPE_STRING=254, + MYSQL_TYPE_GEOMETRY=255 + }; -#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */ -#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */ +/* For backward compatibility */ +#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL +#define FIELD_TYPE_TINY MYSQL_TYPE_TINY +#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT +#define FIELD_TYPE_LONG MYSQL_TYPE_LONG +#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT +#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE +#define FIELD_TYPE_NULL MYSQL_TYPE_NULL +#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP +#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG +#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 +#define FIELD_TYPE_DATE MYSQL_TYPE_DATE +#define FIELD_TYPE_TIME MYSQL_TYPE_TIME +#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME +#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR +#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE +#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM +#define FIELD_TYPE_SET MYSQL_TYPE_SET +#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB +#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB +#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB +#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB +#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING +#define FIELD_TYPE_STRING MYSQL_TYPE_STRING +#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY +#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM +#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY + +#if TO_BE_INCLUDED_LATER +/* For bind applications, to indicate unsigned buffers */ +#define MYSQL_TYPE_UTINY -10 +#define MYSQL_TYPE_USHORT -9 +#define MYSQL_TYPE_ULONG -8 +#define MYSQL_TYPE_UFLOAT -7 +#define MYSQL_TYPE_UDOUBLE -6 +#define MYSQL_TYPE_ULONGLONG -5 +#define MYSQL_TYPE_UINT24 -4 +#endif #define net_new_transaction(net) ((net)->pkt_nr=0) @@ -252,5 +291,6 @@ void my_thread_end(void); #endif #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ +#define MYSQL_LONG_DATA_END 0xFF /* For indication of long data ending */ #endif diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 0898b3d576f..635d8390c2c 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -253,4 +253,8 @@ #define ER_CANT_USE_OPTION_HERE 1234 #define ER_NOT_SUPPORTED_YET 1235 #define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 -#define ER_ERROR_MESSAGES 237 +#define ER_WRONG_FK_DEF 1237 +#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1238 +#define ER_SUBSELECT_NO_1_COL 1239 +#define ER_SUBSELECT_NO_1_ROW 1240 +#define ER_ERROR_MESSAGES 241 |