From 3818bbb0cb87eae0cbc6fbd9dcce7060ad08ecca Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 21 Dec 2014 19:23:28 +0100 Subject: [PATCH] Adding mariadb-version on the view creation to view frm. (MDEV-6916 followup) --- mysql-test/r/view.result | 2 ++ mysql-test/t/view.test | 10 ++++++++++ sql/sql_view.cc | 6 +++++- sql/table.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 2978fce3a98..cb40fbbcbca 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5396,6 +5396,8 @@ SELECT `f1`(1); DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1, t2; +create view v1 as select 1; +drop view v1; # ----------------------------------------------------------------- # -- End of 5.5 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 9cb9deff3f8..8056836fe9a 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5335,6 +5335,16 @@ DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1, t2; + +create view v1 as select 1; + +--let $MYSQLD_DATADIR= `select @@datadir` +--let SEARCH_FILE= $MYSQLD_DATADIR/test/v1.frm +--let SEARCH_PATTERN=mariadb-version +--source include/search_pattern_in_file.inc + +drop view v1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/sql_view.cc b/sql/sql_view.cc index b711f05be02..09784f7257a 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -730,7 +730,7 @@ err: /* number of required parameters for making view */ -static const int required_view_parameters= 14; +static const int required_view_parameters= 15; /* table of VIEW .frm field descriptors @@ -781,6 +781,9 @@ static File_option view_parameters[]= {{(char*) STRING_WITH_LEN("view_body_utf8")}, my_offsetof(TABLE_LIST, view_body_utf8), FILE_OPTIONS_ESTRING}, + {{ C_STRING_WITH_LEN("mariadb-version")}, + my_offsetof(TABLE_LIST, mariadb_version), + FILE_OPTIONS_ULONGLONG}, {{NullS, 0}, 0, FILE_OPTIONS_STRING} }; @@ -877,6 +880,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, } view->file_version= 1; + view->mariadb_version= MYSQL_VERSION_ID; view->calc_md5(md5); if (!(view->md5.str= (char*) thd->memdup(md5, 32))) { diff --git a/sql/table.h b/sql/table.h index ac15e389f75..8e8c2811b71 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1807,6 +1807,7 @@ struct TABLE_LIST LEX_STRING timestamp; /* GMT time stamp of last operation */ st_lex_user definer; /* definer of view */ ulonglong file_version; /* version of file's field set */ + ulonglong mariadb_version; /* version of server on creation */ ulonglong updatable_view; /* VIEW can be updated */ /** @brief The declared algorithm, if this is a view.