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
2bd854c8
Commit
2bd854c8
authored
Jan 11, 2005
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #7730 Server crash using soundex on an utf8 table
Don't use my_tolower: it works only for 8bit charsets.
parent
8b3b3648
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
5 deletions
+31
-5
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+12
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+9
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+10
-5
No files found.
mysql-test/r/ctype_utf8.result
View file @
2bd854c8
...
...
@@ -817,3 +817,15 @@ drop table t1;
select 'c' like '\_' as want0;
want0
0
create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
insert into t1 values (1, 'Test');
select * from t1 where soundex(a) = soundex('Test');
id a
1 Test
select * from t1 where soundex(a) = soundex('TEST');
id a
1 Test
select * from t1 where soundex(a) = soundex('test');
id a
1 Test
drop table t1;
mysql-test/t/ctype_utf8.test
View file @
2bd854c8
...
...
@@ -666,3 +666,12 @@ drop table t1;
#
select
'c'
like
'\_'
as
want0
;
#
# Bug #7730 Server crash using soundex on an utf8 table
#
create
table
t1
(
id
integer
,
a
varchar
(
100
)
character
set
utf8
collate
utf8_unicode_ci
);
insert
into
t1
values
(
1
,
'Test'
);
select
*
from
t1
where
soundex
(
a
)
=
soundex
(
'Test'
);
select
*
from
t1
where
soundex
(
a
)
=
soundex
(
'TEST'
);
select
*
from
t1
where
soundex
(
a
)
=
soundex
(
'test'
);
drop
table
t1
;
sql/item_strfunc.cc
View file @
2bd854c8
...
...
@@ -1562,9 +1562,14 @@ void Item_func_soundex::fix_length_and_dec()
else return 0
*/
static
char
get_scode
(
CHARSET_INFO
*
cs
,
char
*
ptr
)
static
char
soundex_toupper
(
char
ch
)
{
uchar
ch
=
my_toupper
(
cs
,
*
ptr
);
return
(
ch
>=
'a'
&&
ch
<=
'z'
)
?
ch
-
'a'
+
'A'
:
ch
;
}
static
char
get_scode
(
char
*
ptr
)
{
uchar
ch
=
soundex_toupper
(
*
ptr
);
if
(
ch
<
'A'
||
ch
>
'Z'
)
{
// Thread extended alfa (country spec)
...
...
@@ -1594,8 +1599,8 @@ String *Item_func_soundex::val_str(String *str)
from
++
;
/* purecov: inspected */
if
(
from
==
end
)
return
&
my_empty_string
;
// No alpha characters.
*
to
++
=
my_toupper
(
cs
,
*
from
);
// Copy first letter
last_ch
=
get_scode
(
cs
,
from
);
// code of the first letter
*
to
++
=
soundex_toupper
(
*
from
);
// Copy first letter
last_ch
=
get_scode
(
from
);
// code of the first letter
// for the first 'double-letter check.
// Loop on input letters until
// end of input (null) or output
...
...
@@ -1604,7 +1609,7 @@ String *Item_func_soundex::val_str(String *str)
{
if
(
!
my_isalpha
(
cs
,
*
from
))
continue
;
ch
=
get_scode
(
cs
,
from
);
ch
=
get_scode
(
from
);
if
((
ch
!=
'0'
)
&&
(
ch
!=
last_ch
))
// if not skipped or double
{
*
to
++
=
ch
;
// letter, copy to output
...
...
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