Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4e405fa2
Commit
4e405fa2
authored
Jan 05, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
koi8_ru -> koi8_r
charset.conf -> charset.xml bug fix
parent
40c61f57
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
216 additions
and
191 deletions
+216
-191
mysql-test/r/ctype_many.result
mysql-test/r/ctype_many.result
+7
-7
mysql-test/t/ctype_many.test
mysql-test/t/ctype_many.test
+2
-2
mysys/charset.c
mysys/charset.c
+205
-179
sql/share/Makefile.am
sql/share/Makefile.am
+1
-2
strings/ctype-simple.c
strings/ctype-simple.c
+1
-1
No files found.
mysql-test/r/ctype_many.result
View file @
4e405fa2
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
CREATE TABLE t1 (
comment CHAR(32) ASCII NOT NULL,
comment CHAR(32) ASCII NOT NULL,
koi8_ru_f CHAR(32) CHARACTER SET koi8_r
u
NOT NULL
koi8_ru_f CHAR(32) CHARACTER SET koi8_r NOT NULL
) CHARSET=latin5;
) CHARSET=latin5;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`comment` char(32) character set latin1 NOT NULL default '',
`comment` char(32) character set latin1 NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r
u
NOT NULL default ''
`koi8_ru_f` char(32) character set koi8_r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin5
) TYPE=MyISAM CHARSET=latin5
ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '',
`comment` char(32) character set latin2 NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r
u
NOT NULL default ''
`koi8_ru_f` char(32) character set koi8_r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin5
) TYPE=MyISAM CHARSET=latin5
ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '',
`comment` char(32) character set latin2 NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r
u
NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r NOT NULL default '',
`latin5_f` char(32) character set latin5 NOT NULL default ''
`latin5_f` char(32) character set latin5 NOT NULL default ''
) TYPE=MyISAM CHARSET=latin5
) TYPE=MyISAM CHARSET=latin5
ALTER TABLE t1 CHARSET=latin2;
ALTER TABLE t1 CHARSET=latin2;
...
@@ -30,7 +30,7 @@ SHOW CREATE TABLE t1;
...
@@ -30,7 +30,7 @@ SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '',
`comment` char(32) character set latin2 NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r
u
NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r NOT NULL default '',
`latin5_f` char(32) character set latin5 NOT NULL default '',
`latin5_f` char(32) character set latin5 NOT NULL default '',
`latin2_f` char(32) character set latin2 NOT NULL default ''
`latin2_f` char(32) character set latin2 NOT NULL default ''
) TYPE=MyISAM CHARSET=latin2
) TYPE=MyISAM CHARSET=latin2
...
@@ -39,7 +39,7 @@ SHOW CREATE TABLE t1;
...
@@ -39,7 +39,7 @@ SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '',
`comment` char(32) character set latin2 NOT NULL default '',
`koi8_ru_f` char(32) character set koi8_r
u
NOT NULL default ''
`koi8_ru_f` char(32) character set koi8_r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin2
) TYPE=MyISAM CHARSET=latin2
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
...
@@ -1061,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA
...
@@ -1061,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA
CYR SMALL YA CYR SMALL YA
CYR SMALL YA CYR SMALL YA
SELECT t11.comment,t12.comment
SELECT t11.comment,t12.comment
FROM t1 t11,t1 t12
FROM t1 t11,t1 t12
WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r
u
)
WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r)
ORDER BY t12.utf8_f,t11.comment,t12.comment;
ORDER BY t12.utf8_f,t11.comment,t12.comment;
comment comment
comment comment
LAT CAPIT A LAT CAPIT A
LAT CAPIT A LAT CAPIT A
...
...
mysql-test/t/ctype_many.test
View file @
4e405fa2
...
@@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1;
...
@@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1;
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
comment
CHAR
(
32
)
ASCII
NOT
NULL
,
comment
CHAR
(
32
)
ASCII
NOT
NULL
,
koi8_ru_f
CHAR
(
32
)
CHARACTER
SET
koi8_r
u
NOT
NULL
koi8_ru_f
CHAR
(
32
)
CHARACTER
SET
koi8_r
NOT
NULL
)
CHARSET
=
latin5
;
)
CHARSET
=
latin5
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
...
@@ -156,7 +156,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
...
@@ -156,7 +156,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
SELECT
t11
.
comment
,
t12
.
comment
SELECT
t11
.
comment
,
t12
.
comment
FROM
t1
t11
,
t1
t12
FROM
t1
t11
,
t1
t12
WHERE
t11
.
koi8_ru_f
=
CONVERT
(
t12
.
utf8_f
USING
koi8_r
u
)
WHERE
t11
.
koi8_ru_f
=
CONVERT
(
t12
.
utf8_f
USING
koi8_r
)
ORDER
BY
t12
.
utf8_f
,
t11
.
comment
,
t12
.
comment
;
ORDER
BY
t12
.
utf8_f
,
t11
.
comment
,
t12
.
comment
;
ALTER
TABLE
t1
ADD
ucs2_f
CHAR
(
32
)
CHARACTER
SET
ucs2
;
ALTER
TABLE
t1
ADD
ucs2_f
CHAR
(
32
)
CHARACTER
SET
ucs2
;
...
...
mysys/charset.c
View file @
4e405fa2
...
@@ -21,6 +21,11 @@
...
@@ -21,6 +21,11 @@
#include <my_dir.h>
#include <my_dir.h>
#include <my_xml.h>
#include <my_xml.h>
static
void
set_max_sort_char
(
CHARSET_INFO
*
cs
);
static
my_bool
create_fromuni
(
CHARSET_INFO
*
cs
);
#define MY_CHARSET_INDEX "Index.xml"
#define MY_CHARSET_INDEX "Index.xml"
const
char
*
charsets_dir
=
NULL
;
const
char
*
charsets_dir
=
NULL
;
...
@@ -34,37 +39,6 @@ static int charset_initialized=0;
...
@@ -34,37 +39,6 @@ static int charset_initialized=0;
#define SORT_ORDER_TABLE_SIZE 256
#define SORT_ORDER_TABLE_SIZE 256
#define TO_UNI_TABLE_SIZE 256
#define TO_UNI_TABLE_SIZE 256
struct
simpleconfig_buf_st
{
FILE
*
f
;
char
buf
[
MAX_LINE
];
char
*
p
;
};
static
my_bool
get_word
(
struct
simpleconfig_buf_st
*
fb
,
char
*
buf
)
{
char
*
endptr
=
fb
->
p
;
for
(;;)
{
while
(
my_isspace
(
system_charset_info
,
*
endptr
))
++
endptr
;
if
(
*
endptr
&&
*
endptr
!=
'#'
)
/* Not comment */
break
;
/* Found something */
if
((
fgets
(
fb
->
buf
,
sizeof
(
fb
->
buf
),
fb
->
f
))
==
NULL
)
return
TRUE
;
/* end of file */
endptr
=
fb
->
buf
;
}
while
(
!
my_isspace
(
system_charset_info
,
*
endptr
))
*
buf
++=
*
endptr
++
;
*
buf
=
0
;
fb
->
p
=
endptr
;
return
FALSE
;
}
char
*
get_charsets_dir
(
char
*
buf
)
char
*
get_charsets_dir
(
char
*
buf
)
{
{
const
char
*
sharedir
=
SHAREDIR
;
const
char
*
sharedir
=
SHAREDIR
;
...
@@ -89,13 +63,14 @@ char *get_charsets_dir(char *buf)
...
@@ -89,13 +63,14 @@ char *get_charsets_dir(char *buf)
#define MAX_BUF 1024*16
#define MAX_BUF 1024*16
#ifndef DBUG_OFF
static
void
mstr
(
char
*
str
,
const
char
*
src
,
uint
l1
,
uint
l2
)
static
void
mstr
(
char
*
str
,
const
char
*
src
,
uint
l1
,
uint
l2
)
{
{
l1
=
l1
<
l2
?
l1
:
l2
;
l1
=
l1
<
l2
?
l1
:
l2
;
memcpy
(
str
,
src
,
l1
);
memcpy
(
str
,
src
,
l1
);
str
[
l1
]
=
'\0'
;
str
[
l1
]
=
'\0'
;
}
}
#endif
struct
my_cs_file_section_st
struct
my_cs_file_section_st
...
@@ -113,6 +88,11 @@ struct my_cs_file_section_st
...
@@ -113,6 +88,11 @@ struct my_cs_file_section_st
#define _CS_FLAG 7
#define _CS_FLAG 7
#define _CS_CHARSET 8
#define _CS_CHARSET 8
#define _CS_COLLATION 9
#define _CS_COLLATION 9
#define _CS_UPPERMAP 10
#define _CS_LOWERMAP 11
#define _CS_UNIMAP 12
#define _CS_COLLMAP 13
#define _CS_CTYPEMAP 14
static
struct
my_cs_file_section_st
sec
[]
=
static
struct
my_cs_file_section_st
sec
[]
=
{
{
...
@@ -126,11 +106,20 @@ static struct my_cs_file_section_st sec[] =
...
@@ -126,11 +106,20 @@ static struct my_cs_file_section_st sec[] =
{
_CS_NAME
,
"charsets.charset.name"
},
{
_CS_NAME
,
"charsets.charset.name"
},
{
_CS_FAMILY
,
"charsets.charset.family"
},
{
_CS_FAMILY
,
"charsets.charset.family"
},
{
_CS_MISC
,
"charsets.charset.alias"
},
{
_CS_MISC
,
"charsets.charset.alias"
},
{
_CS_MISC
,
"charsets.charset.ctype"
},
{
_CS_CTYPEMAP
,
"charsets.charset.ctype.map"
},
{
_CS_MISC
,
"charsets.charset.upper"
},
{
_CS_UPPERMAP
,
"charsets.charset.upper.map"
},
{
_CS_MISC
,
"charsets.charset.lower"
},
{
_CS_LOWERMAP
,
"charsets.charset.lower.map"
},
{
_CS_MISC
,
"charsets.charset.unicode"
},
{
_CS_UNIMAP
,
"charsets.charset.unicode.map"
},
{
_CS_COLLATION
,
"charsets.charset.collation"
},
{
_CS_COLLATION
,
"charsets.charset.collation"
},
{
_CS_COLNAME
,
"charsets.charset.collation.name"
},
{
_CS_COLNAME
,
"charsets.charset.collation.name"
},
{
_CS_ID
,
"charsets.charset.collation.id"
},
{
_CS_ID
,
"charsets.charset.collation.id"
},
{
_CS_ORDER
,
"charsets.charset.collation.order"
},
{
_CS_ORDER
,
"charsets.charset.collation.order"
},
{
_CS_FLAG
,
"charsets.charset.collation.flag"
},
{
_CS_FLAG
,
"charsets.charset.collation.flag"
},
{
_CS_COLLMAP
,
"charsets.charset.collation.map"
},
{
0
,
NULL
}
{
0
,
NULL
}
};
};
...
@@ -143,12 +132,134 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len)
...
@@ -143,12 +132,134 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len)
return
NULL
;
return
NULL
;
}
}
#define CS_MAX_NM_LEN 32
struct
my_cs_file_info
struct
my_cs_file_info
{
{
char
csname
[
CS_MAX_NM_LEN
];
char
name
[
CS_MAX_NM_LEN
];
uchar
ctype
[
CTYPE_TABLE_SIZE
];
uchar
to_lower
[
TO_LOWER_TABLE_SIZE
];
uchar
to_upper
[
TO_UPPER_TABLE_SIZE
];
uchar
sort_order
[
SORT_ORDER_TABLE_SIZE
];
uint16
tab_to_uni
[
TO_UNI_TABLE_SIZE
];
CHARSET_INFO
cs
;
CHARSET_INFO
cs
;
myf
myflags
;
myf
myflags
;
};
};
static
void
simple_cs_init_functions
(
CHARSET_INFO
*
cs
)
{
cs
->
like_range
=
my_like_range_simple
;
cs
->
wildcmp
=
my_wildcmp_8bit
;
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
;
cs
->
snprintf
=
my_snprintf_8bit
;
cs
->
strntol
=
my_strntol_8bit
;
cs
->
strntoul
=
my_strntoul_8bit
;
cs
->
strntoll
=
my_strntoll_8bit
;
cs
->
strntoull
=
my_strntoull_8bit
;
cs
->
strntod
=
my_strntod_8bit
;
cs
->
mbmaxlen
=
1
;
}
static
void
simple_cs_copy_data
(
CHARSET_INFO
*
to
,
CHARSET_INFO
*
from
)
{
to
->
number
=
from
->
number
?
from
->
number
:
to
->
number
;
to
->
state
|=
from
->
state
;
if
(
from
->
csname
)
to
->
csname
=
my_strdup
(
from
->
csname
,
MYF
(
MY_WME
));
if
(
from
->
name
)
to
->
name
=
my_strdup
(
from
->
name
,
MYF
(
MY_WME
));
if
(
from
->
ctype
)
{
to
->
ctype
=
(
uchar
*
)
my_once_alloc
(
CTYPE_TABLE_SIZE
,
MYF
(
MY_WME
));
memcpy
((
char
*
)
to
->
ctype
,(
char
*
)
from
->
ctype
,
CTYPE_TABLE_SIZE
);
}
if
(
from
->
to_lower
)
{
to
->
to_lower
=
(
uchar
*
)
my_once_alloc
(
TO_LOWER_TABLE_SIZE
,
MYF
(
MY_WME
));
memcpy
((
char
*
)
to
->
to_lower
,(
char
*
)
from
->
to_lower
,
TO_LOWER_TABLE_SIZE
);
}
if
(
from
->
to_upper
)
{
to
->
to_upper
=
(
uchar
*
)
my_once_alloc
(
TO_UPPER_TABLE_SIZE
,
MYF
(
MY_WME
));
memcpy
((
char
*
)
to
->
to_upper
,(
char
*
)
from
->
to_upper
,
TO_UPPER_TABLE_SIZE
);
}
if
(
from
->
sort_order
)
{
to
->
sort_order
=
(
uchar
*
)
my_once_alloc
(
SORT_ORDER_TABLE_SIZE
,
MYF
(
MY_WME
));
memcpy
((
char
*
)
to
->
sort_order
,(
char
*
)
from
->
sort_order
,
SORT_ORDER_TABLE_SIZE
);
set_max_sort_char
(
to
);
}
if
(
from
->
tab_to_uni
)
{
uint
sz
=
TO_UNI_TABLE_SIZE
*
sizeof
(
uint16
);
to
->
tab_to_uni
=
(
uint16
*
)
my_once_alloc
(
sz
,
MYF
(
MY_WME
));
memcpy
((
char
*
)
to
->
tab_to_uni
,(
char
*
)
from
->
tab_to_uni
,
sz
);
create_fromuni
(
to
);
}
}
static
my_bool
simple_cs_is_full
(
CHARSET_INFO
*
cs
)
{
return
(
cs
->
csname
&&
cs
->
tab_to_uni
&&
cs
->
ctype
&&
cs
->
to_upper
&&
cs
->
to_lower
)
&&
(
cs
->
number
&&
cs
->
name
&&
cs
->
sort_order
);
}
static
int
fill_uchar
(
uchar
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
{
uint
i
=
0
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
for
(
s
=
str
;
s
<
e
;
i
++
)
{
for
(
;
(
s
<
e
)
&&
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
);
b
=
s
;
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
);
if
(
s
==
b
)
break
;
if
(
i
>
size
)
break
;
a
[
i
]
=
my_strntoul
(
my_charset_latin1
,
b
,
s
-
b
,
NULL
,
16
);
}
return
0
;
}
static
int
fill_uint16
(
uint16
*
a
,
uint
size
,
const
char
*
str
,
uint
len
)
{
uint
i
=
0
;
const
char
*
s
,
*
b
,
*
e
=
str
+
len
;
char
buf
[
6
];
for
(
s
=
str
;
s
<
e
;
i
++
)
{
for
(
;
(
s
<
e
)
&&
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
);
b
=
s
;
for
(
;
(
s
<
e
)
&&
!
strchr
(
"
\t\r\n
"
,
s
[
0
]);
s
++
);
if
(
s
==
b
)
break
;
if
(
i
>
size
)
break
;
mstr
(
buf
,
b
,
6
,
s
-
b
);
a
[
i
]
=
my_strntol
(
my_charset_latin1
,
b
,
s
-
b
,
NULL
,
16
);
}
return
0
;
}
static
int
cs_enter
(
MY_XML_PARSER
*
st
,
const
char
*
attr
,
uint
len
)
static
int
cs_enter
(
MY_XML_PARSER
*
st
,
const
char
*
attr
,
uint
len
)
{
{
struct
my_cs_file_info
*
i
=
(
struct
my_cs_file_info
*
)
st
->
user_data
;
struct
my_cs_file_info
*
i
=
(
struct
my_cs_file_info
*
)
st
->
user_data
;
...
@@ -168,6 +279,8 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -168,6 +279,8 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len)
int
state
=
s
?
s
->
state
:
0
;
int
state
=
s
?
s
->
state
:
0
;
if
(
state
==
_CS_COLLATION
)
if
(
state
==
_CS_COLLATION
)
{
if
(
i
->
cs
.
name
&&
(
i
->
cs
.
number
||
(
i
->
cs
.
number
=
get_charset_number
(
i
->
cs
.
name
))))
{
{
if
(
!
all_charsets
[
i
->
cs
.
number
])
if
(
!
all_charsets
[
i
->
cs
.
number
])
{
{
...
@@ -176,14 +289,26 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -176,14 +289,26 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len)
{
{
return
MY_XML_ERROR
;
return
MY_XML_ERROR
;
}
}
all_charsets
[
i
->
cs
.
number
][
0
]
=
i
->
cs
;
bzero
((
void
*
)
all_charsets
[
i
->
cs
.
number
],
sizeof
(
CHARSET_INFO
))
;
}
}
else
if
(
!
(
all_charsets
[
i
->
cs
.
number
]
->
state
&
MY_CS_COMPILED
))
{
{
all_charsets
[
i
->
cs
.
number
]
->
state
|=
i
->
cs
.
state
;
simple_cs_copy_data
(
all_charsets
[
i
->
cs
.
number
],
&
i
->
cs
);
if
(
simple_cs_is_full
(
all_charsets
[
i
->
cs
.
number
]))
{
simple_cs_init_functions
(
all_charsets
[
i
->
cs
.
number
]);
all_charsets
[
i
->
cs
.
number
]
->
state
|=
MY_CS_LOADED
;
}
}
}
i
->
cs
.
number
=
0
;
i
->
cs
.
name
=
NULL
;
i
->
cs
.
state
=
0
;
i
->
cs
.
sort_order
=
NULL
;
i
->
cs
.
state
=
0
;
i
->
cs
.
state
=
0
;
}
}
}
return
MY_XML_OK
;
return
MY_XML_OK
;
}
}
...
@@ -193,12 +318,13 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -193,12 +318,13 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
struct
my_cs_file_section_st
*
s
;
struct
my_cs_file_section_st
*
s
;
int
state
=
(
s
=
cs_file_sec
(
st
->
attr
,
strlen
(
st
->
attr
)))
?
s
->
state
:
0
;
int
state
=
(
s
=
cs_file_sec
(
st
->
attr
,
strlen
(
st
->
attr
)))
?
s
->
state
:
0
;
if
(
0
)
#ifndef DBUG_OFF
{
if
(
0
)
{
char
str
[
256
];
char
str
[
1024
];
mstr
(
str
,
attr
,
len
,
sizeof
(
str
)
-
1
);
mstr
(
str
,
attr
,
len
,
sizeof
(
str
)
-
1
);
printf
(
"VALUE %d %s='%s'
\n
"
,
state
,
st
->
attr
,
str
);
printf
(
"VALUE %d %s='%s'
\n
"
,
state
,
st
->
attr
,
str
);
}
}
#endif
switch
(
state
)
switch
(
state
)
{
{
...
@@ -206,22 +332,39 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
...
@@ -206,22 +332,39 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
i
->
cs
.
number
=
my_strntoul
(
my_charset_latin1
,
attr
,
len
,(
char
**
)
NULL
,
0
);
i
->
cs
.
number
=
my_strntoul
(
my_charset_latin1
,
attr
,
len
,(
char
**
)
NULL
,
0
);
break
;
break
;
case
_CS_COLNAME
:
case
_CS_COLNAME
:
if
((
i
->
cs
.
name
=
(
char
*
)
my_once_alloc
(
len
+
1
,
i
->
myflags
)))
memcpy
(
i
->
name
,
attr
,
len
=
min
(
len
,
CS_MAX_NM_LEN
-
1
));
{
i
->
name
[
len
]
=
'\0'
;
memcpy
((
char
*
)
i
->
cs
.
name
,
attr
,
len
);
i
->
cs
.
name
=
i
->
name
;
((
char
*
)(
i
->
cs
.
name
))[
len
]
=
'\0'
;
}
break
;
break
;
case
_CS_NAME
:
case
_CS_NAME
:
if
((
i
->
cs
.
csname
=
(
char
*
)
my_once_alloc
(
len
+
1
,
i
->
myflags
)))
memcpy
(
i
->
csname
,
attr
,
len
=
min
(
len
,
CS_MAX_NM_LEN
-
1
));
{
i
->
csname
[
len
]
=
'\0'
;
memcpy
((
char
*
)
i
->
cs
.
csname
,
attr
,
len
);
i
->
cs
.
csname
=
i
->
csname
;
((
char
*
)(
i
->
cs
.
csname
))[
len
]
=
'\0'
;
}
break
;
break
;
case
_CS_FLAG
:
case
_CS_FLAG
:
if
(
!
strncmp
(
"primary"
,
attr
,
len
))
if
(
!
strncmp
(
"primary"
,
attr
,
len
))
i
->
cs
.
state
|=
MY_CS_PRIMARY
;
i
->
cs
.
state
|=
MY_CS_PRIMARY
;
break
;
case
_CS_UPPERMAP
:
fill_uchar
(
i
->
to_upper
,
TO_UPPER_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
to_upper
=
i
->
to_upper
;
break
;
case
_CS_LOWERMAP
:
fill_uchar
(
i
->
to_lower
,
TO_LOWER_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
to_lower
=
i
->
to_lower
;
break
;
case
_CS_UNIMAP
:
fill_uint16
(
i
->
tab_to_uni
,
TO_UNI_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
tab_to_uni
=
i
->
tab_to_uni
;
break
;
case
_CS_COLLMAP
:
fill_uchar
(
i
->
sort_order
,
SORT_ORDER_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
sort_order
=
i
->
sort_order
;
break
;
case
_CS_CTYPEMAP
:
fill_uchar
(
i
->
ctype
,
CTYPE_TABLE_SIZE
,
attr
,
len
);
i
->
cs
.
ctype
=
i
->
ctype
;
break
;
}
}
return
MY_XML_OK
;
return
MY_XML_OK
;
}
}
...
@@ -326,38 +469,6 @@ void free_charsets(void)
...
@@ -326,38 +469,6 @@ void free_charsets(void)
charset_initialized
=
0
;
charset_initialized
=
0
;
}
}
static
my_bool
fill_array
(
uchar
*
array
,
int
sz
,
struct
simpleconfig_buf_st
*
fb
)
{
char
buf
[
MAX_LINE
];
while
(
sz
--
)
{
if
(
get_word
(
fb
,
buf
))
{
DBUG_PRINT
(
"error"
,(
"get_word failed, expecting %d more words"
,
sz
+
1
));
return
1
;
}
*
array
++
=
(
uchar
)
strtol
(
buf
,
NULL
,
16
);
}
return
0
;
}
static
my_bool
fill_uint16_array
(
uint16
*
array
,
int
sz
,
struct
simpleconfig_buf_st
*
fb
)
{
char
buf
[
MAX_LINE
];
while
(
sz
--
)
{
if
(
get_word
(
fb
,
buf
))
{
DBUG_PRINT
(
"error"
,(
"get_word failed, expecting %d more words"
,
sz
+
1
));
return
1
;
}
*
array
++
=
(
uint16
)
strtol
(
buf
,
NULL
,
16
);
}
return
0
;
}
static
void
get_charset_conf_name
(
const
char
*
cs_name
,
char
*
buf
)
static
void
get_charset_conf_name
(
const
char
*
cs_name
,
char
*
buf
)
{
{
strxmov
(
get_charsets_dir
(
buf
),
cs_name
,
".conf"
,
NullS
);
strxmov
(
get_charsets_dir
(
buf
),
cs_name
,
".conf"
,
NullS
);
...
@@ -449,96 +560,6 @@ static my_bool create_fromuni(CHARSET_INFO *cs){
...
@@ -449,96 +560,6 @@ static my_bool create_fromuni(CHARSET_INFO *cs){
}
}
static
my_bool
read_charset_file
(
const
char
*
cs_name
,
CHARSET_INFO
*
set
,
myf
myflags
)
{
struct
simpleconfig_buf_st
fb
;
char
buf
[
FN_REFLEN
];
my_bool
result
;
DBUG_ENTER
(
"read_charset_file"
);
DBUG_PRINT
(
"enter"
,(
"cs_name: %s"
,
cs_name
));
get_charset_conf_name
(
cs_name
,
buf
);
DBUG_PRINT
(
"info"
,(
"file name: %s"
,
buf
));
if
((
fb
.
f
=
my_fopen
(
buf
,
O_RDONLY
,
myflags
))
==
NULL
)
DBUG_RETURN
(
TRUE
);
fb
.
buf
[
0
]
=
'\0'
;
/* Init for get_word */
fb
.
p
=
fb
.
buf
;
result
=
FALSE
;
if
(
fill_array
(
set
->
ctype
,
CTYPE_TABLE_SIZE
,
&
fb
)
||
fill_array
(
set
->
to_lower
,
TO_LOWER_TABLE_SIZE
,
&
fb
)
||
fill_array
(
set
->
to_upper
,
TO_UPPER_TABLE_SIZE
,
&
fb
)
||
fill_array
(
set
->
sort_order
,
SORT_ORDER_TABLE_SIZE
,
&
fb
)
||
fill_uint16_array
(
set
->
tab_to_uni
,
TO_UNI_TABLE_SIZE
,
&
fb
))
result
=
TRUE
;
my_fclose
(
fb
.
f
,
MYF
(
0
));
DBUG_RETURN
(
result
);
}
static
CHARSET_INFO
*
add_charset
(
CHARSET_INFO
*
cs
,
myf
flags
)
{
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 and cs->number are already initialized */
cs
->
ctype
=
tmp_ctype
;
cs
->
to_lower
=
tmp_to_lower
;
cs
->
to_upper
=
tmp_to_upper
;
cs
->
sort_order
=
tmp_sort_order
;
cs
->
tab_to_uni
=
tmp_to_uni
;
if
(
read_charset_file
(
cs
->
name
,
cs
,
flags
))
return
NULL
;
cs
->
ctype
=
(
uchar
*
)
my_once_alloc
(
CTYPE_TABLE_SIZE
,
MYF
(
MY_WME
));
cs
->
to_lower
=
(
uchar
*
)
my_once_alloc
(
TO_LOWER_TABLE_SIZE
,
MYF
(
MY_WME
));
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
));
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
));
memcpy
((
char
*
)
cs
->
sort_order
,
(
char
*
)
tmp_sort_order
,
sizeof
(
tmp_sort_order
));
memcpy
((
char
*
)
cs
->
tab_to_uni
,
(
char
*
)
tmp_to_uni
,
sizeof
(
tmp_to_uni
));
cs
->
like_range
=
my_like_range_simple
;
cs
->
wildcmp
=
my_wildcmp_8bit
;
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
;
cs
->
snprintf
=
my_snprintf_8bit
;
cs
->
strntol
=
my_strntol_8bit
;
cs
->
strntoul
=
my_strntoul_8bit
;
cs
->
strntoll
=
my_strntoll_8bit
;
cs
->
strntoull
=
my_strntoull_8bit
;
cs
->
strntod
=
my_strntod_8bit
;
cs
->
mbmaxlen
=
1
;
set_max_sort_char
(
cs
);
create_fromuni
(
cs
);
return
cs
;
}
uint
get_charset_number
(
const
char
*
charset_name
)
uint
get_charset_number
(
const
char
*
charset_name
)
{
{
CHARSET_INFO
**
cs
;
CHARSET_INFO
**
cs
;
...
@@ -569,6 +590,7 @@ const char *get_charset_name(uint charset_number)
...
@@ -569,6 +590,7 @@ const char *get_charset_name(uint charset_number)
static
CHARSET_INFO
*
get_internal_charset
(
uint
cs_number
,
myf
flags
)
static
CHARSET_INFO
*
get_internal_charset
(
uint
cs_number
,
myf
flags
)
{
{
char
buf
[
FN_REFLEN
];
CHARSET_INFO
*
cs
;
CHARSET_INFO
*
cs
;
/*
/*
To make things thread safe we are not allowing other threads to interfere
To make things thread safe we are not allowing other threads to interfere
...
@@ -577,9 +599,13 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
...
@@ -577,9 +599,13 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
pthread_mutex_lock
(
&
THR_LOCK_charset
);
pthread_mutex_lock
(
&
THR_LOCK_charset
);
cs
=
all_charsets
[
cs_number
];
cs
=
all_charsets
[
cs_number
];
if
(
cs
&&
!
(
cs
->
state
&
(
MY_CS_COMPILED
|
MY_CS_LOADED
)))
cs
=
add_charset
(
cs
,
flags
);
if
(
cs
&&
!
(
cs
->
state
&
(
MY_CS_COMPILED
|
MY_CS_LOADED
)))
{
strxmov
(
buf
,
cs
->
csname
,
".xml"
,
NullS
);
read_charset_index
(
buf
,
flags
);
cs
=
(
cs
->
state
&
MY_CS_LOADED
)
?
cs
:
NULL
;
}
pthread_mutex_unlock
(
&
THR_LOCK_charset
);
pthread_mutex_unlock
(
&
THR_LOCK_charset
);
return
cs
;
return
cs
;
}
}
...
...
sql/share/Makefile.am
View file @
4e405fa2
...
@@ -25,8 +25,7 @@ install-data-local:
...
@@ -25,8 +25,7 @@ install-data-local:
done
done
$(mkinstalldirs)
$(DESTDIR)$(pkgdatadir)
/charsets
$(mkinstalldirs)
$(DESTDIR)$(pkgdatadir)
/charsets
$(INSTALL_DATA)
$(srcdir)
/charsets/README
$(DESTDIR)$(pkgdatadir)
/charsets/README
$(INSTALL_DATA)
$(srcdir)
/charsets/README
$(DESTDIR)$(pkgdatadir)
/charsets/README
$(INSTALL_DATA)
$(srcdir)
/charsets/Index.xml
$(DESTDIR)$(pkgdatadir)
/charsets/Index.xml
$(INSTALL_DATA)
$(srcdir)
/charsets/
*
.xml
$(DESTDIR)$(pkgdatadir)
/charsets
$(INSTALL_DATA)
$(srcdir)
/charsets/
*
.conf
$(DESTDIR)$(pkgdatadir)
/charsets
fix_errors
:
fix_errors
:
for
lang
in
@AVAILABLE_LANGUAGES@
;
\
for
lang
in
@AVAILABLE_LANGUAGES@
;
\
...
...
strings/ctype-simple.c
View file @
4e405fa2
...
@@ -432,7 +432,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
...
@@ -432,7 +432,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
c
-=
'0'
;
c
-=
'0'
;
else
if
(
c
>=
'A'
&&
c
<=
'F'
)
else
if
(
c
>=
'A'
&&
c
<=
'F'
)
c
=
c
-
'A'
+
10
;
c
=
c
-
'A'
+
10
;
else
if
(
c
>=
'a'
&&
c
<=
'
a
'
)
else
if
(
c
>=
'a'
&&
c
<=
'
f
'
)
c
=
c
-
'a'
+
10
;
c
=
c
-
'a'
+
10
;
else
else
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment