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
aafca9f0
Commit
aafca9f0
authored
Jan 08, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
An improvement of the fix for the bug #2231: string column,
INDEX+LIKE, don't take the ESCAPE character. (ver. 2)
parent
824111e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
mysql-test/r/func_like.result
mysql-test/r/func_like.result
+3
-0
mysql-test/t/func_like.test
mysql-test/t/func_like.test
+1
-0
sql/opt_range.cc
sql/opt_range.cc
+17
-15
No files found.
mysql-test/r/func_like.result
View file @
aafca9f0
...
...
@@ -42,4 +42,7 @@ 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 @
aafca9f0
...
...
@@ -29,4 +29,5 @@ 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
'#'
;
select
*
from
t1
where
a
like
'a\\%'
escape
'#'
and
a
like
'a\\\\b'
;
drop
table
t1
;
sql/opt_range.cc
View file @
aafca9f0
...
...
@@ -290,7 +290,7 @@ typedef struct st_qsel_param {
char
min_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
],
max_key
[
MAX_KEY_LENGTH
+
MAX_FIELD_WIDTH
];
bool
quick
;
// Don't calulate possible keys
char
escape
;
COND
*
cond
;
}
PARAM
;
static
SEL_TREE
*
get_mm_parts
(
PARAM
*
param
,
Field
*
field
,
...
...
@@ -638,9 +638,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
param
.
table
=
head
;
param
.
keys
=
0
;
param
.
mem_root
=
&
alloc
;
if
(
cond
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
cond
)
->
functype
()
==
Item_func
::
LIKE_FUNC
)
param
.
escape
=
((
Item_func_like
*
)
cond
)
->
escape
;
param
.
thd
->
no_errors
=
1
;
// Don't warn about NULL
init_sql_alloc
(
&
alloc
,
param
.
thd
->
variables
.
range_alloc_block_size
,
0
);
if
(
!
(
param
.
key_parts
=
(
KEY_PART
*
)
alloc_root
(
&
alloc
,
...
...
@@ -821,6 +818,8 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
DBUG_RETURN
(
0
);
// Can't be calculated
param
->
cond
=
cond
;
if
(
cond_func
->
functype
()
==
Item_func
::
BETWEEN
)
{
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
...
...
@@ -997,23 +996,26 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if
(
maybe_null
)
max_str
[
0
]
=
min_str
[
0
]
=
0
;
if
(
field
->
binary
())
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
param
->
escape
,
field_length
,
min_str
+
offset
,
max_str
+
offset
,(
char
)
255
,
&
min_length
,
&
max_length
);
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
field_length
,
min_str
+
offset
,
max_str
+
offset
,
(
char
)
255
,
&
min_length
,
&
max_length
);
else
{
#ifdef USE_STRCOLL
if
(
use_strcoll
(
default_charset_info
))
like_error
=
my_like_range
(
default_charset_info
,
res
->
ptr
(),
res
->
length
(),
param
->
escape
,
field_length
,
min_str
+
maybe_null
,
max_str
+
maybe_null
,
&
min_length
,
&
max_length
);
like_error
=
my_like_range
(
default_charset_info
,
res
->
ptr
(),
res
->
length
(),
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
field_length
,
min_str
+
maybe_null
,
max_str
+
maybe_null
,
&
min_length
,
&
max_length
);
else
#endif
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
(),
param
->
escape
,
field_length
,
min_str
+
offset
,
max_str
+
offset
,
max_sort_char
,
&
min_length
,
&
max_length
);
like_error
=
like_range
(
res
->
ptr
(),
res
->
length
()
,
((
Item_func_like
*
)(
param
->
cond
))
->
escape
,
field_length
,
min_str
+
offset
,
max_str
+
offset
,
max_sort_char
,
&
min_length
,
&
max_length
);
}
if
(
like_error
)
// Can't optimize with LIKE
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