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
a0ddff9c
Commit
a0ddff9c
authored
Sep 07, 2005
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/bar/mysql-4.1.b12611
parents
2ff61bd6
d40278e0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
2 deletions
+71
-2
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+4
-0
mysql-test/r/func_like.result
mysql-test/r/func_like.result
+7
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+6
-0
mysql-test/t/func_like.test
mysql-test/t/func_like.test
+17
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+36
-1
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
No files found.
mysql-test/r/ctype_utf8.result
View file @
a0ddff9c
...
@@ -955,6 +955,10 @@ char_length(a) length(a) a
...
@@ -955,6 +955,10 @@ char_length(a) length(a) a
2 4 ан
2 4 ан
drop table t1;
drop table t1;
set names utf8;
set names utf8;
select 'andre%' like 'andreñ%' escape 'ñ';
'andre%' like 'andreñ%' escape 'ñ'
1
set names utf8;
select 'a\\' like 'a\\';
select 'a\\' like 'a\\';
'a\\' like 'a\\'
'a\\' like 'a\\'
1
1
...
...
mysql-test/r/func_like.result
View file @
a0ddff9c
...
@@ -158,3 +158,10 @@ DROP TABLE t1;
...
@@ -158,3 +158,10 @@ DROP TABLE t1;
select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
_cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin
_cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin
1
1
set names koi8r;
select 'andre%' like 'andre%' escape '';
'andre%' like 'andre%' escape ''
1
select _cp1251'andre%' like convert('andre%' using cp1251) escape '';
_cp1251'andre%' like convert('andre%' using cp1251) escape ''
1
mysql-test/t/ctype_utf8.test
View file @
a0ddff9c
...
@@ -810,6 +810,12 @@ alter table t1 modify a char(2) character set utf8;
...
@@ -810,6 +810,12 @@ alter table t1 modify a char(2) character set utf8;
select
char_length
(
a
),
length
(
a
),
a
from
t1
order
by
a
;
select
char_length
(
a
),
length
(
a
),
a
from
t1
order
by
a
;
drop
table
t1
;
drop
table
t1
;
#
# Bugs#12611
# ESCAPE + LIKE do not work when the escape char is a multibyte one
#
set
names
utf8
;
select
'andre%'
like
'andreñ%'
escape
'ñ'
;
#
#
# Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0
# Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0
...
...
mysql-test/t/func_like.test
View file @
a0ddff9c
...
@@ -96,4 +96,21 @@ DROP TABLE t1;
...
@@ -96,4 +96,21 @@ DROP TABLE t1;
#
#
select
_cp866
'aaaaaaaaa'
like
_cp866
'%aaaa%'
collate
cp866_bin
;
select
_cp866
'aaaaaaaaa'
like
_cp866
'%aaaa%'
collate
cp866_bin
;
#
# Check 8bit escape character
#
set
names
koi8r
;
select
'andre%'
like
'andre%'
escape
''
;
# Check 8bit escape character with charset conversion:
# For "a LIKE b ESCAPE c" expressions,
# escape character is converted into the operation character set,
# which is result of aggregation of character sets of "a" and "b".
# "c" itself doesn't take part in aggregation, because its collation
# doesn't matter, escape character is always compared binary.
# In the example below, escape character is converted from koi8r into cp1251:
#
select
_cp1251
'andre%'
like
convert
(
'andre%'
using
cp1251
)
escape
''
;
#
# End of 4.1 tests
# End of 4.1 tests
sql/item_cmpfunc.cc
View file @
a0ddff9c
...
@@ -2293,7 +2293,42 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
...
@@ -2293,7 +2293,42 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
{
{
/* If we are on execution stage */
/* If we are on execution stage */
String
*
escape_str
=
escape_item
->
val_str
(
&
tmp_value1
);
String
*
escape_str
=
escape_item
->
val_str
(
&
tmp_value1
);
escape
=
escape_str
?
*
(
escape_str
->
ptr
())
:
'\\'
;
if
(
escape_str
)
{
CHARSET_INFO
*
cs
=
cmp
.
cmp_collation
.
collation
;
if
(
use_mb
(
cs
))
{
my_wc_t
wc
;
int
rc
=
cs
->
cset
->
mb_wc
(
cs
,
&
wc
,
(
const
uchar
*
)
escape_str
->
ptr
(),
(
const
uchar
*
)
escape_str
->
ptr
()
+
escape_str
->
length
());
escape
=
(
int
)
(
rc
>
0
?
wc
:
'\\'
);
}
else
{
/*
In the case of 8bit character set, we pass native
code instead of Unicode code as "escape" argument.
Convert to "cs" if charset of escape differs.
*/
uint32
unused
;
if
(
escape_str
->
needs_conversion
(
escape_str
->
length
(),
escape_str
->
charset
(),
cs
,
&
unused
))
{
char
ch
;
uint
errors
;
uint32
cnvlen
=
copy_and_convert
(
&
ch
,
1
,
cs
,
escape_str
->
ptr
(),
escape_str
->
length
(),
escape_str
->
charset
(),
&
errors
);
escape
=
cnvlen
?
ch
:
'\\'
;
}
else
escape
=
*
(
escape_str
->
ptr
());
}
}
else
escape
=
'\\'
;
/*
/*
We could also do boyer-more for non-const items, but as we would have to
We could also do boyer-more for non-const items, but as we would have to
...
...
sql/item_cmpfunc.h
View file @
a0ddff9c
...
@@ -879,7 +879,7 @@ class Item_func_like :public Item_bool_func2
...
@@ -879,7 +879,7 @@ class Item_func_like :public Item_bool_func2
Item
*
escape_item
;
Item
*
escape_item
;
public:
public:
char
escape
;
int
escape
;
Item_func_like
(
Item
*
a
,
Item
*
b
,
Item
*
escape_arg
)
Item_func_like
(
Item
*
a
,
Item
*
b
,
Item
*
escape_arg
)
:
Item_bool_func2
(
a
,
b
),
canDoTurboBM
(
FALSE
),
pattern
(
0
),
pattern_len
(
0
),
:
Item_bool_func2
(
a
,
b
),
canDoTurboBM
(
FALSE
),
pattern
(
0
),
pattern_len
(
0
),
...
...
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