summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <davi@buzz.(none)>2008-02-21 23:21:52 -0200
committerunknown <davi@buzz.(none)>2008-02-21 23:21:52 -0200
commit955b3e3d0b691890db89d4049fc14348dcb1c183 (patch)
treeca562e278e03e31ad89dc9ff1526cb560c809573 /sql/sql_prepare.cc
parentd8c8fd5b4feff08ab3d0480d9b2df78c43b8bf3a (diff)
parent9f245df8530a560844aca138d103dd2f78301005 (diff)
downloadmariadb-git-955b3e3d0b691890db89d4049fc14348dcb1c183.tar.gz
Merge buzz.(none):/home/davi/mysql-5.0-runtime
into buzz.(none):/home/davi/mysql-5.1-runtime mysql-test/r/ps.result: Auto merged mysql-test/t/ps.test: Auto merged sql/sql_view.h: Auto merged sql/item.h: Manual merge sql/sql_prepare.cc: Manual merge sql/sql_view.cc: Manual merge
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 02d8ed00c32..c06c68df8d3 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1524,6 +1524,44 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
/**
+ @brief Validate and prepare for execution CREATE VIEW statement
+
+ @param stmt prepared statement
+
+ @note This function handles create view commands.
+
+ @retval FALSE Operation was a success.
+ @retval TRUE An error occured.
+*/
+
+static bool mysql_test_create_view(Prepared_statement *stmt)
+{
+ DBUG_ENTER("mysql_test_create_view");
+ THD *thd= stmt->thd;
+ LEX *lex= stmt->lex;
+ bool res= TRUE;
+ /* Skip first table, which is the view we are creating */
+ bool link_to_local;
+ TABLE_LIST *view= lex->unlink_first_table(&link_to_local);
+ TABLE_LIST *tables= lex->query_tables;
+
+ if (create_view_precheck(thd, tables, view, lex->create_view_mode))
+ goto err;
+
+ if (open_normal_and_derived_tables(thd, tables, 0))
+ goto err;
+
+ lex->view_prepare_mode= 1;
+ res= select_like_stmt_test(stmt, 0, 0);
+
+err:
+ /* put view back for PS rexecuting */
+ lex->link_first_table_back(view, link_to_local);
+ DBUG_RETURN(res);
+}
+
+
+/*
Validate and prepare for execution a multi update statement.
@param stmt prepared statement
@@ -1735,6 +1773,7 @@ static bool check_prepared_statement(Prepared_statement *stmt,
my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0));
goto error;
}
+ res= mysql_test_create_view(stmt);
break;
case SQLCOM_DO:
res= mysql_test_do_fields(stmt, tables, lex->insert_list);