diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/m_ctype.h | 70 | ||||
-rw-r--r-- | include/my_base.h | 6 | ||||
-rw-r--r-- | include/my_compare.h | 2 | ||||
-rw-r--r-- | include/my_context.h | 2 | ||||
-rw-r--r-- | include/my_pthread.h | 2 | ||||
-rw-r--r-- | include/my_sys.h | 6 | ||||
-rw-r--r-- | include/mysql.h.pp | 3 | ||||
-rw-r--r-- | include/mysql/service_progress_report.h | 2 | ||||
-rw-r--r-- | include/mysql_com.h | 9 |
9 files changed, 71 insertions, 31 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index ee49e94ef99..c892d576102 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -180,6 +180,10 @@ extern MY_UNI_CTYPE my_uni_ctype[256]; /* A helper macros for "need at least n bytes" */ #define MY_CS_TOOSMALLN(n) (-100-(n)) +#define MY_CS_MBMAXLEN 6 /* Maximum supported mbmaxlen */ +#define MY_CS_IS_TOOSMALL(rc) ((rc) >= MY_CS_TOOSMALL6 && (rc) <= MY_CS_TOOSMALL) + + #define MY_SEQ_INTTAIL 1 #define MY_SEQ_SPACES 2 @@ -325,8 +329,7 @@ struct my_collation_handler_st int (*strnncoll)(CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, my_bool); int (*strnncollsp)(CHARSET_INFO *, - const uchar *, size_t, const uchar *, size_t, - my_bool diff_if_only_endspace_difference); + const uchar *, size_t, const uchar *, size_t); size_t (*strnxfrm)(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); @@ -400,7 +403,6 @@ struct my_charset_handler_st { my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *loader); /* Multibyte routines */ - uint (*ismbchar)(CHARSET_INFO *, const char *, const char *); uint (*mbcharlen)(CHARSET_INFO *, uint c); size_t (*numchars)(CHARSET_INFO *, const char *b, const char *e); size_t (*charpos)(CHARSET_INFO *, const char *b, const char *e, @@ -645,8 +647,7 @@ extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t, const uchar *, size_t, my_bool); extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, - const uchar *, size_t, - my_bool diff_if_only_endspace_difference); + const uchar *, size_t); extern void my_hash_sort_simple(CHARSET_INFO *cs, const uchar *key, size_t len, @@ -655,6 +656,17 @@ extern void my_hash_sort_bin(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2); +/** + Compare a string to an array of spaces, for PAD SPACE comparison. + The function iterates through the string and compares every byte to 0x20. + @param - the string + @param - its length + @return <0 - if a byte less than 0x20 was found in the string. + @return 0 - if all bytes in the string were 0x20, or if length was 0. + @return >0 - if a byte greater than 0x20 was found in the string. +*/ +extern int my_strnncollsp_padspace_bin(const uchar *str, size_t length); + extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length); extern uint my_instr_simple(CHARSET_INFO *, @@ -801,16 +813,6 @@ uint my_instr_mb(CHARSET_INFO *, const char *s, size_t s_length, my_match_t *match, uint nmatch); -int my_strnncoll_mb_bin(CHARSET_INFO * cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix); - -int my_strnncollsp_mb_bin(CHARSET_INFO *cs, - const uchar *a, size_t a_length, - const uchar *b, size_t b_length, - my_bool diff_if_only_endspace_difference); - int my_wildcmp_mb_bin(CHARSET_INFO *cs, const char *str,const char *str_end, const char *wildstr,const char *wildend, @@ -972,8 +974,42 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length, #define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b))) #define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num)) -#define use_mb(s) ((s)->cset->ismbchar != NULL) -#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b))) +#define use_mb(s) ((s)->mbmaxlen > 1) +/** + Detect if the leftmost character in a string is a valid multi-byte character + and return its length, or return 0 otherwise. + @param cs - character set + @param str - the beginning of the string + @param end - the string end (the next byte after the string) + @return >0, for a multi-byte character + @rerurn 0, for a single byte character, broken sequence, empty string. +*/ +static inline +uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end) +{ + int char_length= (cs->cset->charlen)(cs, (const uchar *) str, + (const uchar *) end); + return char_length > 1 ? (uint) char_length : 0U; +} + + +/** + Return length of the leftmost character in a string. + @param cs - character set + @param str - the beginning of the string + @param end - the string end (the next byte after the string) + @return <=0 on errors (EOL, wrong byte sequence) + @return 1 on a single byte character + @return >1 on a multi-byte character + + Note, inlike my_ismbchar(), 1 is returned for a single byte character. +*/ +static inline +int my_charlen(CHARSET_INFO *cs, const char *str, const char *end) +{ + return (cs->cset->charlen)(cs, (const uchar *) str, + (const uchar *) end); +} #ifdef USE_MB #define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a))) #else diff --git a/include/my_base.h b/include/my_base.h index 8b546edac43..1317639c528 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -298,11 +298,7 @@ enum ha_base_keytype { #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 #define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */ diff --git a/include/my_compare.h b/include/my_compare.h index 0db22b593f4..6b76483074b 100644 --- a/include/my_compare.h +++ b/include/my_compare.h @@ -108,7 +108,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */ set_rec_bits(0, bit_ptr, bit_ofs, bit_len) extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint, - const uchar *, uint , my_bool, my_bool); + const uchar *, uint , my_bool); extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, const uchar *b, uint key_length, uint nextflag, uint *diff_pos); diff --git a/include/my_context.h b/include/my_context.h index 228f0c18f62..ea0e3496887 100644 --- a/include/my_context.h +++ b/include/my_context.h @@ -178,7 +178,7 @@ struct mysql_async_context { resumed, eg. whether we woke up due to connection completed or timeout in mysql_real_connect_cont(). */ - unsigned int events_occured; + unsigned int events_occurred; /* This is set to the result of the whole asynchronous operation when it completes. It uses a union, as different calls have different return diff --git a/include/my_pthread.h b/include/my_pthread.h index 0209c72f65b..991bc76c1ec 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -694,7 +694,7 @@ extern void my_mutex_end(void); We need to have at least 256K stack to handle calls to myisamchk_init() with the current number of keys and key parts. */ -#define DEFAULT_THREAD_STACK (289*1024L) +#define DEFAULT_THREAD_STACK (290*1024L) #endif #define MY_PTHREAD_LOCK_READ 0 diff --git a/include/my_sys.h b/include/my_sys.h index 45833977a15..25554701a8c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -689,7 +689,7 @@ extern void my_osmaperr(unsigned long last_error); #endif extern void init_glob_errs(void); -extern const char** get_global_errmsgs(void); +extern const char** get_global_errmsgs(int nr); extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); @@ -714,9 +714,9 @@ extern void my_printf_error(uint my_err, const char *format, ATTRIBUTE_FORMAT(printf, 2, 4); extern void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap); -extern int my_error_register(const char** (*get_errmsgs) (void), +extern int my_error_register(const char** (*get_errmsgs) (int nr), uint first, uint last); -extern const char **my_error_unregister(uint first, uint last); +extern my_bool my_error_unregister(uint first, uint last); extern void my_message(uint my_err, const char *str,myf MyFlags); extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); extern my_bool my_init(void); diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 5c3a9210ce8..0c06141df6c 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -9,6 +9,9 @@ enum enum_server_command COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, + COM_MDB_GAP_BEG, + COM_MDB_GAP_END=253, + COM_MULTI, COM_END }; struct st_vio; diff --git a/include/mysql/service_progress_report.h b/include/mysql/service_progress_report.h index 670b1c37630..7ec3aa4c946 100644 --- a/include/mysql/service_progress_report.h +++ b/include/mysql/service_progress_report.h @@ -22,7 +22,7 @@ if requested. The functions are documented at - http://kb.askmonty.org/en/progress-reporting#how-to-add-support-for-progress-reporting-to-a-storage-engine + https://mariadb.com/kb/en/progress-reporting/#how-to-add-support-for-progress-reporting-to-a-storage-engine */ #ifdef __cplusplus diff --git a/include/mysql_com.h b/include/mysql_com.h index 3b2e200ebd1..b3ced3d18ed 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -102,7 +102,9 @@ enum enum_server_command COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, /* don't forget to update const char *command_name[] in sql_parse.cc */ - + COM_MDB_GAP_BEG, + COM_MDB_GAP_END=253, + COM_MULTI, /* Must be last */ COM_END }; @@ -233,6 +235,8 @@ enum enum_server_command #define MARIADB_CLIENT_FLAGS_MASK 0xffffffff00000000ULL /* Client support progress indicator */ #define MARIADB_CLIENT_PROGRESS (1ULL << 32) +/* support COM_MULTI */ +#define MARIADB_CLIENT_COM_MULTI (1ULL << 33) #ifdef HAVE_COMPRESS #define CAN_CLIENT_COMPRESS CLIENT_COMPRESS @@ -269,7 +273,8 @@ enum enum_server_command MARIADB_CLIENT_PROGRESS | \ CLIENT_PLUGIN_AUTH | \ CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ - CLIENT_CONNECT_ATTRS) + CLIENT_CONNECT_ATTRS |\ + MARIADB_CLIENT_COM_MULTI) /* To be added later: |