From 33d5d4ad99e8314d3e5f2be0cfd96b53a3ced05a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Oct 2005 00:54:04 +0400 Subject: Fix for BUG#13095: Cannot create VIEWs in prepared statements - allow CREATE VIEW as well as DROP VIEW to use in prepared statements; - fix CREATE VIEW implementation to make it work in prepared statements. mysql-test/r/sp.result: Results file for the test case for BUG#13095. mysql-test/t/sp.test: Test case for BUG#13095. sql/sql_lex.h: Added a variable to remember start of whole CREATE VIEW statement as well as start of its SELECT part. sql/sql_prepare.cc: Allow CREATE VIEW and DROP VIEW to use in prepared statements. sql/sql_view.cc: Use stored start of whole CREATE VIEW statement instead of thd->query, which differs from the original when prepared statement is executing. sql/sql_yacc.yy: Remember start of whole CREATE VIEW statement as well as start of its SELECT part. --- sql/sql_yacc.yy | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_yacc.yy') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 94ce04fb5b1..670385dee93 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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); -- cgit v1.2.1