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
8fefb368
Commit
8fefb368
authored
Nov 03, 2005
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merged
parents
69d985cc
96ff1e80
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
12 deletions
+60
-12
mysql-test/r/view.result
mysql-test/r/view.result
+22
-1
mysql-test/t/view.test
mysql-test/t/view.test
+8
-1
sql/sql_lex.cc
sql/sql_lex.cc
+30
-10
No files found.
mysql-test/r/view.result
View file @
8fefb368
drop table if exists t1,t2,t9,`t1a``b`,v1,v2,v3,v4,v5,v6;
drop table if exists t1,t2,t
3,t4,t
9,`t1a``b`,v1,v2,v3,v4,v5,v6;
drop view if exists t1,t2,`t1a``b`,v1,v2,v3,v4,v5,v6;
drop database if exists mysqltest;
use test;
...
...
@@ -2323,6 +2323,27 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3;
create table t1 (x int, y int);
create table t2 (x int, y int, z int);
create table t3 (x int, y int, z int);
create table t4 (x int, y int, z int);
create view v1 as
select t1.x
from (
(t1 join t2 on ((t1.y = t2.y)))
join
(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
);
prepare stmt1 from "select count(*) from v1 where x = ?";
set @parm1=1;
execute stmt1 using @parm1;
count(*)
0
execute stmt1 using @parm1;
count(*)
0
drop view v1;
drop table t1,t2,t3,t4;
create table t1 (f1 int, f2 int);
insert into t1 values(1,1),(1,2),(1,3);
create view v1 as select f1 ,group_concat(f2 order by f2 asc) from t1 group by f1;
...
...
mysql-test/t/view.test
View file @
8fefb368
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t9
,
`t1a``b`
,
v1
,
v2
,
v3
,
v4
,
v5
,
v6
;
drop
table
if
exists
t1
,
t2
,
t
3
,
t4
,
t
9
,
`t1a``b`
,
v1
,
v2
,
v3
,
v4
,
v5
,
v6
;
drop
view
if
exists
t1
,
t2
,
`t1a``b`
,
v1
,
v2
,
v3
,
v4
,
v5
,
v6
;
drop
database
if
exists
mysqltest
;
--
enable_warnings
...
...
@@ -2190,6 +2190,13 @@ DROP VIEW v1,v2;
DROP
TABLE
t1
,
t2
,
t3
;
#
prepare
stmt1
from
"select count(*) from v1 where x = ?"
;
set
@
parm1
=
1
;
execute
stmt1
using
@
parm1
;
execute
stmt1
using
@
parm1
;
drop
view
v1
;
drop
table
t1
,
t2
,
t3
,
t4
;
# Bug #14466 lost sort order in GROUP_CONCAT() in a view
#
create
table
t1
(
f1
int
,
f2
int
);
...
...
sql/sql_lex.cc
View file @
8fefb368
...
...
@@ -2037,6 +2037,35 @@ void st_lex::cleanup_after_one_table_open()
}
/*
Do end-of-prepare fixup for list of tables and their merge-VIEWed tables
SYNOPSIS
fix_prepare_info_in_table_list()
thd Thread handle
tbl List of tables to process
DESCRIPTION
Perform end-end-of prepare fixup for list of tables, if any of the tables
is a merge-algorithm VIEW, recursively fix up its underlying tables as
well.
*/
static
void
fix_prepare_info_in_table_list
(
THD
*
thd
,
TABLE_LIST
*
tbl
)
{
for
(;
tbl
;
tbl
=
tbl
->
next_local
)
{
if
(
tbl
->
on_expr
)
{
tbl
->
prep_on_expr
=
tbl
->
on_expr
;
tbl
->
on_expr
=
tbl
->
on_expr
->
copy_andor_structure
(
thd
);
}
fix_prepare_info_in_table_list
(
thd
,
tbl
->
merge_underlying_list
);
}
}
/*
fix some structures at the end of preparation
...
...
@@ -2056,16 +2085,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds)
prep_where
=
*
conds
;
*
conds
=
where
=
prep_where
->
copy_andor_structure
(
thd
);
}
for
(
TABLE_LIST
*
tbl
=
(
TABLE_LIST
*
)
table_list
.
first
;
tbl
;
tbl
=
tbl
->
next_local
)
{
if
(
tbl
->
on_expr
)
{
tbl
->
prep_on_expr
=
tbl
->
on_expr
;
tbl
->
on_expr
=
tbl
->
on_expr
->
copy_andor_structure
(
thd
);
}
}
fix_prepare_info_in_table_list
(
thd
,
(
TABLE_LIST
*
)
table_list
.
first
);
}
}
...
...
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