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
a65342f3
Commit
a65342f3
authored
Sep 09, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post-pushbuild corrections for fix of bug #21698.
parent
21be389b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
8 deletions
+35
-8
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+2
-2
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+2
-2
sql/item.h
sql/item.h
+27
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-1
sql/item_func.cc
sql/item_func.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-2
No files found.
mysql-test/r/func_str.result
View file @
a65342f3
...
...
@@ -1136,12 +1136,12 @@ ALTER TABLE t1 ADD INDEX (code);
CREATE TABLE t2 (id varchar(10) PRIMARY KEY);
INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14');
SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id
WHERE t2.id='a12' AND (
code < 'a00' OR LENGTH(code)=5
);
WHERE t2.id='a12' AND (
LENGTH(code)=5 OR code < 'a00'
);
code id
A12 a12
EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON code=id
WHERE id='a12' AND (
code < 'a00' OR LENGTH(code)=5
);
WHERE id='a12' AND (
LENGTH(code)=5 OR code < 'a00'
);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref code code 13 const 3 Using where; Using index
1 SIMPLE t2 ref PRIMARY PRIMARY 12 const 1 Using where; Using index
...
...
mysql-test/t/func_str.test
View file @
a65342f3
...
...
@@ -773,10 +773,10 @@ CREATE TABLE t2 (id varchar(10) PRIMARY KEY);
INSERT
INTO
t2
VALUES
(
'a11'
),
(
'a12'
),
(
'a13'
),
(
'a14'
);
SELECT
*
FROM
t1
INNER
JOIN
t2
ON
t1
.
code
=
t2
.
id
WHERE
t2
.
id
=
'a12'
AND
(
code
<
'a00'
OR
LENGTH
(
code
)
=
5
);
WHERE
t2
.
id
=
'a12'
AND
(
LENGTH
(
code
)
=
5
OR
code
<
'a00'
);
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
INNER
JOIN
t2
ON
code
=
id
WHERE
id
=
'a12'
AND
(
code
<
'a00'
OR
LENGTH
(
code
)
=
5
);
WHERE
id
=
'a12'
AND
(
LENGTH
(
code
)
=
5
OR
code
<
'a00'
);
DROP
TABLE
t1
,
t2
;
...
...
sql/item.h
View file @
a65342f3
...
...
@@ -411,6 +411,17 @@ class Settable_routine_parameter
typedef
bool
(
Item
::*
Item_processor
)
(
byte
*
arg
);
/*
Analyzer function
SYNOPSIS
argp in/out IN: Analysis parameter
OUT: Parameter to be passed to the transformer
RETURN
TRUE Invoke the transformer
FALSE Don't do it
*/
typedef
bool
(
Item
::*
Item_analyzer
)
(
byte
**
argp
);
typedef
Item
*
(
Item
::*
Item_transformer
)
(
byte
*
arg
);
typedef
void
(
*
Cond_traverser
)
(
const
Item
*
item
,
void
*
arg
);
...
...
@@ -740,6 +751,22 @@ class Item {
return
(
this
->*
transformer
)(
arg
);
}
/*
This function performs a generic "compilation" of the Item tree.
The process of compilation is assumed to go as follows:
compile()
{
if (this->*some_analyzer(...))
{
compile children if any;
this->*some_transformer(...);
}
}
i.e. analysis is performed top-down while transformation is done
bottom-up.
*/
virtual
Item
*
compile
(
Item_analyzer
analyzer
,
byte
**
arg_p
,
Item_transformer
transformer
,
byte
*
arg_t
)
{
...
...
sql/item_cmpfunc.cc
View file @
a65342f3
...
...
@@ -2811,7 +2811,6 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
if
(
!
(
this
->*
analyzer
)(
arg_p
))
return
0
;
byte
*
arg_v
=
*
arg_p
;
List_iterator
<
Item
>
li
(
list
);
Item
*
item
;
while
((
item
=
li
++
))
...
...
@@ -2820,6 +2819,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
The same parameter value of arg_p must be passed
to analyze any argument of the condition formula.
*/
byte
*
arg_v
=
*
arg_p
;
Item
*
new_item
=
item
->
compile
(
analyzer
,
&
arg_v
,
transformer
,
arg_t
);
if
(
new_item
&&
new_item
!=
item
)
li
.
replace
(
new_item
);
...
...
sql/item_func.cc
View file @
a65342f3
...
...
@@ -304,7 +304,6 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p,
{
if
(
!
(
this
->*
analyzer
)(
arg_p
))
return
0
;
byte
*
arg_v
=
*
arg_p
;
if
(
arg_count
)
{
Item
**
arg
,
**
arg_end
;
...
...
@@ -314,6 +313,7 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p,
The same parameter value of arg_p must be passed
to analyze any argument of the condition formula.
*/
byte
*
arg_v
=
*
arg_p
;
Item
*
new_item
=
(
*
arg
)
->
compile
(
analyzer
,
&
arg_v
,
transformer
,
arg_t
);
if
(
new_item
&&
*
arg
!=
new_item
)
current_thd
->
change_item_tree
(
arg
,
new_item
);
...
...
sql/sql_select.cc
View file @
a65342f3
...
...
@@ -6919,9 +6919,9 @@ static COND *build_equal_items_for_cond(COND *cond,
as soon the field is not of a string type or the field reference is
an argument of a comparison predicate.
*/
byte
*
dummy
;
byte
*
is_subst_valid
=
(
byte
*
)
1
;
cond
=
cond
->
compile
(
&
Item
::
subst_argument_checker
,
&
dummy
,
&
is_subst_valid
,
&
Item
::
equal_fields_propagator
,
(
byte
*
)
inherited
);
cond
->
update_used_tables
();
...
...
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