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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4b9d29c8
Commit
4b9d29c8
authored
Jan 16, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strnxfrm() for simple and binary charsets fixes
parent
e79ed81d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
58 deletions
+29
-58
sql/field.cc
sql/field.cc
+4
-34
strings/ctype-simple.c
strings/ctype-simple.c
+2
-1
strings/ctype.c
strings/ctype.c
+23
-23
No files found.
sql/field.cc
View file @
4b9d29c8
...
...
@@ -3964,23 +3964,11 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void
Field_string
::
sort_string
(
char
*
to
,
uint
length
)
{
if
(
binary
())
memcpy
((
byte
*
)
to
,(
byte
*
)
ptr
,(
size_t
)
length
);
else
{
#ifdef USE_STRCOLL
if
(
use_strnxfrm
(
field_charset
))
{
uint
tmp
=
my_strnxfrm
(
field_charset
,
uint
tmp
=
my_strnxfrm
(
field_charset
,
(
unsigned
char
*
)
to
,
length
,
(
unsigned
char
*
)
ptr
,
field_length
);
if
(
tmp
<
length
)
bzero
(
to
+
tmp
,
length
-
tmp
);
}
else
#endif
for
(
char
*
from
=
ptr
,
*
end
=
ptr
+
length
;
from
!=
end
;)
*
to
++=
(
char
)
field_charset
->
sort_order
[(
uint
)
(
uchar
)
*
from
++
];
}
if
(
tmp
<
length
)
bzero
(
to
+
tmp
,
length
-
tmp
);
}
...
...
@@ -4145,27 +4133,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
void
Field_varstring
::
sort_string
(
char
*
to
,
uint
length
)
{
uint
tot_length
=
uint2korr
(
ptr
);
if
(
binary
())
memcpy
((
byte
*
)
to
,(
byte
*
)
ptr
+
2
,(
size_t
)
tot_length
);
else
{
#ifdef USE_STRCOLL
if
(
use_strnxfrm
(
field_charset
))
tot_length
=
my_strnxfrm
(
field_charset
,
tot_length
=
my_strnxfrm
(
field_charset
,
(
unsigned
char
*
)
to
,
length
,
(
unsigned
char
*
)
ptr
+
2
,
tot_length
);
else
{
#endif
char
*
tmp
=
to
;
if
(
tot_length
>
length
)
tot_length
=
length
;
for
(
char
*
from
=
ptr
+
2
,
*
end
=
from
+
tot_length
;
from
!=
end
;)
*
tmp
++=
(
char
)
field_charset
->
sort_order
[(
uint
)
(
uchar
)
*
from
++
];
#ifdef USE_STRCOLL
}
#endif
}
if
(
tot_length
<
length
)
bzero
(
to
+
tot_length
,
length
-
tot_length
);
}
...
...
strings/ctype-simple.c
View file @
4b9d29c8
...
...
@@ -29,10 +29,11 @@ int my_strnxfrm_simple(CHARSET_INFO * cs,
const
uchar
*
src
,
uint
srclen
)
{
uchar
*
map
=
cs
->
sort_order
;
const
uchar
*
end
;
DBUG_ASSERT
(
len
>=
srclen
);
len
=
min
(
len
,
srclen
);
for
(
;
len
>
0
;
len
--
)
for
(
end
=
src
+
len
;
src
<
end
;
)
*
dest
++=
map
[
*
src
++
];
return
len
;
}
...
...
strings/ctype.c
View file @
4b9d29c8
...
...
@@ -2823,7 +2823,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -2869,7 +2869,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -2914,7 +2914,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1257
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -2959,7 +2959,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3005,7 +3005,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3050,7 +3050,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3095,7 +3095,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3140,7 +3140,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3186,7 +3186,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3231,7 +3231,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3276,7 +3276,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3321,7 +3321,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3366,7 +3366,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3411,7 +3411,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_r
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3456,7 +3456,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_u
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3502,7 +3502,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3547,7 +3547,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_9
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3593,7 +3593,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3639,7 +3639,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_us_ascii
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3684,7 +3684,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1250
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3729,7 +3729,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3774,7 +3774,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_armscii_8
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
@@ -3819,7 +3819,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251
,
/* tab_from_uni */
0
,
/* strxfrm_multiply */
my_strnncoll_simple
,
/* strnncoll */
NULL
,
/* strnxfrm */
my_strnxfrm_simple
,
/* strnxfrm */
my_like_range_simple
,
/* like_range */
my_wildcmp_8bit
,
/* wildcmp */
1
,
/* mbmaxlen */
...
...
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