diff --git a/include/m_ctype.h b/include/m_ctype.h index 8e3cffc5613..ee6a50e6b8d 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -49,6 +49,9 @@ typedef struct unicase_info_st { #define MY_CS_TOOSMALL -1 #define MY_CS_TOOFEW(n) (-1-(n)) +#define MY_SEQ_INTTAIL 1 +#define MY_SEQ_SPACES 2 + /* My charsets_list flags */ #define MY_NO_SETS 0 #define MY_CS_COMPILED 1 /* compiled-in sets */ @@ -144,6 +147,8 @@ typedef struct charset_info_st ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l, int base, char **e, int *err); double (*strntod)(struct charset_info_st *, char *s, uint l, char **e, int *err); + ulong (*scan)(struct charset_info_st *, const char *b, const char *e, int sq); + } CHARSET_INFO; @@ -181,6 +186,8 @@ extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, ui 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); +ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); + int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, const char *fmt, ...); long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err); diff --git a/mysys/charset.c b/mysys/charset.c index c5b2bcc2757..591ba568e3d 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -80,6 +80,7 @@ static void simple_cs_init_functions(CHARSET_INFO *cs) cs->strntoll = my_strntoll_8bit; cs->strntoull = my_strntoull_8bit; cs->strntod = my_strntod_8bit; + cs->scan = my_scan_8bit; cs->mbmaxlen = 1; } diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 3d26918f1c8..a475a36d049 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6257,7 +6257,8 @@ CHARSET_INFO my_charset_big5 = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 3cf5bb763cd..7d174d510e2 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -305,6 +305,7 @@ static CHARSET_INFO my_charset_bin_st = my_strntoll_8bit, my_strntoull_8bit, my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 8feb83cbeb4..6397d3d902e 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -634,7 +634,8 @@ CHARSET_INFO my_charset_czech = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; #endif diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index ff7d0e9a5ae..ee75673e1c5 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8674,7 +8674,8 @@ CHARSET_INFO my_charset_euc_kr = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; #endif diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index a94778118e3..0820d03b2d0 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5724,7 +5724,8 @@ CHARSET_INFO my_charset_gb2312 = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; #endif diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 7c48e239f2d..3aff098cd14 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9912,6 +9912,7 @@ CHARSET_INFO my_charset_gbk = my_strntoll_8bit, my_strntoull_8bit, my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c index 6891e4cf944..6a5a9b78e8d 100644 --- a/strings/ctype-latin1_de.c +++ b/strings/ctype-latin1_de.c @@ -452,7 +452,8 @@ CHARSET_INFO my_charset_latin1_de = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; #endif diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 4ecd3717ca1..d9270a6de93 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -968,3 +968,29 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, *min_str++ = *max_str++ = ' '; // Because if key compression return 0; } + + +ulong my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) +{ + const char *str0= str; + switch (sq) + { + case MY_SEQ_INTTAIL: + if (*str == '.') + { + for(str++ ; str != end && *str == '0' ; str++); + return str-str0; + } + return 0; + + case MY_SEQ_SPACES: + for (str++ ; str != end ; str++) + { + if (!my_isspace(cs,*str)) + break; + } + return str-str0; + default: + return 0; + } +} diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index b3d81bb9c8a..b19bcf1a45a 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4498,7 +4498,8 @@ CHARSET_INFO my_charset_sjis = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; #endif diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index b07b08bba9f..ac959105736 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -726,7 +726,8 @@ CHARSET_INFO my_charset_tis620 = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index eaf39ff0aa7..12e177a89be 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8468,7 +8468,8 @@ CHARSET_INFO my_charset_ujis = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 2418a6ab574..2d6a37dd5a7 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2000,6 +2000,7 @@ CHARSET_INFO my_charset_utf8 = my_strntoll_8bit, my_strntoull_8bit, my_strntod_8bit, + my_scan_8bit }; @@ -3073,7 +3074,8 @@ CHARSET_INFO my_charset_ucs2 = my_strntoul_ucs2, my_strntoll_ucs2, my_strntoull_ucs2, - my_strntod_ucs2 + my_strntod_ucs2, + my_scan_8bit }; diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 6ec96693fec..86ddb82e1a2 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -660,7 +660,8 @@ CHARSET_INFO my_charset_win1250ch = my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }; diff --git a/strings/ctype.c b/strings/ctype.c index 04ae5917da2..0873429f9ab 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -2849,7 +2849,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -2895,7 +2896,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -2940,7 +2942,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -2985,7 +2988,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3031,7 +3035,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3076,7 +3081,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3121,7 +3127,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3166,7 +3173,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3212,7 +3220,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3257,7 +3266,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3302,7 +3312,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3347,7 +3358,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3392,7 +3404,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3437,7 +3450,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3482,7 +3496,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3528,7 +3543,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3573,7 +3589,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3619,7 +3636,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3665,7 +3683,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3710,7 +3729,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3755,7 +3775,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3800,7 +3821,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3845,7 +3867,8 @@ static CHARSET_INFO compiled_charsets[] = { my_strntoul_8bit, my_strntoll_8bit, my_strntoull_8bit, - my_strntod_8bit + my_strntod_8bit, + my_scan_8bit }, #endif @@ -3891,6 +3914,7 @@ static CHARSET_INFO compiled_charsets[] = { NULL, NULL, NULL, + NULL, NULL } };