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
7694eecc
Commit
7694eecc
authored
Oct 25, 2005
by
lars@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0
into mysql.com:/users/lthalmann/bk/mysql-5.0-base64
parents
827d745c
bfc8e85b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
1 deletion
+108
-1
mysql-test/r/sp.result
mysql-test/r/sp.result
+43
-0
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+1
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+56
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+1
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+2
-0
sql/sql_view.cc
sql/sql_view.cc
+2
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
No files found.
mysql-test/r/sp.result
View file @
7694eecc
...
...
@@ -3532,4 +3532,47 @@ select @a|
Local
drop function bug13941|
drop procedure bug13941|
DROP PROCEDURE IF EXISTS bug13095;
DROP TABLE IF EXISTS bug13095_t1;
DROP VIEW IF EXISTS bug13095_v1;
CREATE PROCEDURE bug13095(tbl_name varchar(32))
BEGIN
SET @str =
CONCAT("CREATE TABLE ", tbl_name, "(stuff char(15))");
SELECT @str;
PREPARE stmt FROM @str;
EXECUTE stmt;
SET @str =
CONCAT("INSERT INTO ", tbl_name, " VALUES('row1'),('row2'),('row3')" );
SELECT @str;
PREPARE stmt FROM @str;
EXECUTE stmt;
SET @str =
CONCAT("CREATE VIEW bug13095_v1(c1) AS SELECT stuff FROM ", tbl_name);
SELECT @str;
PREPARE stmt FROM @str;
EXECUTE stmt;
SELECT * FROM bug13095_v1;
SET @str =
"DROP VIEW bug13095_v1";
SELECT @str;
PREPARE stmt FROM @str;
EXECUTE stmt;
END|
CALL bug13095('bug13095_t1');
@str
CREATE TABLE bug13095_t1(stuff char(15))
@str
INSERT INTO bug13095_t1 VALUES('row1'),('row2'),('row3')
@str
CREATE VIEW bug13095_v1(c1) AS SELECT stuff FROM bug13095_t1
c1
row1
row2
row3
@str
DROP VIEW bug13095_v1
DROP PROCEDURE IF EXISTS bug13095;
DROP VIEW IF EXISTS bug13095_v1;
DROP TABLE IF EXISTS bug13095_t1;
drop table t1,t2;
mysql-test/t/disabled.def
View file @
7694eecc
...
...
@@ -15,3 +15,4 @@ rpl_relayrotate : Unstable test case, bug#12429
rpl_until : Unstable test case, bug#12429
rpl_deadlock : Unstable test case, bug#12429
kill : Unstable test case, bug#9712
federated : Broken test case, bug#14272
mysql-test/t/sp.test
View file @
7694eecc
...
...
@@ -4433,6 +4433,62 @@ drop function bug13941|
drop
procedure
bug13941
|
#
# BUG#13095: Cannot create VIEWs in prepared statements
#
delimiter
;
|
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
bug13095
;
DROP
TABLE
IF
EXISTS
bug13095_t1
;
DROP
VIEW
IF
EXISTS
bug13095_v1
;
--
enable_warnings
delimiter
|
;
CREATE
PROCEDURE
bug13095
(
tbl_name
varchar
(
32
))
BEGIN
SET
@
str
=
CONCAT
(
"CREATE TABLE "
,
tbl_name
,
"(stuff char(15))"
);
SELECT
@
str
;
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
SET
@
str
=
CONCAT
(
"INSERT INTO "
,
tbl_name
,
" VALUES('row1'),('row2'),('row3')"
);
SELECT
@
str
;
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
SET
@
str
=
CONCAT
(
"CREATE VIEW bug13095_v1(c1) AS SELECT stuff FROM "
,
tbl_name
);
SELECT
@
str
;
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
SELECT
*
FROM
bug13095_v1
;
SET
@
str
=
"DROP VIEW bug13095_v1"
;
SELECT
@
str
;
PREPARE
stmt
FROM
@
str
;
EXECUTE
stmt
;
END
|
delimiter
;
|
CALL
bug13095
(
'bug13095_t1'
);
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
bug13095
;
DROP
VIEW
IF
EXISTS
bug13095_v1
;
DROP
TABLE
IF
EXISTS
bug13095_t1
;
--
enable_warnings
delimiter
|
;
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/ha_innodb.cc
View file @
7694eecc
...
...
@@ -6811,6 +6811,7 @@ ha_innobase::store_lock(
||
thd
->
lex
->
sql_command
==
SQLCOM_CALL
)
&&
!
thd
->
tablespace_op
&&
thd
->
lex
->
sql_command
!=
SQLCOM_TRUNCATE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_OPTIMIZE
&&
thd
->
lex
->
sql_command
!=
SQLCOM_CREATE_TABLE
)
{
lock_type
=
TL_WRITE_ALLOW_WRITE
;
...
...
sql/sql_lex.h
View file @
7694eecc
...
...
@@ -738,6 +738,7 @@ typedef struct st_lex
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST
*
leaf_tables_insert
;
st_lex_user
*
create_view_definer
;
char
*
create_view_start
;
char
*
create_view_select_start
;
List
<
key_part_spec
>
col_list
;
...
...
sql/sql_prepare.cc
View file @
7694eecc
...
...
@@ -1742,6 +1742,8 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case
SQLCOM_ROLLBACK
:
case
SQLCOM_TRUNCATE
:
case
SQLCOM_CALL
:
case
SQLCOM_CREATE_VIEW
:
case
SQLCOM_DROP_VIEW
:
break
;
default:
...
...
sql/sql_view.cc
View file @
7694eecc
...
...
@@ -643,7 +643,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view
->
query
.
length
=
str
.
length
()
-
1
;
// we do not need last \0
view
->
source
.
str
=
thd
->
lex
->
create_view_select_start
;
view
->
source
.
length
=
(
thd
->
query_length
-
(
thd
->
lex
->
create_view_select_start
-
thd
->
query
));
(
thd
->
lex
->
create_view_select_start
-
thd
->
lex
->
create_view_start
));
view
->
file_version
=
1
;
view
->
calc_md5
(
md5
);
view
->
md5
.
str
=
md5
;
...
...
sql/sql_yacc.yy
View file @
7694eecc
...
...
@@ -1263,6 +1263,7 @@ create:
THD *thd= YYTHD;
LEX *lex= thd->lex;
lex->sql_command= SQLCOM_CREATE_VIEW;
lex->create_view_start= thd->query;
/* first table in list is target VIEW name */
if (!lex->select_lex.add_table_to_list(thd, $7, NULL, 0))
YYABORT;
...
...
@@ -3425,6 +3426,7 @@ alter:
THD *thd= YYTHD;
LEX *lex= thd->lex;
lex->sql_command= SQLCOM_CREATE_VIEW;
lex->create_view_start= thd->query;
lex->create_view_mode= VIEW_ALTER;
/* first table in list is target VIEW name */
lex->select_lex.add_table_to_list(thd, $6, NULL, 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