summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc5
-rw-r--r--client/sql_string.cc2
-rw-r--r--heap/hp_hash.c43
-rw-r--r--include/m_ctype.h215
-rw-r--r--include/my_sys.h3
-rw-r--r--isam/_key.c12
-rw-r--r--isam/_search.c4
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--myisam/ft_static.c2
-rw-r--r--myisam/mi_open.c2
-rw-r--r--myisam/mi_search.c2
-rw-r--r--myisam/mi_unique.c17
-rw-r--r--mysql-test/r/subselect.result17
-rw-r--r--mysql-test/t/subselect.test10
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/charset.c80
-rw-r--r--mysys/hash.c36
-rw-r--r--mysys/mf_casecnv.c81
-rw-r--r--mysys/my_handler.c23
-rw-r--r--sql/field.cc42
-rw-r--r--sql/filesort.cc10
-rw-r--r--sql/ha_innodb.cc6
-rw-r--r--sql/item_subselect.cc50
-rw-r--r--sql/item_subselect.h27
-rw-r--r--sql/item_sum.cc4
-rw-r--r--sql/key.cc5
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/sql_class.cc11
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_show.cc14
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_union.cc7
-rw-r--r--strings/ctype-big5.c65
-rw-r--r--strings/ctype-czech.c138
-rw-r--r--strings/ctype-euc_kr.c51
-rw-r--r--strings/ctype-gb2312.c51
-rw-r--r--strings/ctype-gbk.c47
-rw-r--r--strings/ctype-latin1_de.c107
-rw-r--r--strings/ctype-simple.c77
-rw-r--r--strings/ctype-sjis.c57
-rw-r--r--strings/ctype-tis620.c36
-rw-r--r--strings/ctype-ujis.c52
-rw-r--r--strings/ctype-utf8.c146
-rw-r--r--strings/ctype-win1250ch.c159
-rw-r--r--strings/ctype.c668
46 files changed, 1258 insertions, 1137 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 567b9e450e4..a73a31704b9 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1396,8 +1396,9 @@ com_go(String *buffer,char *line __attribute__((unused)))
(void) com_print(buffer,0);
if (skip_updates &&
- (buffer->length() < 4 || my_sortcmp(system_charset_info,buffer->ptr(),
- "SET ",4)))
+ (buffer->length() < 4 || my_strnncoll(system_charset_info,
+ (const uchar*)buffer->ptr(),4,
+ (const uchar*)"SET ",4)))
{
(void) put_info("Ignoring query to other database",INFO_INFO);
return 0;
diff --git a/client/sql_string.cc b/client/sql_string.cc
index cf9e9f62507..65854ece0ef 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -507,7 +507,7 @@ int sortcmp(const String *x,const String *y)
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
#ifdef USE_STRCOLL
- if (use_strcoll(x->str_charset))
+ if (use_strnxfrm(x->str_charset))
{
#ifndef CMP_ENDSPACE
while (x_len && my_isspace(x->str_charset,s[x_len-1]))
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index 0145e0d503c..e28f4725caf 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -214,18 +214,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- if (seg->charset->hash_sort)
- seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,&nr2);
- else
- {
- register uchar *sort_order=seg->charset->sort_order;
- for (; pos < (uchar*) key ; pos++)
- {
- nr^=(ulong) ((((uint) nr & 63)+nr2) *
- ((uint) sort_order[(uint) *pos])) + (nr << 8);
- nr2+=3;
- }
- }
+ seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,&nr2);
}
else
{
@@ -260,19 +249,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- if (seg->charset->hash_sort)
- seg->charset->hash_sort(seg->charset,pos,end-pos,&nr,&nr2);
- else
- {
- register uchar *sort_order=seg->charset->sort_order;
-
- for (; pos < end ; pos++)
- {
- nr^=(ulong) ((((uint) nr & 63)+nr2)*
- ((uint) sort_order[(uint) *pos]))+ (nr << 8);
- nr2+=3;
- }
- }
+ seg->charset->hash_sort(seg->charset,pos,end-pos,&nr,&nr2);
}
else
{
@@ -324,11 +301,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- for (; pos < (uchar*) key ; pos++)
- {
- nr *=16777619;
- nr ^=((uint) my_sort_order[(uint) *pos]);
- }
+ seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL);
}
else
{
@@ -362,11 +335,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- for ( ; pos < end ; pos++)
- {
- nr *=16777619;
- nr ^=(uint) my_sort_order[(uint) *pos];
- }
+ seg->charset->hash_sort(seg->charset,pos,((uchar*)key)-pos,&nr,NULL);
}
else
{
@@ -401,7 +370,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- if (my_sortcmp(seg->charset,rec1+seg->start,rec2+seg->start,seg->length))
+ if (my_strnncoll(seg->charset,rec1+seg->start,seg->length,rec2+seg->start,seg->length))
return 1;
}
else
@@ -433,7 +402,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
}
if (seg->type == HA_KEYTYPE_TEXT)
{
- if (my_sortcmp(seg->charset,rec+seg->start,key,seg->length))
+ if (my_strnncoll(seg->charset,rec+seg->start,seg->length,key,seg->length))
return 1;
}
else
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 70acfcb3dec..e4bc9be3378 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -49,6 +49,9 @@ typedef struct unicase_info_st {
#define MY_CS_INDEX 4 /* sets listed in the Index file */
#define MY_CS_LOADED 8 /* sets that are currently loaded */
+#define MY_CHARSET_UNDEFINED 0
+#define MY_CHARSET_CURRENT (default_charset_info->number)
+
typedef struct my_uni_idx_st {
uint16 from;
@@ -92,12 +95,13 @@ typedef struct charset_info_st
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
unsigned char *s,unsigned char *e);
- /* Functions for case convertion */
+ /* Functions for case and sort 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);
-
+ void (*tosort)(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 *,
@@ -111,28 +115,31 @@ typedef struct charset_info_st
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);
+extern CHARSET_INFO *all_charsets[256];
+extern my_bool init_compiled_charsets(myf flags);
-#define MY_CHARSET_UNDEFINED 0
-#define MY_CHARSET_CURRENT (default_charset_info->number)
/* 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);
+extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
+extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, const uchar *, uint);
+
+extern uint my_hash_caseup_simple(CHARSET_INFO *cs,
+ const byte *key, uint len);
+
+extern void my_hash_sort_simple(CHARSET_INFO *cs,
+ const uchar *key, uint len,
+ ulong *nr1, ulong *nr2);
+
/* 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 void my_tosort_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);
@@ -151,185 +158,6 @@ 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 */
@@ -364,7 +192,7 @@ void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, u
#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 use_strnxfrm(s) ((s)->strnxfrm != 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) \
@@ -377,6 +205,7 @@ void my_hash_sort_ucs2(struct charset_info_st *cs, const uchar *key, uint len, u
#define my_caseup(s, a, l) ((s)->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->casedn((s), (a), (l)))
+#define my_tosort(s, a, l) ((s)->tosort((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)))
diff --git a/include/my_sys.h b/include/my_sys.h
index 7ceb40e9e06..6545077df72 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -583,7 +583,6 @@ extern void allow_break(void);
#endif
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
-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))
@@ -608,8 +607,6 @@ 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 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);
diff --git a/isam/_key.c b/isam/_key.c
index 0bedb428808..002ad480c56 100644
--- a/isam/_key.c
+++ b/isam/_key.c
@@ -54,11 +54,11 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
*key++= (uchar) (length=(uint) (end-pos));
memcpy((byte*) key,(byte*) pos,(size_t) length);
#ifdef USE_STRCOLL
- if (!use_strcoll(default_charset_info))
+ if (!use_strnxfrm(default_charset_info))
#endif
{
if (type == HA_KEYTYPE_TEXT)
- case_sort(default_charset_info,(byte*) key,length);
+ my_tosort(default_charset_info,(byte*) key,length);
}
key+=length;
}
@@ -67,11 +67,11 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
memcpy((byte*) key,(byte*) record+keyseg->base.start,
(size_t) keyseg->base.length);
#ifdef USE_STRCOLL
- if (!use_strcoll(default_charset_info))
+ if (!use_strnxfrm(default_charset_info))
#endif
{
if (type == HA_KEYTYPE_TEXT)
- case_sort(default_charset_info,(byte*) key,(uint) keyseg->base.length);
+ my_tosort(default_charset_info,(byte*) key,(uint) keyseg->base.length);
}
#ifdef NAN_TEST
else if (type == HA_KEYTYPE_FLOAT)
@@ -150,11 +150,11 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old,
else
memcpy((byte*) key,old,(size_t) length);
#ifdef USE_STRCOLL
- if (!use_strcoll(default_charset_info))
+ if (!use_strnxfrm(default_charset_info))
#endif
{
if (type == HA_KEYTYPE_TEXT)
- case_sort(default_charset_info,(byte*) key,length);
+ my_tosort(default_charset_info,(byte*) key,length);
}
key+= length;
}
diff --git a/isam/_search.c b/isam/_search.c
index d76a8ce3097..445340a21d6 100644
--- a/isam/_search.c
+++ b/isam/_search.c
@@ -332,7 +332,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
end= a+ min(key_length,(uint) length);
#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info)) {
+ if (use_strnxfrm(default_charset_info)) {
if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY)
{
while (a < end)
@@ -383,7 +383,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
else
{
#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info)) {
+ if (use_strnxfrm(default_charset_info)) {
if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY)
{
while (a < end)
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 0f7cb713d54..26262d9e618 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -49,7 +49,7 @@ dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
mysysheaders = mysys_priv.h my_static.h
mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
- mf_casecnv.lo my_read.lo my_write.lo errors.lo \
+ my_read.lo my_write.lo errors.lo \
my_error.lo my_getwd.lo my_div.lo \
mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\
mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
diff --git a/myisam/ft_static.c b/myisam/ft_static.c
index 0b22d296206..5c2629e9e9e 100644
--- a/myisam/ft_static.c
+++ b/myisam/ft_static.c
@@ -36,7 +36,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
HA_FT_WLEN, /* start */
#endif /* EVAL_RUN */
0, /* null_pos */
- NULL /* sort_order */
+ NULL /* charset */
},
#ifdef EVAL_RUN
{
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index b05a8175a6e..cd11f190d24 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -685,7 +685,7 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
keyinfo->get_key= _mi_get_pack_key;
if (keyinfo->seg[0].flag & HA_PACK_KEY)
{ /* Prefix compression */
- if (!keyinfo->seg->charset || use_strcoll(keyinfo->seg->charset) ||
+ if (!keyinfo->seg->charset || use_strnxfrm(keyinfo->seg->charset) ||
(keyinfo->seg->flag & HA_NULL_PART))
keyinfo->bin_search=_mi_seq_search;
else
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 46d1cd19142..737bb2fd5d3 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -1287,7 +1287,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if ((keyinfo->flag & HA_FULLTEXT) &&
((keyseg->type == HA_KEYTYPE_TEXT) ||
(keyseg->type == HA_KEYTYPE_VARTEXT)) &&
- !use_strcoll(keyseg->charset))
+ !use_strnxfrm(keyseg->charset))
sort_order=keyseg->charset->sort_order;
/* diff flag contains how many bytes is needed to pack key */
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c
index 2101c656324..682f946eba7 100644
--- a/myisam/mi_unique.c
+++ b/myisam/mi_unique.c
@@ -99,20 +99,9 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
end= pos+length;
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT)
{
- if (keyseg->charset->hash_sort)
- {
- ulong nr=1, nr2=4;
- keyseg->charset->hash_sort(keyseg->charset,(const uchar*)pos,length,&nr, &nr2);
- crc=nr;
- }
- else
- {
- uchar *sort_order=keyseg->charset->sort_order;
- while (pos != end)
- crc=((crc << 8) +
- (((uchar) sort_order[*(uchar*) pos++]))) +
- (crc >> (8*sizeof(ha_checksum)-8));
- }
+ ulong nr=1, nr2=4;
+ keyseg->charset->hash_sort(keyseg->charset,(const uchar*)pos,length,&nr, &nr2);
+ crc=nr;
}
else
while (pos != end)
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 2618741a520..b5b944583da 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -159,6 +159,23 @@ UNIQUE KEY `email` (`email`)
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT
+pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT
+pseudo FROM inscrit WHERE pseudo='joce');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY inscrit const PRIMARY PRIMARY 35 const 1
+4 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+2 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+3 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
+inscrit WHERE pseudo='joce');
+Subselect returns more than 1 field
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT * FROM inscrit WHERE
+pseudo='joce');
+Subselect returns more than 1 field
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
+pseudo
+joce
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
Subselect returns more than 1 record
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index c34332d6d90..120cbcbc05f 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -82,6 +82,16 @@ CREATE TABLE `inscrit` (
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT
+pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT
+pseudo FROM inscrit WHERE pseudo='joce');
+-- error 1239
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
+inscrit WHERE pseudo='joce');
+-- error 1239
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT * FROM inscrit WHERE
+pseudo='joce');
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
-- error 1240
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 8da25ad101a..192b5e7fe37 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -39,7 +39,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \
mf_pack.c mf_unixpath.c mf_strip.c \
- mf_casecnv.c mf_soundex.c mf_wcomp.c mf_wfile.c \
+ mf_soundex.c mf_wcomp.c mf_wfile.c \
mf_qsort.c mf_qsort2.c mf_sort.c \
ptr_cmp.c mf_radix.c queues.c \
tree.c list.c hash.c array.c string.c typelib.c \
diff --git a/mysys/charset.c b/mysys/charset.c
index 691a4233269..9c977c7d145 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -23,7 +23,6 @@
const char *charsets_dir = NULL;
static int charset_initialized=0;
-CHARSET_INFO all_charsets[256];
#define MAX_LINE 1024
@@ -111,17 +110,25 @@ static my_bool read_charset_index(myf myflags)
my_fclose(fb.f,myflags);
return TRUE;
}
-
- cs=&all_charsets[csnum];
- if (!(cs->name=
- (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags)))
+ if (all_charsets[csnum])
+ continue;
+
+ if (!(cs=(CHARSET_INFO*) my_once_alloc(sizeof(cs[0]),myflags)))
+ {
+ my_fclose(fb.f,myflags);
+ return TRUE;
+ }
+ bzero(cs,sizeof(cs[0]));
+
+ if (!(cs->name= (char*)my_once_alloc(length=(uint)strlen(buf)+1,myflags)))
{
my_fclose(fb.f,myflags);
return TRUE;
}
memcpy((char*)cs->name,buf,length);
cs->number=csnum;
+ all_charsets[csnum]=cs;
}
my_fclose(fb.f,myflags);
@@ -156,7 +163,7 @@ static my_bool init_available_charsets(myf myflags)
*/
if (!charset_initialized)
{
- CHARSET_INFO *cs;
+ CHARSET_INFO **cs;
/*
To make things thread safe we are not allowing other threads to interfere
while we may changing the cs_info_table
@@ -164,13 +171,13 @@ static my_bool init_available_charsets(myf myflags)
pthread_mutex_lock(&THR_LOCK_charset);
bzero(&all_charsets,sizeof(all_charsets));
+ init_compiled_charsets(myflags);
/* Copy compiled charsets */
-
- for (cs=compiled_charsets; cs->name; cs++)
+ for (cs=all_charsets; cs < all_charsets+255 ; cs++)
{
- all_charsets[cs->number]=cs[0];
- set_max_sort_char(&all_charsets[cs->number]);
+ if (*cs)
+ set_max_sort_char(*cs);
}
error = read_charset_index(myflags);
charset_initialized=1;
@@ -339,19 +346,16 @@ static my_bool read_charset_file(const char *cs_name, CHARSET_INFO *set,
}
-static CHARSET_INFO *add_charset(uint cs_number, myf flags)
+static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags)
{
- CHARSET_INFO *cs;
uchar tmp_ctype[CTYPE_TABLE_SIZE];
uchar tmp_to_lower[TO_LOWER_TABLE_SIZE];
uchar tmp_to_upper[TO_UPPER_TABLE_SIZE];
uchar tmp_sort_order[SORT_ORDER_TABLE_SIZE];
uint16 tmp_to_uni[TO_UNI_TABLE_SIZE];
- /* Note: cs->name is already initialized */
+ /* Note: cs->name and cs->number are already initialized */
- cs=&all_charsets[cs_number];
-
cs->ctype=tmp_ctype;
cs->to_lower=tmp_to_lower;
cs->to_upper=tmp_to_upper;
@@ -365,7 +369,6 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME));
cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME));
cs->tab_to_uni=(uint16*)my_once_alloc(TO_UNI_TABLE_SIZE*sizeof(uint16), MYF(MY_WME));
- cs->number = cs_number;
memcpy((char*) cs->ctype, (char*) tmp_ctype, sizeof(tmp_ctype));
memcpy((char*) cs->to_lower, (char*) tmp_to_lower, sizeof(tmp_to_lower));
memcpy((char*) cs->to_upper, (char*) tmp_to_upper, sizeof(tmp_to_upper));
@@ -373,14 +376,18 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
sizeof(tmp_sort_order));
memcpy((char*) cs->tab_to_uni, (char*) tmp_to_uni, sizeof(tmp_to_uni));
+ cs->strnncoll = my_strnncoll_simple;
cs->caseup_str = my_caseup_str_8bit;
cs->casedn_str = my_casedn_str_8bit;
cs->caseup = my_caseup_8bit;
cs->casedn = my_casedn_8bit;
+ cs->tosort = my_tosort_8bit;
cs->strcasecmp = my_strcasecmp_8bit;
cs->strncasecmp = my_strncasecmp_8bit;
cs->mb_wc = my_mb_wc_8bit;
cs->wc_mb = my_wc_mb_8bit;
+ cs->hash_caseup = my_hash_caseup_simple;
+ cs->hash_sort = my_hash_sort_simple;
set_max_sort_char(cs);
create_fromuni(cs);
@@ -391,13 +398,13 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags)
uint get_charset_number(const char *charset_name)
{
- CHARSET_INFO *cs;
+ CHARSET_INFO **cs;
if (init_available_charsets(MYF(0))) /* If it isn't initialized */
return 0;
for (cs = all_charsets; cs < all_charsets+255; ++cs)
- if ( cs->name && !strcmp(cs->name, charset_name))
- return cs->number;
+ if ( cs[0] && cs[0]->name && !strcmp(cs[0]->name, charset_name))
+ return cs[0]->number;
return 0; /* this mimics find_type() */
}
@@ -409,8 +416,8 @@ const char *get_charset_name(uint charset_number)
if (init_available_charsets(MYF(0))) /* If it isn't initialized */
return "?";
- cs=&all_charsets[charset_number];
- if ( (cs->number==charset_number) && cs->name )
+ cs=all_charsets[charset_number];
+ if ( cs && (cs->number==charset_number) && cs->name )
return (char*) cs->name;
return (char*) "?"; /* this mimics find_type() */
@@ -426,9 +433,9 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
*/
pthread_mutex_lock(&THR_LOCK_charset);
- cs = &all_charsets[cs_number];
- if (!(cs->state & (MY_CS_COMPILED | MY_CS_LOADED)))
- cs=add_charset(cs_number, flags);
+ cs = all_charsets[cs_number];
+ if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED)))
+ cs=add_charset(cs, flags);
pthread_mutex_unlock(&THR_LOCK_charset);
return cs;
@@ -550,38 +557,41 @@ char * list_charsets(myf want_flags)
if (want_flags & MY_CS_COMPILED)
{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
+ CHARSET_INFO **cs;
+ for (cs = all_charsets; cs < all_charsets+255; cs++)
{
- dynstr_append(&s, cs->name);
- dynstr_append(&s, " ");
+ if (cs[0])
+ {
+ dynstr_append(&s, cs[0]->name);
+ dynstr_append(&s, " ");
+ }
}
}
if (want_flags & MY_CS_CONFIG)
{
- CHARSET_INFO *cs;
+ CHARSET_INFO **cs;
char buf[FN_REFLEN];
MY_STAT status;
for (cs=all_charsets; cs < all_charsets+255; cs++)
{
- if (!cs->name || charset_in_string(cs->name, &s))
+ if (!cs[0] || !cs[0]->name || charset_in_string(cs[0]->name, &s))
continue;
- get_charset_conf_name(cs->name, buf);
+ get_charset_conf_name(cs[0]->name, buf);
if (!my_stat(buf, &status, MYF(0)))
continue; /* conf file doesn't exist */
- dynstr_append(&s, cs->name);
+ dynstr_append(&s, cs[0]->name);
dynstr_append(&s, " ");
}
}
if (want_flags & (MY_CS_INDEX|MY_CS_LOADED))
{
- CHARSET_INFO *cs;
+ CHARSET_INFO **cs;
for (cs = all_charsets; cs < all_charsets + 255; cs++)
- if (cs->name && (cs->state & want_flags) )
- charset_append(&s, cs->name);
+ if (cs[0] && cs[0]->name && (cs[0]->state & want_flags) )
+ charset_append(&s, cs[0]->name);
}
if (s.length)
diff --git a/mysys/hash.c b/mysys/hash.c
index 43e6981f79d..2ef17be5341 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -32,7 +32,6 @@
static uint hash_mask(uint hashnr,uint buffmax,uint maxlength);
static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
static uint calc_hashnr(CHARSET_INFO *cs,const byte *key,uint length);
-static uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key,uint length);
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length);
@@ -60,12 +59,7 @@ _hash_init(HASH *hash,CHARSET_INFO *charset,
hash->flags=flags;
hash->charset=charset;
if (flags & HASH_CASE_INSENSITIVE)
- {
- if (charset->hash_caseup)
- hash->calc_hashnr=charset->hash_caseup;
- else
- hash->calc_hashnr=calc_hashnr_caseup;
- }
+ hash->calc_hashnr=charset->hash_caseup;
else
hash->calc_hashnr=calc_hashnr;
DBUG_RETURN(0);
@@ -132,22 +126,6 @@ static uint calc_hashnr(CHARSET_INFO *cs __attribute__((unused)),
return((uint) nr);
}
- /* Calc hashvalue for a key, case indepenently */
-
-static uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key,uint length)
-{
- register uint nr=1, nr2=4;
- register uchar *map=cs->to_upper;
-
- while (length--)
- {
- nr^= (((nr & 63)+nr2)*
- ((uint) (uchar) map[(uchar)*key++])) + (nr << 8);
- nr2+=3;
- }
- return((uint) nr);
-}
-
#else
/*
@@ -175,18 +153,6 @@ uint calc_hashnr(CHARSET_INFO *cs, const byte *key, uint len)
return (hash);
}
-uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key, uint len)
-{
- const byte *end=key+len;
- uint hash;
- for (hash = 0; key < end; key++)
- {
- hash *= 16777619;
- hash ^= (uint) (uchar) my_toupper(cs,*key);
- }
- return (hash);
-}
-
#endif
diff --git a/mysys/mf_casecnv.c b/mysys/mf_casecnv.c
deleted file mode 100644
index 631db18b1ed..00000000000
--- a/mysys/mf_casecnv.c
+++ /dev/null
@@ -1,81 +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 */
-
-/*
- Functions to convert to lover_case and to upper_case in scandinavia.
-
- case_sort converts a character string to a representaion that can
- be compared by strcmp to find with is alfabetical bigger.
- (lower- and uppercase letters is compared as the same)
-*/
-
-#include "mysys_priv.h"
-#include <m_ctype.h>
-#ifndef SCO
-#include <m_string.h>
-#endif
-
-
- /* to sort-string that can be compared to get text in order */
-
-void case_sort(CHARSET_INFO *cs, my_string str, uint length)
-{
- register uchar *map=cs->sort_order;
-
- for ( ; length>0 ; length--, str++)
- *str= (char) map[(uchar) *str];
-} /* case_sort */
-
-
-int my_sortcmp(CHARSET_INFO *cs, const char *s, const char *t, uint len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(cs))
- return my_strnncoll(cs,(uchar *)s, len, (uchar *)t, len);
- else
-#endif
- {
- register uchar *map=cs->sort_order;
- while (len--)
- {
- if (map[(uchar) *s++] != map[(uchar) *t++])
- return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]);
- }
- return 0;
- }
-}
-
-int my_sortncmp(CHARSET_INFO *cs,
- const char *s, uint s_len,
- const char *t, uint t_len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(cs))
- return my_strnncoll(cs, (uchar *)s, s_len, (uchar *)t, t_len);
- else
-#endif
- {
- uint len= min(s_len,t_len);
- register uchar *map=cs->sort_order;
-
- while (len--)
- {
- if (map[(uchar) *s++] != map[(uchar) *t++])
- return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]);
- }
- return (int) (s_len - t_len);
- }
-}
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index fe610b73fe9..2d51ab13f69 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -20,28 +20,9 @@
int mi_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
uchar *b, uint b_length, my_bool part_key)
{
- int flag;
-
-#ifdef USE_STRCOLL
- if (use_strcoll(charset_info))
- {
- if (part_key && b_length < a_length)
- a_length=b_length;
- return my_strnncoll(charset_info, a, a_length, b, b_length);
- }
- else
-#endif
- {
- uint length= min(a_length,b_length);
- uchar *end= a+ length;
- uchar *sort_order=charset_info->sort_order;
- while (a < end)
- if ((flag= (int) sort_order[*a++] - (int) sort_order[*b++]))
- return flag;
- }
if (part_key && b_length < a_length)
- return 0;
- return (int) (a_length-b_length);
+ a_length=b_length;
+ return my_strnncoll(charset_info, a, a_length, b, b_length);
}
static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
diff --git a/sql/field.cc b/sql/field.cc
index 336bc9d7cc2..cdbe05669d0 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3831,7 +3831,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
if (binary_flag)
return memcmp(a_ptr,b_ptr,field_length);
else
- return my_sortcmp(field_charset,a_ptr,b_ptr,field_length);
+ return my_strnncoll(field_charset,
+ (const uchar*)a_ptr,field_length,
+ (const uchar*)b_ptr,field_length);
}
void Field_string::sort_string(char *to,uint length)
@@ -3841,7 +3843,7 @@ void Field_string::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
- if (use_strcoll(field_charset)) {
+ if (use_strnxfrm(field_charset)) {
uint tmp=my_strnxfrm(field_charset,
(unsigned char *)to, length,
(unsigned char *) ptr, field_length);
@@ -3907,7 +3909,9 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, a,a_length, b,b_length);
+ return my_strnncoll(field_charset,
+ (const uchar*)a,a_length,
+ (const uchar*)b,b_length);
}
@@ -3924,7 +3928,9 @@ int Field_string::pack_cmp(const char *b, uint length)
int cmp= memcmp(ptr,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, ptr,a_length, b, b_length);
+ return my_strnncoll(field_charset,
+ (const uchar*)ptr,a_length,
+ (const uchar*)b, b_length);
}
@@ -4033,7 +4039,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
if (binary_flag)
diff=memcmp(a_ptr+2,b_ptr+2,min(a_length,b_length));
else
- diff=my_sortcmp(field_charset, a_ptr+2,b_ptr+2,min(a_length,b_length));
+ diff=my_strnncoll(field_charset,
+ (const uchar*)a_ptr+2,min(a_length,b_length),
+ (const uchar*)b_ptr+2,min(a_length,b_length));
return diff ? diff : (int) (a_length - b_length);
}
@@ -4045,7 +4053,7 @@ void Field_varstring::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
- if (use_strcoll(field_charset))
+ if (use_strnxfrm(field_charset))
tot_length=my_strnxfrm(field_charset,
(unsigned char *) to, length,
(unsigned char *)ptr+2, tot_length);
@@ -4134,7 +4142,9 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length)
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, a,a_length, b,b_length);
+ return my_strnncoll(field_charset,
+ (const uchar *)a,a_length,
+ (const uchar *)b,b_length);
}
int Field_varstring::pack_cmp(const char *b, uint key_length)
@@ -4155,7 +4165,9 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, a,a_length, b,b_length);
+ return my_strnncoll(field_charset,
+ (const uchar *)a,a_length,
+ (const uchar *)b,b_length);
}
uint Field_varstring::packed_col_length(const char *ptr, uint length)
@@ -4382,7 +4394,9 @@ int Field_blob::cmp(const char *a,uint32 a_length, const char *b,
if (binary_flag)
diff=memcmp(a,b,min(a_length,b_length));
else
- diff=my_sortcmp(field_charset, a,b,min(a_length,b_length));
+ diff=my_strnncoll(field_charset,
+ (const uchar*)a,min(a_length,b_length),
+ (const uchar*)b,min(a_length,b_length));
return diff ? diff : (int) (a_length - b_length);
}
@@ -4536,7 +4550,7 @@ void Field_blob::sort_string(char *to,uint length)
else
{
#ifdef USE_STRCOLL
- if (use_strcoll(field_charset))
+ if (use_strnxfrm(field_charset))
{
blob_length=my_strnxfrm(field_charset,
(unsigned char *)to, length,
@@ -4631,7 +4645,9 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, a,a_length, b,b_length);
+ return my_strnncoll(field_charset,
+ (const uchar *)a,a_length,
+ (const uchar *)b,b_length);
}
@@ -4657,7 +4673,9 @@ int Field_blob::pack_cmp(const char *b, uint key_length)
int cmp= memcmp(a,b,min(a_length,b_length));
return cmp ? cmp : (int) (a_length - b_length);
}
- return my_sortncmp(field_charset, a,a_length, b,b_length);
+ return my_strnncoll(field_charset,
+ (const uchar *)a,a_length,
+ (const uchar *)b,b_length);
}
/* Create a packed key that will be used for storage from a MySQL row */
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 4d877c92dba..81629684a87 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -140,7 +140,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
records=param.max_rows; /* purecov: inspected */
#ifdef USE_STRCOLL
- if (use_strcoll(charset) &&
+ if (use_strnxfrm(charset) &&
!(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME))))
goto err;
#endif
@@ -511,7 +511,7 @@ static void make_sortkey(register SORTPARAM *param,
length=sort_field->length;
}
#ifdef USE_STRCOLL
- if(use_strcoll(cs))
+ if(use_strnxfrm(cs))
{
if (item->binary)
{
@@ -541,7 +541,7 @@ static void make_sortkey(register SORTPARAM *param,
memcpy(to,res->ptr(),length);
bzero((char *)to+length,diff);
if (!item->binary)
- case_sort(cs, (char*) to,length);
+ my_tosort(cs, (char*) to,length);
#ifdef USE_STRCOLL
}
#endif
@@ -946,7 +946,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if (!sortorder->field->binary())
{
CHARSET_INFO *cs=((Field_str*)(sortorder->field))->charset();
- if (use_strcoll(cs))
+ if (use_strnxfrm(cs))
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
#endif
@@ -966,7 +966,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if (!sortorder->item->binary)
{
CHARSET_INFO *cs=sortorder->item->str_value.charset();
- if (use_strcoll(cs))
+ if (use_strnxfrm(cs))
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
#endif
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 824169467af..f75f431ad52 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -1366,9 +1366,9 @@ innobase_mysql_cmp(
case FIELD_TYPE_VAR_STRING:
// BAR TODO: Discuss with heikki.tuuri@innodb.com
// so that he sends CHARSET_INFO for the field to this function.
- ret = my_sortncmp(default_charset_info,
- (const char*) a, a_length,
- (const char*) b, b_length);
+ ret = my_strnncoll(default_charset_info,
+ a, a_length,
+ b, b_length);
if (ret < 0) {
return(-1);
} else if (ret > 0) {
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e8ee6a780ea..de9c7e11313 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -32,11 +32,22 @@ SUBSELECT TODO:
#include "mysql_priv.h"
#include "sql_select.h"
-Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex,
- select_subselect *result):
+Item_subselect::Item_subselect():
Item(), engine_owner(1), value_assigned(0)
{
- DBUG_ENTER("Item_subselect::Item_subselect");
+ assign_null();
+ /*
+ item value is NULL if select_subselect not changed this value
+ (i.e. some rows will be found returned)
+ */
+ null_value= 1;
+}
+
+void Item_subselect::init(THD *thd, st_select_lex *select_lex,
+ select_subselect *result)
+{
+
+ DBUG_ENTER("Item_subselect::init");
DBUG_PRINT("subs", ("select_lex 0x%xl", (long) select_lex));
if (select_lex->next_select())
@@ -45,12 +56,6 @@ Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex,
else
engine= new subselect_single_select_engine(thd, select_lex, result,
this);
- assign_null();
- /*
- item value is NULL if select_subselect not changed this value
- (i.e. some rows will be found returned)
- */
- null_value= 1;
DBUG_VOID_RETURN;
}
@@ -76,15 +81,17 @@ void Item_subselect::make_field (Send_field *tmp_field)
bool Item_subselect::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
- // Is it one field subselect?
- if (engine->cols() > max_columns)
- {
- my_message(ER_SUBSELECT_NO_1_COL, ER(ER_SUBSELECT_NO_1_COL), MYF(0));
- return 1;
- }
int res= engine->prepare();
if (!res)
+ {
+ // Is it one field subselect?
+ if (engine->cols() > max_columns)
+ {
+ my_message(ER_SUBSELECT_NO_1_COL, ER(ER_SUBSELECT_NO_1_COL), MYF(0));
+ return 1;
+ }
fix_length_and_dec();
+ }
return res;
}
@@ -100,8 +107,9 @@ inline table_map Item_subselect::used_tables() const
Item_singleval_subselect::Item_singleval_subselect(THD *thd,
st_select_lex *select_lex):
- Item_subselect(thd, select_lex, new select_singleval_subselect(this))
+ Item_subselect()
{
+ init(thd, select_lex, new select_singleval_subselect(this));
max_columns= 1;
maybe_null= 1;
}
@@ -144,13 +152,16 @@ String *Item_singleval_subselect::val_str (String *str)
assign_null();
return 0;
}
+ // Assign temporary buffer with stored value
+ str_value.set(string_value, 0, string_value.length());
return &str_value;
}
Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex):
- Item_subselect(thd, select_lex, new select_exists_subselect(this))
+ Item_subselect()
{
+ init(thd, select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
null_value= 0; //can't be NULL
maybe_null= 0; //can't be NULL
@@ -201,7 +212,7 @@ subselect_single_select_engine::subselect_single_select_engine(THD *thd,
select_subselect *result,
Item_subselect *item):
subselect_engine(thd, item, result),
- executed(0), optimized(0)
+ prepared(0), optimized(0), executed(0)
{
select_lex= select;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
@@ -240,6 +251,9 @@ subselect_union_engine::subselect_union_engine(THD *thd,
int subselect_single_select_engine::prepare()
{
+ if (prepared)
+ return 0;
+ prepared= 1;
SELECT_LEX *save_select= thd->lex.select;
thd->lex.select= select_lex;
if(join->prepare((TABLE_LIST*) select_lex->table_list.first,
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 92839eb0e5f..33f82982708 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -39,8 +39,7 @@ protected:
uint max_columns;
public:
- Item_subselect(THD *thd, st_select_lex *select_lex,
- select_subselect* result);
+ Item_subselect();
Item_subselect(Item_subselect *item)
{
null_value= item->null_value;
@@ -50,6 +49,14 @@ public:
engine_owner= 0;
name= item->name;
}
+
+ /*
+ We need this method, because some compilers do not allow 'this'
+ pointer in constructor initialization list, but we need pass pointer
+ to subselect Item class to select_subselect classes constructor.
+ */
+ void init (THD *thd, st_select_lex *select_lex, select_subselect *result);
+
~Item_subselect();
virtual void assign_null()
{
@@ -73,10 +80,16 @@ public:
class Item_singleval_subselect :public Item_subselect
{
protected:
- longlong int_value; /* here stored integer value of this item */
- double real_value; /* here stored real value of this item */
+ longlong int_value; /* Here stored integer value of this item */
+ double real_value; /* Here stored real value of this item */
+ /*
+ Here stored string value of this item.
+ (str_value used only as temporary buffer, because it can be changed
+ by Item::save_field)
+ */
+ String string_value;
enum Item_result res_type; /* type of results */
-
+
public:
Item_singleval_subselect(THD *thd, st_select_lex *select_lex);
Item_singleval_subselect(Item_singleval_subselect *item):
@@ -84,6 +97,7 @@ public:
{
int_value= item->int_value;
real_value= item->real_value;
+ string_value.set(item->string_value, 0, item->string_value.length());
max_length= item->max_length;
decimals= item->decimals;
res_type= item->res_type;
@@ -165,8 +179,9 @@ public:
class subselect_single_select_engine: public subselect_engine
{
- my_bool executed; /* simple subselect is executed */
+ my_bool prepared; /* simple subselect is prepared */
my_bool optimized; /* simple subselect is optimized */
+ my_bool executed; /* simple subselect is executed */
st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */
public:
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 93ced79005f..4d25098bb88 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -866,7 +866,9 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
static int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
{
/* BAR TODO: remove default_charset_info */
- return my_sortcmp(default_charset_info,(char*) key1, (char*) key2, *(uint*) arg);
+ return my_strnncoll(default_charset_info,
+ (const uchar*) key1, *(uint*) arg,
+ (const uchar*) key2, *(uint*) arg);
}
/*
diff --git a/sql/key.cc b/sql/key.cc
index fa09a0a6d44..84669808b92 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -193,8 +193,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
FIELDFLAG_PACK)))
{
/* BAR TODO: I'm not sure this should be system_charset_info */
- if (my_sortcmp(system_charset_info,(char*) key,
- (char*) table->record[0]+key_part->offset,length))
+ if (my_strnncoll(system_charset_info,
+ (const uchar*) key, length,
+ (const uchar*) table->record[0]+key_part->offset,length))
return 1;
}
else if (memcmp(key,table->record[0]+key_part->offset,length))
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ed5b2b0a230..2b0ac08fe95 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -978,7 +978,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
{
CHARSET_INFO *charset=((Field_str*)(field))->charset();
#ifdef USE_STRCOLL
- if (use_strcoll(charset))
+ if (use_strnxfrm(charset))
like_error= my_like_range(charset,
res->ptr(),res->length(),wild_prefix,
field_length, min_str+maybe_null,
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 648e05c1610..f778a721f54 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -884,9 +884,14 @@ bool select_singleval_subselect::send_data(List<Item> &items)
it->decimals= val_item->decimals;
it->binary= val_item->binary;
it->int_value= val_item->val_int();
- String *s= val_item->val_str(&it->str_value);
- if (s != &it->str_value)
- it->str_value.set(*s, 0, s->length());
+ String *s= val_item->val_str(&it->string_value);
+ if (s != &it->string_value)
+ {
+ it->string_value.set(*s, 0, s->length());
+ }
+ // TODO: remove when correct charset handling appeared for Item
+ it->str_value.set(*s, 0, s->length()); // store charset
+
it->res_type= val_item->result_type();
}
it->assigned(1);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 122ceeedc54..46206079084 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -944,7 +944,7 @@ void st_select_lex_unit::init_query()
global_parameters= this;
select_limit_cnt= HA_POS_ERROR;
offset_limit_cnt= 0;
- optimized= 0;
+ prepared= optimized= 0;
item= 0;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 16c45c8300e..f301e4c8af0 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -227,6 +227,7 @@ protected:
select_result *result;
int res;
bool describe, found_rows_for_union,
+ prepared, //prepare phase already performed for UNION (unit)
optimized; // optimize phase already performed for UNION (unit)
public:
/*
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 8c4c104d180..d6fe2f3772a 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1402,7 +1402,7 @@ int mysqld_show_charsets(THD *thd, const char *wild)
String packet2(buff,sizeof(buff),default_charset_info);
List<Item> field_list;
CONVERT *convert=thd->variables.convert_set;
- CHARSET_INFO *cs;
+ CHARSET_INFO **cs;
DBUG_ENTER("mysqld_show_charsets");
field_list.push_back(new Item_empty_string("Name",30));
@@ -1415,16 +1415,16 @@ int mysqld_show_charsets(THD *thd, const char *wild)
for (cs=all_charsets ; cs < all_charsets+255 ; cs++ )
{
- if (!cs->name)
+ if (!cs[0])
continue;
if (!(wild && wild[0] &&
- wild_case_compare(system_charset_info,cs->name,wild)))
+ wild_case_compare(system_charset_info,cs[0]->name,wild)))
{
packet2.length(0);
- net_store_data(&packet2,convert,cs->name);
- net_store_data(&packet2,(uint32) cs->number);
- net_store_data(&packet2,(uint32) cs->strxfrm_multiply);
- net_store_data(&packet2,(uint32) (cs->mbmaxlen ? cs->mbmaxlen : 1));
+ net_store_data(&packet2,convert,cs[0]->name);
+ net_store_data(&packet2,(uint32) cs[0]->number);
+ net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply);
+ net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen ? cs[0]->mbmaxlen : 1));
if (my_net_write(&thd->net, (char*) packet2.ptr(),packet2.length()))
goto err;
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 6a42078cbcd..d2d14d4e7a2 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -505,7 +505,7 @@ int sortcmp(const String *x,const String *y)
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
#ifdef USE_STRCOLL
- if (use_strcoll(x->str_charset))
+ if (use_strnxfrm(x->str_charset))
{
#ifndef CMP_ENDSPACE
while (x_len && my_isspace(x->str_charset,s[x_len-1]))
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index c2ef25ce6a1..01b0eb9e6ec 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -104,11 +104,16 @@ bool select_union::flush()
typedef JOIN * JOIN_P;
int st_select_lex_unit::prepare(THD *thd, select_result *result)
{
+ DBUG_ENTER("st_select_lex_unit::prepare");
+
+ if (prepared)
+ DBUG_RETURN(0);
+ prepared= 1;
+
describe=(first_select()->options & SELECT_DESCRIBE) ? 1 : 0;
res= 0;
found_rows_for_union= false;
TMP_TABLE_PARAM tmp_table_param;
- DBUG_ENTER("st_select_lex_unit::prepare");
this->thd= thd;
this->result= result;
SELECT_LEX *lex_select_save= thd->lex.select, *sl;
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 36a2641d2ab..b9011ac12aa 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -48,7 +48,7 @@
#define big5head(e) ((uchar)(e>>8))
#define big5tail(e) ((uchar)(e&0xff))
-uchar NEAR ctype_big5[257] =
+static uchar NEAR ctype_big5[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -69,7 +69,7 @@ uchar NEAR ctype_big5[257] =
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
-uchar NEAR to_lower_big5[]=
+static uchar NEAR to_lower_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_big5[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR to_upper_big5[]=
+static uchar NEAR to_upper_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_big5[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR sort_order_big5[]=
+static uchar NEAR sort_order_big5[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -218,7 +218,7 @@ static uint16 big5strokexfrm(uint16 i)
return 0xA140;
}
-int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1,
const uchar * s2, uint len2)
{
@@ -242,7 +242,7 @@ int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
return (int) (len1-len2);
}
-int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
@@ -264,7 +264,8 @@ int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
return srclen;
}
-int my_strcoll_big5(const uchar * s1, const uchar * s2)
+#if 0
+static int my_strcoll_big5(const uchar * s1, const uchar * s2)
{
while (*s1 && *s2)
@@ -283,7 +284,7 @@ int my_strcoll_big5(const uchar * s1, const uchar * s2)
return 0;
}
-int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
+static int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
{
uint16 e;
uchar *d = dest;
@@ -309,6 +310,8 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
*d = '\0';
return (int) (d-dest);
}
+#endif
+
/*
** Calculate min_str and max_str that ranges a LIKE string.
@@ -331,7 +334,7 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
#define wild_one '_'
#define wild_many '%'
-my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length)
@@ -381,18 +384,18 @@ my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
return 0;
}
-int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0);
}
-my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
+static my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
{
return isbig5head(c);
}
-int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
+static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
{
return (isbig5head(c)? 2: 0);
}
@@ -6166,7 +6169,7 @@ static int func_uni_big5_onechar(int code){
}
-int
+static int
my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, unsigned char *s, unsigned char *e)
{
@@ -6191,7 +6194,7 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
-int
+static int
my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc,const uchar *s,const uchar *e)
{
@@ -6213,5 +6216,39 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
+CHARSET_INFO my_charset_big5 =
+{
+ 1, /* number */
+ MY_CS_COMPILED, /* state */
+ "big5", /* name */
+ "", /* comment */
+ ctype_big5,
+ to_lower_big5,
+ to_upper_big5,
+ sort_order_big5,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 1, /* strxfrm_multiply */
+ my_strnncoll_big5,
+ my_strnxfrm_big5,
+ my_like_range_big5,
+ 2, /* mbmaxlen */
+ ismbchar_big5,
+ ismbhead_big5,
+ mbcharlen_big5,
+ my_mb_wc_big5, /* mb_wc */
+ my_wc_mb_big5, /* wc_mb */
+ my_caseup_str_mb,
+ my_casedn_str_mb,
+ my_caseup_mb,
+ my_casedn_mb,
+ NULL, /* tosort */
+ my_strcasecmp_mb,
+ my_strncasecmp_mb,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
#endif
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index f3b7777a6d4..e6cab722a8e 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -233,8 +233,9 @@ static struct wordvalue doubles[] = {
#define IS_END(p, src, len) (!(*p))
+#if 0
/* Function strcoll, with Czech sorting, for zero terminated strings */
-int my_strcoll_czech(const uchar * s1, const uchar * s2)
+static int my_strcoll_czech(const uchar * s1, const uchar * s2)
{
int v1, v2;
const uchar * p1, * p2, * store1, * store2;
@@ -254,9 +255,11 @@ int my_strcoll_czech(const uchar * s1, const uchar * s2)
while (v1);
return 0;
}
+#endif
+#if 0
/* Function strxfrm, with Czech sorting, for zero terminated strings */
-int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
+static int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
{
int value;
const uchar * p, * store;
@@ -272,17 +275,16 @@ int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
while (value);
return totlen;
}
-
-#undef IS_END
-
+#endif
+#undef IS_END
#define IS_END(p, src, len) (((char *)p - (char *)src) >= (len))
/* Function strnncoll, actually strcoll, with Czech sorting, which expect
the length of the strings being specified */
-int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1,
const uchar * s2, uint len2)
{
@@ -308,7 +310,7 @@ int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
/* Function strnxfrm, actually strxfrm, with Czech sorting, which expect
the length of the strings being specified */
-int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
@@ -378,7 +380,7 @@ int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
#define EXAMPLE
-my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length)
@@ -437,7 +439,7 @@ my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
#include <my_global.h>
#include "m_string.h"
-uchar NEAR ctype_czech[257] = {
+static uchar NEAR ctype_czech[257] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -457,7 +459,7 @@ uchar NEAR ctype_czech[257] = {
2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 16,
};
-uchar NEAR to_lower_czech[] = {
+static uchar NEAR to_lower_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -476,7 +478,7 @@ uchar NEAR to_lower_czech[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
};
-uchar NEAR to_upper_czech[] = {
+static uchar NEAR to_upper_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -495,7 +497,7 @@ uchar NEAR to_upper_czech[] = {
240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255,
};
-uchar NEAR sort_order_czech[] = {
+static uchar NEAR sort_order_czech[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -514,6 +516,118 @@ uchar NEAR sort_order_czech[] = {
255, 98, 99,101,102,103,104,255,109,119,118,120,121,126,116,255,
};
+static uint16 tab_8859_2_uni[256]={
+ 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
+0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
+0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
+0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
+0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
+0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
+0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
+0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
+0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
+0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
+0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
+0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
+};
+
+
+/* 0000-00FD , 254 chars */
+static uchar tab_uni_8859_2_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0x00,0x00,0x00,0xA4,0x00,0x00,0xA7,0xA8,0x00,0x00,0x00,0x00,0xAD,0x00,0x00,
+0xB0,0x00,0x00,0x00,0xB4,0x00,0x00,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00,
+0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF,
+0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00,
+0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD};
+
+/* 0102-017E , 125 chars */
+static uchar tab_uni_8859_2_plane01[]={
+0xC3,0xE3,0xA1,0xB1,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0,
+0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xA5,0xB5,0x00,0x00,0xA3,
+0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5,
+0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0xA6,0xB6,0x00,0x00,0xAA,0xBA,0xA9,0xB9,
+0xDE,0xFE,0xAB,0xBB,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xBC,0xAF,0xBF,0xAE,0xBE};
+
+/* 02C7-02DD , 23 chars */
+static uchar tab_uni_8859_2_plane02[]={
+0xB7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD};
+
+static MY_UNI_IDX idx_uni_8859_2[]={
+ {0x0000,0x00FD,tab_uni_8859_2_plane00},
+ {0x0102,0x017E,tab_uni_8859_2_plane01},
+ {0x02C7,0x02DD,tab_uni_8859_2_plane02},
+ {0,0,NULL}
+};
+
+CHARSET_INFO my_charset_czech =
+{
+ 2, /* number */
+ MY_CS_COMPILED, /* state */
+ "czech", /* name */
+ "", /* comment */
+ ctype_czech,
+ to_lower_czech,
+ to_upper_czech,
+ sort_order_czech,
+ tab_8859_2_uni, /* tab_to_uni */
+ idx_uni_8859_2, /* tab_from_uni */
+ 4, /* strxfrm_multiply */
+ my_strnncoll_czech,
+ my_strnxfrm_czech,
+ my_like_range_czech,
+ 0, /* mbmaxlen */
+ NULL, /* ismbchar */
+ NULL, /* ismbhead */
+ NULL, /* mbcharlen */
+ my_mb_wc_8bit, /* mb_wc */
+ my_wc_mb_8bit, /* wc_mb */
+ my_caseup_str_8bit,
+ my_casedn_str_8bit,
+ my_caseup_8bit,
+ my_casedn_8bit,
+ NULL, /* tosort */
+ my_strcasecmp_8bit,
+ my_strncasecmp_8bit,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
#endif
#endif
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index 736a06f8139..a7d6044b378 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CHARSET_euc_kr
-uchar NEAR ctype_euc_kr[257] =
+static uchar NEAR ctype_euc_kr[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -70,7 +70,7 @@ uchar NEAR ctype_euc_kr[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
-uchar NEAR to_lower_euc_kr[]=
+static uchar NEAR to_lower_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -106,7 +106,7 @@ uchar NEAR to_lower_euc_kr[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR to_upper_euc_kr[]=
+static uchar NEAR to_upper_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -142,7 +142,7 @@ uchar NEAR to_upper_euc_kr[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR sort_order_euc_kr[]=
+static uchar NEAR sort_order_euc_kr[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -183,7 +183,7 @@ uchar NEAR sort_order_euc_kr[]=
#define iseuc_kr(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe))
-int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return ((*(uchar*)(p)<0x80)? 0:\
@@ -191,12 +191,12 @@ int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
0);
}
-my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (iseuc_kr(c));
}
-int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (iseuc_kr(c) ? 2 : 0);
}
@@ -8587,7 +8587,7 @@ static int func_uni_ksc5601_onechar(int code){
}
-int
+static int
my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e)
{
@@ -8611,7 +8611,7 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
-int
+static int
my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
{
@@ -8633,5 +8633,38 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
+CHARSET_INFO my_charset_euc_kr =
+{
+ 19, /* number */
+ MY_CS_COMPILED, /* state */
+ "euc_kr", /* name */
+ "", /* comment */
+ ctype_euc_kr,
+ to_lower_euc_kr,
+ to_upper_euc_kr,
+ sort_order_euc_kr,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 0, /* strxfrm_multiply */
+ my_strnncoll_simple,/* strnncoll */
+ NULL, /* strnxfrm */
+ NULL, /* like_range */
+ 2, /* mbmaxlen */
+ ismbchar_euc_kr,
+ ismbhead_euc_kr,
+ mbcharlen_euc_kr,
+ my_mb_wc_euc_kr, /* mb_wc */
+ my_wc_mb_euc_kr, /* wc_mb */
+ my_caseup_str_mb,
+ my_casedn_str_mb,
+ my_caseup_mb,
+ my_casedn_mb,
+ my_tosort_8bit,
+ my_strcasecmp_mb,
+ my_strncasecmp_mb,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
#endif
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 7da86915fbd..e931c7c1f31 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -30,7 +30,7 @@
#ifdef HAVE_CHARSET_gb2312
-uchar NEAR ctype_gb2312[257] =
+static uchar NEAR ctype_gb2312[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -51,7 +51,7 @@ uchar NEAR ctype_gb2312[257] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
};
-uchar NEAR to_lower_gb2312[]=
+static uchar NEAR to_lower_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -87,7 +87,7 @@ uchar NEAR to_lower_gb2312[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR to_upper_gb2312[]=
+static uchar NEAR to_upper_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -123,7 +123,7 @@ uchar NEAR to_upper_gb2312[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR sort_order_gb2312[]=
+static uchar NEAR sort_order_gb2312[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -166,18 +166,18 @@ uchar NEAR sort_order_gb2312[]=
#define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)
-int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0);
}
-my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return isgb2312head(c);
}
-int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isgb2312head(c)? 2:0);
}
@@ -5637,7 +5637,7 @@ static int func_uni_gb2312_onechar(int code){
}
-int
+static int
my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e)
{
@@ -5661,7 +5661,7 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
-int
+static int
my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
int hi;
@@ -5683,5 +5683,38 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
+CHARSET_INFO my_charset_gb2312 =
+{
+ 24, /* number */
+ MY_CS_COMPILED, /* state */
+ "gb2312", /* name */
+ "", /* comment */
+ ctype_gb2312,
+ to_lower_gb2312,
+ to_upper_gb2312,
+ sort_order_gb2312,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 0, /* strxfrm_multiply */
+ my_strnncoll_simple,/* strnncoll */
+ NULL, /* strnxfrm */
+ NULL, /* like_range */
+ 2, /* mbmaxlen */
+ ismbchar_gb2312,
+ ismbhead_gb2312,
+ mbcharlen_gb2312,
+ my_mb_wc_gb2312, /* mb_wc */
+ my_wc_mb_gb2312, /* wc_mb */
+ my_caseup_str_mb,
+ my_casedn_str_mb,
+ my_caseup_mb,
+ my_casedn_mb,
+ my_tosort_8bit,
+ my_strcasecmp_mb,
+ my_strncasecmp_mb,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
#endif
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 79e74b5f434..0f2de81ccb6 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -45,7 +45,7 @@
#define gbkhead(e) ((uchar)(e>>8))
#define gbktail(e) ((uchar)(e&0xff))
-uchar NEAR ctype_gbk[257] =
+static uchar NEAR ctype_gbk[257] =
{
0, /* For standard library */
32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32,
@@ -66,7 +66,7 @@ uchar NEAR ctype_gbk[257] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,
};
-uchar NEAR to_lower_gbk[]=
+static uchar NEAR to_lower_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -102,7 +102,7 @@ uchar NEAR to_lower_gbk[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR to_upper_gbk[]=
+static uchar NEAR to_upper_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -138,7 +138,7 @@ uchar NEAR to_upper_gbk[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377',
};
-uchar NEAR sort_order_gbk[]=
+static uchar NEAR sort_order_gbk[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -9824,7 +9824,7 @@ static int func_uni_gbk_onechar(int code){
return(0);
}
-int
+static int
my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e)
{
@@ -9847,7 +9847,7 @@ my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
-int
+static int
my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
{
@@ -9871,4 +9871,39 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
}
+CHARSET_INFO my_charset_gbk =
+{
+ 28, /* number */
+ MY_CS_COMPILED, /* state */
+ "gbk", /* name */
+ "", /* comment */
+ ctype_gbk,
+ to_lower_gbk,
+ to_upper_gbk,
+ sort_order_gbk,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 1, /* strxfrm_multiply */
+ my_strnncoll_gbk,
+ my_strnxfrm_gbk,
+ my_like_range_gbk,
+ 2, /* mbmaxlen */
+ ismbchar_gbk,
+ ismbhead_gbk,
+ mbcharlen_gbk,
+ my_mb_wc_gbk, /* mb_wc */
+ my_wc_mb_gbk, /* wc_mb */
+ my_caseup_str_mb,
+ my_casedn_str_mb,
+ my_caseup_mb,
+ my_casedn_mb,
+ NULL, /* tosort */
+ my_strcasecmp_mb,
+ my_strncasecmp_mb,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
+
#endif
diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c
index 80fb259dfc8..040bd11b5e9 100644
--- a/strings/ctype-latin1_de.c
+++ b/strings/ctype-latin1_de.c
@@ -38,7 +38,65 @@
#ifdef HAVE_CHARSET_latin1_de
-uchar ctype_latin1_de[] = {
+static uint16 tab_8859_1_uni[256]={
+ 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
+0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
+0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
+0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
+0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
+0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
+0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
+0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
+0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
+0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
+0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
+0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
+};
+
+static uchar tab_uni_8859_1_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
+0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
+0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
+0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
+0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
+0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
+
+static MY_UNI_IDX idx_uni_8859_1[]={
+ {0x0000,0x00FF,tab_uni_8859_1_plane00},
+ {0,0,NULL}
+};
+
+static uchar ctype_latin1_de[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -58,7 +116,7 @@ uchar ctype_latin1_de[] = {
2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2
};
-uchar to_lower_latin1_de[] = {
+static uchar to_lower_latin1_de[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -77,7 +135,7 @@ uchar to_lower_latin1_de[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-uchar to_upper_latin1_de[] = {
+static uchar to_upper_latin1_de[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -104,7 +162,7 @@ uchar to_upper_latin1_de[] = {
* Ü, ü, Ö, ö, Ä, ä
*/
-uchar sort_order_latin1_de[] = {
+static uchar sort_order_latin1_de[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -164,7 +222,7 @@ uchar sort_order_latin1_de[] = {
}
-int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1,
const uchar * s2, uint len2)
{
@@ -238,7 +296,7 @@ int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
}
-int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen)
{
@@ -303,7 +361,7 @@ int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
#define wild_one '_'
#define wild_many '%'
-my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint ptr_length,
pchar escape, uint res_length,
char *min_str, char *max_str,
@@ -353,4 +411,39 @@ my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
return 0;
}
+
+CHARSET_INFO my_charset_latin1_de =
+{
+ 31, /* number */
+ MY_CS_COMPILED, /* state */
+ "latin1_de", /* name */
+ "", /* comment */
+ ctype_latin1_de,
+ to_lower_latin1_de,
+ to_upper_latin1_de,
+ sort_order_latin1_de,
+ tab_8859_1_uni, /* tab_to_uni */
+ idx_uni_8859_1, /* tab_from_uni */
+ 2, /* strxfrm_multiply */
+ my_strnncoll_latin1_de,
+ my_strnxfrm_latin1_de,
+ my_like_range_latin1_de,
+ 0, /* mbmaxlen */
+ NULL, /* ismbchar */
+ NULL, /* ismbhead */
+ NULL, /* mbcharlen */
+ my_mb_wc_8bit, /* mb_wc */
+ my_wc_mb_8bit, /* wc_mb */
+ my_caseup_str_8bit,
+ my_casedn_str_8bit,
+ my_caseup_8bit,
+ my_casedn_8bit,
+ NULL, /* tosort */
+ my_strcasecmp_8bit,
+ my_strncasecmp_8bit,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
#endif
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index f6c92edf1b8..f27b113376b 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -20,32 +20,30 @@
#include "assert.h"
int my_strnxfrm_simple(CHARSET_INFO * cs,
- char *dest, uint len,
- const char *src, uint srclen)
+ uchar *dest, uint len,
+ const uchar *src, uint srclen)
{
uchar *map= cs->sort_order;
DBUG_ASSERT(len >= srclen);
for ( ; len > 0 ; len-- )
- *dest++= (char) map[(uchar) *src++];
+ *dest++= map[*src++];
return srclen;
}
-int my_strnncoll_simple(CHARSET_INFO * cs, const char *s, uint slen,
- const char *t, uint tlen)
+int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen,
+ const uchar *t, uint tlen)
{
int len = ( slen > tlen ) ? tlen : slen;
uchar *map= cs->sort_order;
while (len--)
{
- if (map[(uchar) *s++] != map[(uchar) *t++])
- return ((int) map[(uchar) s[-1]] -
- (int) map[(uchar) t[-1]]);
+ if (map[*s++] != map[*t++])
+ return ((int) map[s[-1]] - (int) map[t[-1]]);
}
return (int) (slen-tlen);
}
-
void my_caseup_str_8bit(CHARSET_INFO * cs,char *str)
{
register uchar *map=cs->to_upper;
@@ -53,7 +51,6 @@ void my_caseup_str_8bit(CHARSET_INFO * cs,char *str)
str++;
}
-
void my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
{
register uchar *map=cs->to_lower;
@@ -61,7 +58,6 @@ void my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
str++;
}
-
void my_caseup_8bit(CHARSET_INFO * cs, char *str, uint length)
{
register uchar *map=cs->to_upper;
@@ -76,6 +72,12 @@ void my_casedn_8bit(CHARSET_INFO * cs, char *str, uint length)
*str= (char) map[(uchar) *str];
}
+void my_tosort_8bit(CHARSET_INFO *cs, char *str, uint length)
+{
+ register uchar *map=cs->sort_order;
+ for ( ; length>0 ; length--, str++)
+ *str= (char) map[(uchar) *str];
+}
int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t)
{
@@ -116,3 +118,56 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc,
}
return MY_CS_ILUNI;
}
+
+
+
+#ifndef NEW_HASH_FUNCTION
+
+ /* Calc hashvalue for a key, case indepenently */
+
+uint my_hash_caseup_simple(CHARSET_INFO *cs, const byte *key, uint length)
+{
+ register uint nr=1, nr2=4;
+ register uchar *map=cs->to_upper;
+
+ while (length--)
+ {
+ nr^= (((nr & 63)+nr2)*
+ ((uint) (uchar) map[(uchar)*key++])) + (nr << 8);
+ nr2+=3;
+ }
+ return((uint) nr);
+}
+
+#else
+
+uint my_hash_caseup_simple(CHARSET_INFO *cs, const byte *key, uint len)
+{
+ const byte *end=key+len;
+ uint hash;
+ for (hash = 0; key < end; key++)
+ {
+ hash *= 16777619;
+ hash ^= (uint) (uchar) my_toupper(cs,*key);
+ }
+ return (hash);
+}
+
+#endif
+
+void my_hash_sort_simple(CHARSET_INFO *cs,
+ const uchar *key, uint len,
+ ulong *nr1, ulong *nr2)
+{
+ register uchar *sort_order=cs->sort_order;
+ const uchar *pos = key;
+
+ key+= len;
+
+ for (; pos < (uchar*) key ; pos++)
+ {
+ nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
+ ((uint) sort_order[(uint) *pos])) + (nr1[0] << 8);
+ nr2[0]+=3;
+ }
+}
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index e8c3890abc9..9c8ac8d0c16 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -32,7 +32,7 @@
* .configure. mbmaxlen_sjis=2
*/
-uchar NEAR ctype_sjis[257] =
+static uchar NEAR ctype_sjis[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -69,7 +69,7 @@ uchar NEAR ctype_sjis[257] =
0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000
};
-uchar NEAR to_lower_sjis[]=
+static uchar NEAR to_lower_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_sjis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-uchar NEAR to_upper_sjis[]=
+static uchar NEAR to_upper_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_sjis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-uchar NEAR sort_order_sjis[]=
+static uchar NEAR sort_order_sjis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -183,18 +183,18 @@ uchar NEAR sort_order_sjis[]=
(0x80<=(c) && (c)<=0xfc))
-int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0);
}
-my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return issjishead((uchar) c);
}
-int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (issjishead((uchar) c) ? 2: 0);
}
@@ -202,7 +202,7 @@ int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
#define sjiscode(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d))
-int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
const uchar *s1, uint len1,
const uchar *s2, uint len2)
{
@@ -227,7 +227,7 @@ int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
return len1 - len2;
}
-int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, uint len,
const uchar *src, uint srclen)
{
@@ -266,7 +266,7 @@ int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
#define wild_one '_'
#define wild_many '%'
-my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length)
@@ -4415,7 +4415,7 @@ static int func_uni_sjis_onechar(int code){
}
-int
+static int
my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e)
{
@@ -4438,7 +4438,7 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
-int
+static int
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
int hi=s[0];
@@ -4458,5 +4458,38 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
+CHARSET_INFO my_charset_sjis =
+{
+ 13, /* number */
+ MY_CS_COMPILED, /* state */
+ "sjis", /* name */
+ "", /* comment */
+ ctype_sjis,
+ to_lower_sjis,
+ to_upper_sjis,
+ sort_order_sjis,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 1, /* strxfrm_multiply */
+ my_strnncoll_sjis,
+ my_strnxfrm_sjis,
+ my_like_range_sjis,
+ 2, /* mbmaxlen */
+ ismbchar_sjis,
+ ismbhead_sjis,
+ mbcharlen_sjis,
+ my_mb_wc_sjis, /* mb_wc */
+ my_wc_mb_sjis, /* wc_mb */
+ my_caseup_str_8bit,
+ my_casedn_str_8bit,
+ my_caseup_8bit,
+ my_casedn_8bit,
+ NULL, /* tosort */
+ my_strcasecmp_8bit,
+ my_strncasecmp_8bit,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
#endif
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index b4358a967ac..88549e7ee69 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -685,4 +685,40 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
}
}
+
+CHARSET_INFO my_charset_tis620 =
+{
+ 18, /* number */
+ MY_CS_COMPILED, /* state */
+ "tis620", /* name */
+ "", /* comment */
+ ctype_tis620,
+ to_lower_tis620,
+ to_upper_tis620,
+ sort_order_tis620,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 4, /* strxfrm_multiply */
+ my_strnncoll_tis620,
+ my_strnxfrm_tis620,
+ my_like_range_tis620,
+ 0, /* mbmaxlen */
+ NULL, /* ismbchar */
+ NULL, /* ismbhead */
+ NULL, /* mbcharlen */
+ my_mb_wc_8bit, /* mb_wc */
+ my_wc_mb_8bit, /* wc_mb */
+ my_caseup_str_8bit,
+ my_casedn_str_8bit,
+ my_caseup_8bit,
+ my_casedn_8bit,
+ NULL, /* tosort */
+ my_strcasecmp_8bit,
+ my_strncasecmp_8bit,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
+
#endif
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index d8de08fb117..cb1da080951 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -32,7 +32,7 @@
#ifdef HAVE_CHARSET_ujis
-uchar NEAR ctype_ujis[257] =
+static uchar NEAR ctype_ujis[257] =
{
0, /* For standard library */
0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */
@@ -69,7 +69,7 @@ uchar NEAR ctype_ujis[257] =
0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000,
};
-uchar NEAR to_lower_ujis[]=
+static uchar NEAR to_lower_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -105,7 +105,7 @@ uchar NEAR to_lower_ujis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-uchar NEAR to_upper_ujis[]=
+static uchar NEAR to_upper_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -141,7 +141,7 @@ uchar NEAR to_upper_ujis[]=
(uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377'
};
-uchar NEAR sort_order_ujis[]=
+static uchar NEAR sort_order_ujis[]=
{
'\000','\001','\002','\003','\004','\005','\006','\007',
'\010','\011','\012','\013','\014','\015','\016','\017',
@@ -184,7 +184,7 @@ uchar NEAR sort_order_ujis[]=
#define isujis_ss3(c) (((c)&0xff) == 0x8f)
-int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
+static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{
return ((*(uchar*)(p)<0x80)? 0:\
@@ -194,12 +194,12 @@ int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
0);
}
-my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isujis(c) || isujis_ss2(c) || isujis_ss3(c));
}
-int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
+static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
}
@@ -8257,7 +8257,7 @@ my_jisx0212_uni_onechar(int code){
[xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char)
*/
-int
+static int
my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
{
int c1,c2,c3;
@@ -8344,7 +8344,7 @@ my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e)
return MY_CS_ILSEQ;
}
-int
+static int
my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
{
unsigned char buf[2];
@@ -8427,5 +8427,39 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
return MY_CS_ILUNI;
}
+CHARSET_INFO my_charset_ujis =
+{
+ 12, /* number */
+ MY_CS_COMPILED, /* state */
+ "ujis", /* name */
+ "", /* comment */
+ ctype_ujis,
+ to_lower_ujis,
+ to_upper_ujis,
+ sort_order_ujis,
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 0, /* strxfrm_multiply */
+ NULL, /* strnncoll */
+ NULL, /* strnxfrm */
+ NULL, /* like_range */
+ 3, /* mbmaxlen */
+ ismbchar_ujis,
+ ismbhead_ujis,
+ mbcharlen_ujis,
+ my_mb_wc_euc_jp, /* mb_wc */
+ my_wc_mb_euc_jp, /* wc_mb */
+ my_caseup_str_mb,
+ my_casedn_str_mb,
+ my_caseup_mb,
+ my_casedn_mb,
+ my_tosort_8bit,
+ my_strcasecmp_mb,
+ my_strncasecmp_mb,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
#endif
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 1cce8819619..81671e28c3f 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1516,7 +1516,7 @@ static MY_UNICASE_INFO *uni_plane[256]={
/* These arrays are taken from usa7 implementation */
-uchar ctype_utf8[] = {
+static uchar ctype_utf8[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -1536,7 +1536,7 @@ uchar ctype_utf8[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-uchar to_lower_utf8[] = {
+static uchar to_lower_utf8[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -1555,7 +1555,7 @@ uchar to_lower_utf8[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-uchar to_upper_utf8[] = {
+static uchar to_upper_utf8[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -1575,7 +1575,7 @@ uchar to_upper_utf8[] = {
};
-int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) ,
my_wc_t * pwc, const uchar *s, const uchar *e)
{
unsigned char c = s[0];
@@ -1677,7 +1677,7 @@ int my_utf8_uni (CHARSET_INFO *cs __attribute__((unused)) ,
return MY_CS_ILSEQ;
}
-int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
my_wc_t wc, uchar *r, uchar *e)
{
int count;
@@ -1720,7 +1720,7 @@ int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
}
-void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
+static void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
{
my_wc_t wc;
int res;
@@ -1736,7 +1736,7 @@ void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
}
}
-uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
+static uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
{
my_wc_t wc;
register uint nr=1, nr2=4;
@@ -1759,7 +1759,7 @@ uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen)
}
-void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
+static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
{
my_wc_t wc;
int res;
@@ -1778,13 +1778,13 @@ void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, u
}
-void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
+static void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
{
my_caseup_utf8(cs, s, strlen(s));
}
-void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
+static void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
{
my_wc_t wc;
int res;
@@ -1802,13 +1802,13 @@ void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
}
}
-void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
+static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
{
my_casedn_utf8(cs, s, strlen(s));
}
-int my_strnncoll_utf8(CHARSET_INFO *cs,
+static int my_strnncoll_utf8(CHARSET_INFO *cs,
const uchar *s, uint slen, const uchar *t, uint tlen)
{
int s_res,t_res;
@@ -1843,7 +1843,7 @@ int my_strnncoll_utf8(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
-int my_strncasecmp_utf8(CHARSET_INFO *cs,
+static int my_strncasecmp_utf8(CHARSET_INFO *cs,
const char *s, const char *t, uint len)
{
int s_res,t_res;
@@ -1879,7 +1879,7 @@ int my_strncasecmp_utf8(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
-int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
+static int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
{
uint s_len=strlen(s);
uint t_len=strlen(t);
@@ -1887,8 +1887,9 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
return my_strncasecmp_utf8(cs, s, t, len);
}
-int my_strnxfrm_utf8(CHARSET_INFO *cs,
- uchar *dst, uint dstlen, const uchar *src, uint srclen)
+static int my_strnxfrm_utf8(CHARSET_INFO *cs,
+ uchar *dst, uint dstlen,
+ const uchar *src, uint srclen)
{
my_wc_t wc;
int res;
@@ -1918,19 +1919,19 @@ int my_strnxfrm_utf8(CHARSET_INFO *cs,
return dst - dst_orig;
}
-int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
+static int my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
{
my_wc_t wc;
int res=my_utf8_uni(cs,&wc, (const uchar*)b, (const uchar*)e);
return (res>1) ? res : 0;
}
-my_bool my_ismbhead_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint ch)
+static my_bool my_ismbhead_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint ch)
{
return ( ch >= 0xc2 );
}
-int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
+static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
{
if (c < 0x80)
return 1;
@@ -1951,6 +1952,41 @@ int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
return 0; /* Illegal mb head */;
}
+CHARSET_INFO my_charset_utf8 =
+{
+ 33, /* number */
+ MY_CS_COMPILED, /* state */
+ "utf8", /* name */
+ "", /* comment */
+ ctype_utf8, /* ctype */
+ to_lower_utf8, /* to_lower */
+ to_upper_utf8, /* to_upper */
+ to_upper_utf8, /* sort_order */
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 1, /* strxfrm_multiply */
+ my_strnncoll_utf8, /* strnncoll */
+ my_strnxfrm_utf8, /* strnxfrm */
+ NULL, /* like_range */
+ 3, /* mbmaxlen */
+ my_ismbchar_utf8, /* ismbchar */
+ my_ismbhead_utf8, /* ismbhead */
+ my_mbcharlen_utf8, /* mbcharlen */
+ my_utf8_uni, /* mb_wc */
+ my_uni_utf8, /* wc_mb */
+ my_caseup_str_utf8,
+ my_casedn_str_utf8,
+ my_caseup_utf8,
+ my_casedn_utf8,
+ NULL, /* tosort */
+ my_strcasecmp_utf8,
+ my_strncasecmp_utf8,
+ my_hash_caseup_utf8,/* hash_caseup */
+ my_hash_sort_utf8, /* hash_sort */
+ 0
+};
+
+
#ifdef MY_TEST_UTF8
#include <stdio.h>
@@ -2009,7 +2045,7 @@ int main()
#ifdef HAVE_CHARSET_ucs2
-uchar ctype_ucs2[] = {
+static uchar ctype_ucs2[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
@@ -2029,7 +2065,7 @@ uchar ctype_ucs2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-uchar to_lower_ucs2[] = {
+static uchar to_lower_ucs2[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -2048,7 +2084,7 @@ uchar to_lower_ucs2[] = {
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
-uchar to_upper_ucs2[] = {
+static uchar to_upper_ucs2[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -2068,7 +2104,7 @@ uchar to_upper_ucs2[] = {
};
-int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) ,
my_wc_t * pwc, const uchar *s, const uchar *e)
{
if (s+2 > e) /* Need 2 characters */
@@ -2078,7 +2114,7 @@ int my_ucs2_uni (CHARSET_INFO *cs __attribute__((unused)) ,
return 2;
}
-int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
my_wc_t wc, uchar *r, uchar *e)
{
if ( r+2 > e )
@@ -2090,7 +2126,7 @@ int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
}
-void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
+static void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
{
my_wc_t wc;
int res;
@@ -2106,7 +2142,7 @@ void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
}
}
-uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
+static uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
{
my_wc_t wc;
register uint nr=1, nr2=4;
@@ -2129,7 +2165,7 @@ uint my_hash_caseup_ucs2(CHARSET_INFO *cs, const byte *s, uint slen)
}
-void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
+static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2)
{
my_wc_t wc;
int res;
@@ -2148,14 +2184,14 @@ void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, u
}
-void my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)),
+static void my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)),
char * s __attribute__((unused)))
{
}
-void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
+static void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
{
my_wc_t wc;
int res;
@@ -2173,13 +2209,13 @@ void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
}
}
-void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+static void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)),
char * s __attribute__((unused)))
{
}
-int my_strnncoll_ucs2(CHARSET_INFO *cs,
+static int my_strnncoll_ucs2(CHARSET_INFO *cs,
const uchar *s, uint slen, const uchar *t, uint tlen)
{
int s_res,t_res;
@@ -2214,7 +2250,7 @@ int my_strnncoll_ucs2(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
-int my_strncasecmp_ucs2(CHARSET_INFO *cs,
+static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
const char *s, const char *t, uint len)
{
int s_res,t_res;
@@ -2250,7 +2286,7 @@ int my_strncasecmp_ucs2(CHARSET_INFO *cs,
return ( (se-s) - (te-t) );
}
-int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
+static int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
{
uint s_len=strlen(s);
uint t_len=strlen(t);
@@ -2258,7 +2294,7 @@ int my_strcasecmp_ucs2(CHARSET_INFO *cs, const char *s, const char *t)
return my_strncasecmp_ucs2(cs, s, t, len);
}
-int my_strnxfrm_ucs2(CHARSET_INFO *cs,
+static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
uchar *dst, uint dstlen, const uchar *src, uint srclen)
{
my_wc_t wc;
@@ -2289,23 +2325,59 @@ int my_strnxfrm_ucs2(CHARSET_INFO *cs,
return dst - dst_orig;
}
-int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
+static int my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *b __attribute__((unused)),
const char *e __attribute__((unused)))
{
return 2;
}
-my_bool my_ismbhead_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
+static my_bool my_ismbhead_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
uint ch __attribute__((unused)))
{
return 1;
}
-int my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
+static int my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
uint c __attribute__((unused)))
{
return 2;
}
+
+CHARSET_INFO my_charset_ucs2 =
+{
+ 35, /* number */
+ MY_CS_COMPILED, /* state */
+ "ucs2", /* name */
+ "", /* comment */
+ ctype_ucs2, /* ctype */
+ to_lower_ucs2, /* to_lower */
+ to_upper_ucs2, /* to_upper */
+ to_upper_ucs2, /* sort_order */
+ NULL, /* tab_to_uni */
+ NULL, /* tab_from_uni */
+ 1, /* strxfrm_multiply */
+ my_strnncoll_ucs2, /* strnncoll */
+ my_strnxfrm_ucs2, /* strnxfrm */
+ NULL, /* like_range */
+ 2, /* mbmaxlen */
+ my_ismbchar_ucs2, /* ismbchar */
+ my_ismbhead_ucs2, /* ismbhead */
+ my_mbcharlen_ucs2, /* mbcharlen */
+ my_ucs2_uni, /* mb_wc */
+ my_uni_ucs2, /* wc_mb */
+ my_caseup_str_ucs2,
+ my_casedn_str_ucs2,
+ my_caseup_ucs2,
+ my_casedn_ucs2,
+ NULL, /* tosort */
+ my_strcasecmp_ucs2,
+ my_strncasecmp_ucs2,
+ my_hash_caseup_ucs2,/* hash_caseup */
+ my_hash_sort_ucs2, /* hash_sort */
+ 0
+};
+
+
#endif
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index c8ea1bf1f9f..f64eddd2c2b 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -35,7 +35,106 @@
#include "m_string.h"
#include "m_ctype.h"
-uchar NEAR ctype_win1250ch[] = {
+static uint16 tab_cp1250_uni[256]={
+ 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
+0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
+0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
+0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
+0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
+0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
+0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
+0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
+0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
+0x20AC, 0,0x201A, 0,0x201E,0x2026,0x2020,0x2021,
+ 0,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179,
+ 0,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
+ 0,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A,
+0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7,
+0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B,
+0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7,
+0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C,
+0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
+0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
+0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
+0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
+0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
+0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
+0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
+0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
+};
+
+
+/* 0000-00FD , 254 chars */
+static uchar tab_uni_cp1250_plane00[]={
+0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
+0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
+0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
+0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
+0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
+0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xA0,0x00,0x00,0x00,0xA4,0x00,0xA6,0xA7,0xA8,0xA9,0x00,0xAB,0xAC,0xAD,0xAE,0x00,
+0xB0,0xB1,0x00,0x00,0xB4,0xB5,0xB6,0xB7,0xB8,0x00,0x00,0xBB,0x00,0x00,0x00,0x00,
+0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00,
+0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF,
+0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00,
+0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD};
+
+/* 0102-017E , 125 chars */
+static uchar tab_uni_cp1250_plane01[]={
+0xC3,0xE3,0xA5,0xB9,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0,
+0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xBC,0xBE,0x00,0x00,0xA3,
+0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5,
+0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0x8C,0x9C,0x00,0x00,0xAA,0xBA,0x8A,0x9A,
+0xDE,0xFE,0x8D,0x9D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8F,0x9F,0xAF,0xBF,0x8E,0x9E};
+
+/* 2013-20AC , 154 chars */
+static uchar tab_uni_cp1250_plane20[]={
+0x96,0x97,0x00,0x00,0x00,0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00,0x86,0x87,0x95,
+0x00,0x00,0x00,0x85,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
+
+/* 02C7-02DD , 23 chars */
+static uchar tab_uni_cp1250_plane02[]={
+0xA1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD};
+
+/* 2122-2122 , 1 chars */
+static uchar tab_uni_cp1250_plane21[]={
+0x99};
+
+
+static MY_UNI_IDX idx_uni_cp1250[]={
+ {0x0000,0x00FD,tab_uni_cp1250_plane00},
+ {0x0102,0x017E,tab_uni_cp1250_plane01},
+ {0x2013,0x20AC,tab_uni_cp1250_plane20},
+ {0x02C7,0x02DD,tab_uni_cp1250_plane02},
+ {0x2122,0x2122,tab_uni_cp1250_plane21},
+ {0,0,NULL}
+};
+
+
+static uchar NEAR ctype_win1250ch[] = {
0x00,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20,
@@ -71,7 +170,7 @@ uchar NEAR ctype_win1250ch[] = {
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10
};
-uchar NEAR to_lower_win1250ch[] = {
+static uchar NEAR to_lower_win1250ch[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -106,7 +205,7 @@ uchar NEAR to_lower_win1250ch[] = {
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
-uchar NEAR to_upper_win1250ch[] = {
+static uchar NEAR to_upper_win1250ch[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -149,7 +248,7 @@ uchar NEAR to_upper_win1250ch[] = {
#endif
-uchar NEAR sort_order_win1250ch[] = {
+static uchar NEAR sort_order_win1250ch[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -168,7 +267,7 @@ uchar NEAR sort_order_win1250ch[] = {
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
};
-uchar NEAR _sort_order_win1250ch1[] = {
+static uchar NEAR _sort_order_win1250ch1[] = {
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
@@ -228,7 +327,7 @@ uchar NEAR _sort_order_win1250ch1[] = {
0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5
};
-uchar NEAR _sort_order_win1250ch2[] = {
+static uchar NEAR _sort_order_win1250ch2[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
@@ -334,7 +433,8 @@ static struct wordvalue doubles[] = {
#define IS_END(p, src, len) (!(*p))
-int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
+#if UNUSED
+static int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
int v1, v2;
const uchar * p1, * p2;
int pass1 = 0, pass2 = 0;
@@ -350,9 +450,10 @@ int my_strcoll_win1250ch(const uchar * s1, const uchar * s2) {
} while (v1);
return 0;
}
+#endif
#ifdef UNUSED
-int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
+static int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
int value;
const uchar * p;
int pass = 0;
@@ -373,7 +474,7 @@ int my_strxfrm_win1250ch(uchar * dest, const uchar * src, int len) {
#define IS_END(p, src, len) (((char *)p - (char *)src) >= (len))
-int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
+static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1,
const uchar * s2, uint len2) {
int v1, v2;
@@ -392,7 +493,7 @@ int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
return 0;
}
-int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
+static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)),
uchar * dest, uint len,
const uchar * src, uint srclen) {
int value;
@@ -474,7 +575,7 @@ static uchar NEAR like_range_prefix_max_win1250ch[] = {
** optimized !
*/
-my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
+static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint ptr_length,
pchar escape, uint res_length,
char *min_str, char *max_str,
@@ -518,4 +619,40 @@ my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
return 0;
}
+
+CHARSET_INFO my_charset_win1250ch =
+{
+ 34, /* number */
+ MY_CS_COMPILED, /* state */
+ "win1250ch", /* name */
+ "", /* comment */
+ ctype_win1250ch,
+ to_lower_win1250ch,
+ to_upper_win1250ch,
+ sort_order_win1250ch,
+ tab_cp1250_uni, /* tab_to_uni */
+ idx_uni_cp1250, /* tab_from_uni */
+ 2, /* strxfrm_multiply */
+ my_strnncoll_win1250ch,
+ my_strnxfrm_win1250ch,
+ my_like_range_win1250ch,
+ 0, /* mbmaxlen */
+ NULL, /* ismbchar */
+ NULL, /* ismbhead */
+ NULL, /* mbcharlen */
+ my_mb_wc_8bit, /* mb_wc */
+ my_wc_mb_8bit, /* wc_mb */
+ my_caseup_str_8bit,
+ my_casedn_str_8bit,
+ my_caseup_8bit,
+ my_casedn_8bit,
+ NULL, /* tosort */
+ my_strcasecmp_8bit,
+ my_strncasecmp_8bit,
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
+ 0
+};
+
+
#endif
diff --git a/strings/ctype.c b/strings/ctype.c
index d3ae693f97d..379669adb5f 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -83,7 +83,7 @@ static MY_UNI_IDX idx_uni_8859_1[]={
#endif
#if defined(HAVE_CHARSET_latin2)||defined(HAVE_CHARSET_croat)||\
-defined(HAVE_CHARSET_hungarian)||defined(HAVE_CHARSET_czech)
+defined(HAVE_CHARSET_hungarian)
static uint16 tab_8859_2_uni[256]={
0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
@@ -2529,7 +2529,7 @@ static uchar sort_order_win1250[] = {
};
#endif
-#if defined(HAVE_CHARSET_win1250)||defined(HAVE_CHARSET_win1250ch)
+#if defined(HAVE_CHARSET_win1250)
static uint16 tab_cp1250_uni[256]={
0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
@@ -2801,7 +2801,7 @@ static uchar sort_order_win1251ukr[] = {
-CHARSET_INFO compiled_charsets[] = {
+static CHARSET_INFO compiled_charsets[] = {
#ifdef HAVE_CHARSET_latin1
{
@@ -2816,7 +2816,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_1_uni, /* tab_to_uni */
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -2829,47 +2829,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_big5
- {
- 1, /* number */
- MY_CS_COMPILED, /* state */
- "big5", /* name */
- "", /* comment */
- ctype_big5,
- to_lower_big5,
- to_upper_big5,
- sort_order_big5,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 1, /* strxfrm_multiply */
- my_strnncoll_big5,
- my_strnxfrm_big5,
- my_like_range_big5,
- 2, /* mbmaxlen */
- ismbchar_big5,
- ismbhead_big5,
- mbcharlen_big5,
- my_mb_wc_big5, /* mb_wc */
- my_wc_mb_big5, /* wc_mb */
- my_caseup_str_mb,
- my_casedn_str_mb,
- my_caseup_mb,
- my_casedn_mb,
- my_strcasecmp_mb,
- my_strncasecmp_mb,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_cp1251
{
@@ -2884,7 +2852,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_cp1251_uni, /* tab_to_uni */
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -2897,10 +2865,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -2918,7 +2887,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_cp1257_uni, /* tab_to_uni */
idx_uni_cp1257, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -2931,10 +2900,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -2952,7 +2922,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_2_uni, /* tab_to_uni */
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -2965,47 +2935,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_czech
- {
- 2, /* number */
- MY_CS_COMPILED, /* state */
- "czech", /* name */
- "", /* comment */
- ctype_czech,
- to_lower_czech,
- to_upper_czech,
- sort_order_czech,
- tab_8859_2_uni, /* tab_to_uni */
- idx_uni_8859_2, /* tab_from_uni */
- 4, /* strxfrm_multiply */
- my_strnncoll_czech,
- my_strnxfrm_czech,
- my_like_range_czech,
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL, /* mbcharlen */
- my_mb_wc_8bit, /* mb_wc */
- my_wc_mb_8bit, /* wc_mb */
- my_caseup_str_8bit,
- my_casedn_str_8bit,
- my_caseup_8bit,
- my_casedn_8bit,
- my_strcasecmp_8bit,
- my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_danish
{
@@ -3020,7 +2958,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_1_uni, /* tab_to_uni */
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3033,10 +2971,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3054,7 +2993,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3067,10 +3006,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3088,7 +3028,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3101,10 +3041,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3122,7 +3063,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3135,115 +3076,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
-
-#ifdef HAVE_CHARSET_euc_kr
- {
- 19, /* number */
- MY_CS_COMPILED, /* state */
- "euc_kr", /* name */
- "", /* comment */
- ctype_euc_kr,
- to_lower_euc_kr,
- to_upper_euc_kr,
- sort_order_euc_kr,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 0, /* strxfrm_multiply */
- NULL, /* strnncoll */
- NULL, /* strnxfrm */
- NULL, /* like_range */
- 2, /* mbmaxlen */
- ismbchar_euc_kr,
- ismbhead_euc_kr,
- mbcharlen_euc_kr,
- my_mb_wc_euc_kr, /* mb_wc */
- my_wc_mb_euc_kr, /* wc_mb */
- my_caseup_str_mb,
- my_casedn_str_mb,
- my_caseup_mb,
- my_casedn_mb,
- my_strcasecmp_mb,
- my_strncasecmp_mb,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
-
-#ifdef HAVE_CHARSET_gb2312
- {
- 24, /* number */
- MY_CS_COMPILED, /* state */
- "gb2312", /* name */
- "", /* comment */
- ctype_gb2312,
- to_lower_gb2312,
- to_upper_gb2312,
- sort_order_gb2312,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 0, /* strxfrm_multiply */
- NULL, /* strnncoll */
- NULL, /* strnxfrm */
- NULL, /* like_range */
- 2, /* mbmaxlen */
- ismbchar_gb2312,
- ismbhead_gb2312,
- mbcharlen_gb2312,
- my_mb_wc_gb2312, /* mb_wc */
- my_wc_mb_gb2312, /* wc_mb */
- my_caseup_str_mb,
- my_casedn_str_mb,
- my_caseup_mb,
- my_casedn_mb,
- my_strcasecmp_mb,
- my_strncasecmp_mb,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_gbk
- {
- 28, /* number */
- MY_CS_COMPILED, /* state */
- "gbk", /* name */
- "", /* comment */
- ctype_gbk,
- to_lower_gbk,
- to_upper_gbk,
- sort_order_gbk,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 1, /* strxfrm_multiply */
- my_strnncoll_gbk,
- my_strnxfrm_gbk,
- my_like_range_gbk,
- 2, /* mbmaxlen */
- ismbchar_gbk,
- ismbhead_gbk,
- mbcharlen_gbk,
- my_mb_wc_gbk, /* mb_wc */
- my_wc_mb_gbk, /* wc_mb */
- my_caseup_str_mb,
- my_casedn_str_mb,
- my_caseup_mb,
- my_casedn_mb,
- my_strcasecmp_mb,
- my_strncasecmp_mb,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_german1
{
@@ -3258,7 +3099,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_1_uni, /* tab_to_uni */
idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3271,10 +3112,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3292,7 +3134,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3305,10 +3147,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3326,7 +3169,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3339,10 +3182,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3360,7 +3204,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3373,10 +3217,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3394,7 +3239,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_2_uni, /* tab_to_uni */
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3407,10 +3252,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3428,7 +3274,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_koi8_r_uni, /* tab_to_uni */
idx_uni_koi8_r, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3441,10 +3287,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3462,7 +3309,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_koi8_u_uni, /* tab_to_uni */
idx_uni_koi8_u, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3475,47 +3322,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_latin1_de
- {
- 31, /* number */
- MY_CS_COMPILED, /* state */
- "latin1_de", /* name */
- "", /* comment */
- ctype_latin1_de,
- to_lower_latin1_de,
- to_upper_latin1_de,
- sort_order_latin1_de,
- tab_8859_1_uni, /* tab_to_uni */
- idx_uni_8859_1, /* tab_from_uni */
- 2, /* strxfrm_multiply */
- my_strnncoll_latin1_de,
- my_strnxfrm_latin1_de,
- my_like_range_latin1_de,
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL, /* mbcharlen */
- my_mb_wc_8bit, /* mb_wc */
- my_wc_mb_8bit, /* wc_mb */
- my_caseup_str_8bit,
- my_casedn_str_8bit,
- my_caseup_8bit,
- my_casedn_8bit,
- my_strcasecmp_8bit,
- my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_latin2
{
@@ -3530,7 +3345,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_2_uni, /* tab_to_uni */
idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3543,10 +3358,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3564,7 +3380,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_8859_9_uni, /* tab_to_uni */
idx_uni_8859_9, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3577,47 +3393,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_sjis
- {
- 13, /* number */
- MY_CS_COMPILED, /* state */
- "sjis", /* name */
- "", /* comment */
- ctype_sjis,
- to_lower_sjis,
- to_upper_sjis,
- sort_order_sjis,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 1, /* strxfrm_multiply */
- my_strnncoll_sjis,
- my_strnxfrm_sjis,
- my_like_range_sjis,
- 2, /* mbmaxlen */
- ismbchar_sjis,
- ismbhead_sjis,
- mbcharlen_sjis,
- my_mb_wc_sjis, /* mb_wc */
- my_wc_mb_sjis, /* wc_mb */
- my_caseup_str_8bit,
- my_casedn_str_8bit,
- my_caseup_8bit,
- my_casedn_8bit,
- my_strcasecmp_8bit,
- my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_swe7
{
@@ -3632,7 +3416,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3645,150 +3429,15 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
-
-#ifdef HAVE_CHARSET_tis620
- {
- 18, /* number */
- MY_CS_COMPILED, /* state */
- "tis620", /* name */
- "", /* comment */
- ctype_tis620,
- to_lower_tis620,
- to_upper_tis620,
- sort_order_tis620,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 4, /* strxfrm_multiply */
- my_strnncoll_tis620,
- my_strnxfrm_tis620,
- my_like_range_tis620,
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL, /* mbcharlen */
- my_mb_wc_8bit, /* mb_wc */
- my_wc_mb_8bit, /* wc_mb */
- my_caseup_str_8bit,
- my_casedn_str_8bit,
- my_caseup_8bit,
- my_casedn_8bit,
- my_strcasecmp_8bit,
- my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
-#ifdef HAVE_CHARSET_ucs2
- {
- 35, /* number */
- MY_CS_COMPILED, /* state */
- "ucs2", /* name */
- "", /* comment */
- ctype_ucs2, /* ctype */
- to_lower_ucs2, /* to_lower */
- to_upper_ucs2, /* to_upper */
- to_upper_ucs2, /* sort_order */
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 1, /* strxfrm_multiply */
- my_strnncoll_ucs2, /* strnncoll */
- my_strnxfrm_ucs2, /* strnxfrm */
- NULL, /* like_range */
- 2, /* mbmaxlen */
- my_ismbchar_ucs2, /* ismbchar */
- my_ismbhead_ucs2, /* ismbhead */
- my_mbcharlen_ucs2, /* mbcharlen */
- my_ucs2_uni, /* mb_wc */
- my_uni_ucs2, /* wc_mb */
- my_caseup_str_ucs2,
- my_casedn_str_ucs2,
- my_caseup_ucs2,
- my_casedn_ucs2,
- my_strcasecmp_ucs2,
- my_strncasecmp_ucs2,
- my_hash_caseup_ucs2,/* hash_caseup */
- my_hash_sort_ucs2, /* hash_sort */
- 0
- },
-#endif
-
-
-#ifdef HAVE_CHARSET_ujis
- {
- 12, /* number */
- MY_CS_COMPILED, /* state */
- "ujis", /* name */
- "", /* comment */
- ctype_ujis,
- to_lower_ujis,
- to_upper_ujis,
- sort_order_ujis,
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 0, /* strxfrm_multiply */
- NULL, /* strnncoll */
- NULL, /* strnxfrm */
- NULL, /* like_range */
- 3, /* mbmaxlen */
- ismbchar_ujis,
- ismbhead_ujis,
- mbcharlen_ujis,
- my_mb_wc_euc_jp, /* mb_wc */
- my_wc_mb_euc_jp, /* wc_mb */
- my_caseup_str_mb,
- my_casedn_str_mb,
- my_caseup_mb,
- my_casedn_mb,
- my_strcasecmp_mb,
- my_strncasecmp_mb,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
-
-#ifdef HAVE_CHARSET_utf8
- {
- 33, /* number */
- MY_CS_COMPILED, /* state */
- "utf8", /* name */
- "", /* comment */
- ctype_utf8, /* ctype */
- to_lower_utf8, /* to_lower */
- to_upper_utf8, /* to_upper */
- to_upper_utf8, /* sort_order */
- NULL, /* tab_to_uni */
- NULL, /* tab_from_uni */
- 1, /* strxfrm_multiply */
- my_strnncoll_utf8, /* strnncoll */
- my_strnxfrm_utf8, /* strnxfrm */
- NULL, /* like_range */
- 3, /* mbmaxlen */
- my_ismbchar_utf8, /* ismbchar */
- my_ismbhead_utf8, /* ismbhead */
- my_mbcharlen_utf8, /* mbcharlen */
- my_utf8_uni, /* mb_wc */
- my_uni_utf8, /* wc_mb */
- my_caseup_str_utf8,
- my_casedn_str_utf8,
- my_caseup_utf8,
- my_casedn_utf8,
- my_strcasecmp_utf8,
- my_strncasecmp_utf8,
- my_hash_caseup_utf8,/* hash_caseup */
- my_hash_sort_utf8, /* hash_sort */
- 0
- },
-#endif
#ifdef HAVE_CHARSET_usa7
{
@@ -3803,7 +3452,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_us_ascii_uni, /* tab_to_uni */
idx_uni_us_ascii, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3816,10 +3465,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3837,7 +3487,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_cp1250_uni, /* tab_to_uni */
idx_uni_cp1250, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3850,10 +3500,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3871,7 +3522,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_cp1251_uni, /* tab_to_uni */
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3885,9 +3536,10 @@ CHARSET_INFO compiled_charsets[] = {
my_caseup_8bit,
my_casedn_8bit,
my_strcasecmp_8bit,
+ my_tosort_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3905,7 +3557,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_armscii_8_uni, /* tab_to_uni */
idx_uni_armscii_8, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3918,10 +3570,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -3939,7 +3592,7 @@ CHARSET_INFO compiled_charsets[] = {
tab_cp1251_uni, /* tab_to_uni */
idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */
- NULL, /* strnncoll */
+ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */
NULL, /* like_range */
0, /* mbmaxlen */
@@ -3952,44 +3605,11 @@ CHARSET_INFO compiled_charsets[] = {
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
+ my_tosort_8bit,
my_strcasecmp_8bit,
my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
- 0
- },
-#endif
-
-#ifdef HAVE_CHARSET_win1250ch
- {
- 34, /* number */
- MY_CS_COMPILED, /* state */
- "win1250ch", /* name */
- "", /* comment */
- ctype_win1250ch,
- to_lower_win1250ch,
- to_upper_win1250ch,
- sort_order_win1250ch,
- tab_cp1250_uni, /* tab_to_uni */
- idx_uni_cp1250, /* tab_from_uni */
- 2, /* strxfrm_multiply */
- my_strnncoll_win1250ch,
- my_strnxfrm_win1250ch,
- my_like_range_win1250ch,
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL, /* mbcharlen */
- my_mb_wc_8bit, /* mb_wc */
- my_wc_mb_8bit, /* wc_mb */
- my_caseup_str_8bit,
- my_casedn_str_8bit,
- my_caseup_8bit,
- my_casedn_8bit,
- my_strcasecmp_8bit,
- my_strncasecmp_8bit,
- NULL, /* hash_caseup */
- NULL, /* hash_sort */
+ my_hash_caseup_simple,
+ my_hash_sort_simple,
0
},
#endif
@@ -4023,6 +3643,7 @@ CHARSET_INFO compiled_charsets[] = {
NULL,
NULL,
NULL,
+ NULL,
NULL, /* hash_caseup */
NULL, /* hash_sort */
0
@@ -4030,45 +3651,84 @@ CHARSET_INFO compiled_charsets[] = {
};
+CHARSET_INFO *all_charsets[256];
CHARSET_INFO *default_charset_info = &compiled_charsets[0];
CHARSET_INFO *system_charset_info = &compiled_charsets[0];
-CHARSET_INFO *find_compiled_charset(uint cs_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == cs_number)
- return cs;
+#define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
- return NULL;
-}
-CHARSET_INFO *find_compiled_charset_by_name(const char *name)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs;
+extern CHARSET_INFO my_charset_big5;
+extern CHARSET_INFO my_charset_czech;
+extern CHARSET_INFO my_charset_euc_kr;
+extern CHARSET_INFO my_charset_gb2312;
+extern CHARSET_INFO my_charset_gbk;
+extern CHARSET_INFO my_charset_latin1_de;
+extern CHARSET_INFO my_charset_sjis;
+extern CHARSET_INFO my_charset_tis620;
+extern CHARSET_INFO my_charset_ucs2;
+extern CHARSET_INFO my_charset_ujis;
+extern CHARSET_INFO my_charset_utf8;
+extern CHARSET_INFO my_charset_win1250ch;
- return NULL;
-}
-uint compiled_charset_number(const char *name)
+my_bool init_compiled_charsets(myf flags __attribute__((unused)))
{
CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs->number;
- return 0; /* this mimics find_type() */
-}
+#ifdef HAVE_CHARSET_big5
+ MY_ADD_CHARSET(&my_charset_big5);
+#endif
-const char *compiled_charset_name(uint charset_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == charset_number)
- return cs->name;
+#ifdef HAVE_CHARSET_czech
+ MY_ADD_CHARSET(&my_charset_czech);
+#endif
+
+#ifdef HAVE_CHARSET_euc_kr
+ MY_ADD_CHARSET(&my_charset_euc_kr);
+#endif
+
+#ifdef HAVE_CHARSET_gb2312
+ MY_ADD_CHARSET(&my_charset_gb2312);
+#endif
+
+#ifdef HAVE_CHARSET_gbk
+ MY_ADD_CHARSET(&my_charset_gbk);
+#endif
+
+#ifdef HAVE_CHARSET_latin1_de
+ MY_ADD_CHARSET(&my_charset_latin1_de);
+#endif
+
+#ifdef HAVE_CHARSET_sjis
+ MY_ADD_CHARSET(&my_charset_sjis);
+#endif
- return "?"; /* this mimics get_type() */
+#ifdef HAVE_CHARSET_tis620
+ MY_ADD_CHARSET(&my_charset_tis620);
+#endif
+
+#ifdef HAVE_CHARSET_ucs2
+ MY_ADD_CHARSET(&my_charset_ucs2);
+#endif
+
+#ifdef HAVE_CHARSET_ujis
+ MY_ADD_CHARSET(&my_charset_ujis);
+#endif
+
+#ifdef HAVE_CHARSET_utf8
+ MY_ADD_CHARSET(&my_charset_utf8);
+#endif
+
+#ifdef HAVE_CHARSET_win1250ch
+ MY_ADD_CHARSET(&my_charset_win1250ch);
+#endif
+
+ /* Copy compiled charsets */
+ for (cs=compiled_charsets; cs->name; cs++)
+ {
+ all_charsets[cs->number]=cs;
+ }
+
+ return FALSE;
}