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
3b2ece3b
Commit
3b2ece3b
authored
20 years ago
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge abelkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
parents
9fa09a27
58ec3fd7
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
5 deletions
+65
-5
mysql-test/r/view.result
mysql-test/r/view.result
+22
-0
mysql-test/t/view.test
mysql-test/t/view.test
+30
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+13
-5
No files found.
mysql-test/r/view.result
View file @
3b2ece3b
...
...
@@ -1014,3 +1014,25 @@ p2
p4
drop view v1;
drop table t1;
create table t1 (a int);
create view v1 as select a from t1;
insert into t1 values (1);
SET @v0 = '2';
PREPARE stmt FROM 'UPDATE v1 SET a = ?';
EXECUTE stmt USING @v0;
DEALLOCATE PREPARE stmt;
SET @v0 = '3';
PREPARE stmt FROM 'insert into v1 values (?)';
EXECUTE stmt USING @v0;
DEALLOCATE PREPARE stmt;
SET @v0 = '4';
PREPARE stmt FROM 'insert into v1 (a) values (?)';
EXECUTE stmt USING @v0;
DEALLOCATE PREPARE stmt;
select * from t1;
a
2
3
4
drop view v1;
drop table t1;
This diff is collapsed.
Click to expand it.
mysql-test/t/view.test
View file @
3b2ece3b
...
...
@@ -943,3 +943,33 @@ select distinct first.col2 from t1 first where first.col2 in (select second.col2
select
distinct
first
.
col2
from
v1
first
where
first
.
col2
in
(
select
second
.
col2
from
t1
second
where
second
.
col1
<>
first
.
col1
);
drop
view
v1
;
drop
table
t1
;
#
# Test of view updatebility in prepared statement
#
create
table
t1
(
a
int
);
create
view
v1
as
select
a
from
t1
;
insert
into
t1
values
(
1
);
#update
SET
@
v0
=
'2'
;
PREPARE
stmt
FROM
'UPDATE v1 SET a = ?'
;
EXECUTE
stmt
USING
@
v0
;
DEALLOCATE
PREPARE
stmt
;
#insert without field list
SET
@
v0
=
'3'
;
PREPARE
stmt
FROM
'insert into v1 values (?)'
;
EXECUTE
stmt
USING
@
v0
;
DEALLOCATE
PREPARE
stmt
;
#insert with field list
SET
@
v0
=
'4'
;
PREPARE
stmt
FROM
'insert into v1 (a) values (?)'
;
EXECUTE
stmt
USING
@
v0
;
DEALLOCATE
PREPARE
stmt
;
select
*
from
t1
;
drop
view
v1
;
drop
table
t1
;
This diff is collapsed.
Click to expand it.
sql/sql_prepare.cc
View file @
3b2ece3b
...
...
@@ -978,12 +978,20 @@ static int mysql_test_update(Prepared_statement *stmt,
select
->
order_list
.
elements
,
(
ORDER
*
)
select
->
order_list
.
first
)))
{
thd
->
lex
->
select_lex
.
no_wrap_view_item
=
1
;
if
(
setup_fields
(
thd
,
0
,
table_list
,
select
->
item_list
,
1
,
0
,
0
))
{
res
=
-
1
;
thd
->
lex
->
select_lex
.
no_wrap_view_item
=
0
;
}
else
{
thd
->
lex
->
select_lex
.
no_wrap_view_item
=
0
;
if
(
setup_fields
(
thd
,
0
,
table_list
,
select
->
item_list
,
1
,
0
,
0
)
||
setup_fields
(
thd
,
0
,
table_list
,
stmt
->
lex
->
value_list
,
0
,
0
,
0
))
res
=
-
1
;
}
}
stmt
->
lex
->
unit
.
cleanup
();
}
thd
->
free_temporary_memory_pool_for_ps_preparing
();
...
...
This diff is collapsed.
Click to expand it.
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