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
8178bd4e
Commit
8178bd4e
authored
Jan 09, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.0
into gw.mysql.r18.ru:/usr/home/ram/work/4.0.b2231
parents
18036f98
75df0172
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
17 deletions
+40
-17
mysql-test/r/func_like.result
mysql-test/r/func_like.result
+9
-0
mysql-test/t/func_like.test
mysql-test/t/func_like.test
+10
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+4
-5
sql/opt_range.cc
sql/opt_range.cc
+17
-12
No files found.
mysql-test/r/func_like.result
View file @
8178bd4e
...
@@ -37,3 +37,12 @@ select * from t1 where a like "%abc\d%";
...
@@ -37,3 +37,12 @@ select * from t1 where a like "%abc\d%";
a
a
abcd
abcd
drop table t1;
drop table t1;
create table t1 (a varchar(10), key(a));
insert into t1 values ('a'), ('a\\b');
select * from t1 where a like 'a\\%' escape '#';
a
a\b
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
a
a\b
drop table t1;
mysql-test/t/func_like.test
View file @
8178bd4e
...
@@ -21,3 +21,13 @@ select * from t1 where a like "%abcd%";
...
@@ -21,3 +21,13 @@ select * from t1 where a like "%abcd%";
select
*
from
t1
where
a
like
"%abc\d%"
;
select
*
from
t1
where
a
like
"%abc\d%"
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #2231
#
create
table
t1
(
a
varchar
(
10
),
key
(
a
));
insert
into
t1
values
(
'a'
),
(
'a\\b'
);
select
*
from
t1
where
a
like
'a\\%'
escape
'#'
;
select
*
from
t1
where
a
like
'a\\%'
escape
'#'
and
a
like
'a\\\\b'
;
drop
table
t1
;
sql/item_cmpfunc.h
View file @
8178bd4e
...
@@ -505,8 +505,6 @@ public:
...
@@ -505,8 +505,6 @@ public:
class
Item_func_like
:
public
Item_bool_func2
class
Item_func_like
:
public
Item_bool_func2
{
{
char
escape
;
// Turbo Boyer-Moore data
// Turbo Boyer-Moore data
bool
canDoTurboBM
;
// pattern is '%abcd%' case
bool
canDoTurboBM
;
// pattern is '%abcd%' case
const
char
*
pattern
;
const
char
*
pattern
;
...
@@ -523,10 +521,11 @@ class Item_func_like :public Item_bool_func2
...
@@ -523,10 +521,11 @@ class Item_func_like :public Item_bool_func2
enum
{
alphabet_size
=
256
};
enum
{
alphabet_size
=
256
};
public:
public:
char
escape
;
Item_func_like
(
Item
*
a
,
Item
*
b
,
char
*
escape_arg
)
Item_func_like
(
Item
*
a
,
Item
*
b
,
char
*
escape_arg
)
:
Item_bool_func2
(
a
,
b
),
escape
(
*
escape_arg
),
canDoTurboBM
(
false
),
:
Item_bool_func2
(
a
,
b
),
canDoTurboBM
(
false
),
pattern
(
0
),
pattern_len
(
0
),
pattern
(
0
),
pattern_len
(
0
),
bmGs
(
0
),
bmBc
(
0
)
bmGs
(
0
),
bmBc
(
0
),
escape
(
*
escape_arg
)
{}
{}
longlong
val_int
();
longlong
val_int
();
enum
Functype
functype
()
const
{
return
LIKE_FUNC
;
}
enum
Functype
functype
()
const
{
return
LIKE_FUNC
;
}
optimize_type
select_optimize
()
const
;
optimize_type
select_optimize
()
const
;
...
...
sql/opt_range.cc
View file @
8178bd4e
...
@@ -290,6 +290,7 @@ typedef struct st_qsel_param {
...
@@ -290,6 +290,7 @@ typedef struct st_qsel_param {
char
min_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
],
char
min_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
],
max_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
];
max_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
];
bool
quick
;
// Don't calulate possible keys
bool
quick
;
// Don't calulate possible keys
COND
*
cond
;
}
PARAM
;
}
PARAM
;
static
SEL_TREE
*
get_mm_parts
(
PARAM
*
param
,
Field
*
field
,
static
SEL_TREE
*
get_mm_parts
(
PARAM
*
param
,
Field
*
field
,
...
@@ -637,7 +638,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
...
@@ -637,7 +638,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
param
.
table
=
head
;
param
.
table
=
head
;
param
.
keys
=
0
;
param
.
keys
=
0
;
param
.
mem_root
=
&
alloc
;
param
.
mem_root
=
&
alloc
;
param
.
thd
->
no_errors
=
1
;
// Don't warn about NULL
param
.
thd
->
no_errors
=
1
;
// Don't warn about NULL
init_sql_alloc
(
&
alloc
,
param
.
thd
->
variables
.
range_alloc_block_size
,
0
);
init_sql_alloc
(
&
alloc
,
param
.
thd
->
variables
.
range_alloc_block_size
,
0
);
if
(
!
(
param
.
key_parts
=
(
KEY_PART
*
)
alloc_root
(
&
alloc
,
if
(
!
(
param
.
key_parts
=
(
KEY_PART
*
)
alloc_root
(
&
alloc
,
...
@@ -818,6 +818,8 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
...
@@ -818,6 +818,8 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
DBUG_RETURN
(
0
);
// Can't be calculated
DBUG_RETURN
(
0
);
// Can't be calculated
param
->
cond
=
cond
;
if
(
cond_func
->
functype
()
==
Item_func
::
BETWEEN
)
if
(
cond_func
->
functype
()
==
Item_func
::
BETWEEN
)
{
{
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
...
@@ -994,23 +996,26 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
...
@@ -994,23 +996,26 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if
(
maybe_null
)
if
(
maybe_null
)
max_str
[
0
]
=
min_str
[
0
]
=
0
;
max_str
[
0
]
=
min_str
[
0
]
=
0
;
if
(
field
->
binary
())
if
(
field
->
binary
())
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
wild_prefix
,
field_length
,
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
min_str
+
offset
,
max_str
+
offset
,(
char
)
255
,
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
&
min_length
,
&
max_length
);
field_length
,
min_str
+
offset
,
max_str
+
offset
,
(
char
)
255
,
&
min_length
,
&
max_length
);
else
else
{
{
#ifdef USE_STRCOLL
#ifdef USE_STRCOLL
if
(
use_strcoll
(
default_charset_info
))
if
(
use_strcoll
(
default_charset_info
))
like_error
=
my_like_range
(
default_charset_info
,
like_error
=
my_like_range
(
default_charset_info
,
res
->
ptr
(),
res
->
ptr
(),
res
->
length
(),
wild_prefix
,
res
->
length
(),
field_length
,
min_str
+
maybe_null
,
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
max_str
+
maybe_null
,
&
min_length
,
&
max_length
);
field_length
,
min_str
+
maybe_null
,
max_str
+
maybe_null
,
&
min_length
,
&
max_length
);
else
else
#endif
#endif
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
wild_prefix
,
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
()
,
field_length
,
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
min_str
+
offset
,
max_str
+
offset
,
field_length
,
min_str
+
offset
,
max_str
+
offset
,
max_sort_char
,
&
min_length
,
&
max_length
);
max_sort_char
,
&
min_length
,
&
max_length
);
}
}
if
(
like_error
)
// Can't optimize with LIKE
if
(
like_error
)
// Can't optimize with LIKE
DBUG_RETURN
(
0
);
DBUG_RETURN
(
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