MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:June 13 2006 12:23pm
Subject:bk commit into 5.0 tree (holyfoot:1.2174) BUG#16832
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2174 06/06/13 17:23:43 holyfoot@deer.(none) +2 -0
  bug #16832 (ALGORITHM missed in VIEW's information schema)

  sql/sql_show.cc
    1.320 06/06/13 17:22:23 holyfoot@stripped +34 -6
    /*ALGORITHM=XXX*/ added to the 'query' column in view's information schema

  mysql-test/r/information_schema.result
    1.108 06/06/13 17:22:23 holyfoot@stripped +9 -9
    test result fixed

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	holyfoot
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-5.0.16832

--- 1.319/sql/sql_show.cc	Tue Jun  6 11:25:25 2006
+++ 1.320/sql/sql_show.cc	Tue Jun 13 17:22:23 2006
@@ -41,6 +41,8 @@
 
 static int
 store_create_info(THD *thd, TABLE_LIST *table_list, String *packet);
+static void
+append_algorithm(TABLE_LIST *table, String *buff);
 static int
 view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
 static bool schema_table_store_record(THD *thd, TABLE *table);
@@ -1099,6 +1101,28 @@
 void
 view_store_options(THD *thd, TABLE_LIST *table, String *buff)
 {
+  append_algorithm(table, buff);
+  append_definer(thd, buff, &table->definer.user, &table->definer.host);
+  if (table->view_suid)
+    buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
+  else
+    buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
+}
+
+
+/*
+  Append DEFINER clause to the given buffer.
+  
+  SYNOPSIS
+    append_definer()
+    thd           [in] thread handle
+    buffer        [inout] buffer to hold DEFINER clause
+    definer_user  [in] user name part of definer
+    definer_host  [in] host name part of definer
+*/
+
+static void append_algorithm(TABLE_LIST *table, String *buff)
+{
   buff->append(STRING_WITH_LEN("ALGORITHM="));
   switch ((int8)table->algorithm) {
   case VIEW_ALGORITHM_UNDEFINED:
@@ -1113,11 +1137,6 @@
   default:
     DBUG_ASSERT(0); // never should happen
   }
-  append_definer(thd, buff, &table->definer.user, &table->definer.host);
-  if (table->view_suid)
-    buff->append(STRING_WITH_LEN("SQL SECURITY DEFINER "));
-  else
-    buff->append(STRING_WITH_LEN("SQL SECURITY INVOKER "));
 }
 
 
@@ -3105,7 +3124,16 @@
     table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
     table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
     if (grant & SHOW_VIEW_ACL)
-      table->field[3]->store(tables->query.str, tables->query.length, cs);
+    {
+      char buff[2048];
+      String qwe_str(buff, sizeof(buff), cs);
+      qwe_str.length(0);
+      qwe_str.append(STRING_WITH_LEN("/* "));
+      append_algorithm(tables, &qwe_str);
+      qwe_str.append(STRING_WITH_LEN("*/ "));
+      qwe_str.append(tables->query.str, tables->query.length);
+      table->field[3]->store(qwe_str.ptr(), qwe_str.length(), cs);
+    }
 
     if (tables->with_check != VIEW_CHECK_NONE)
     {

--- 1.107/mysql-test/r/information_schema.result	Tue Jun  6 12:57:44 2006
+++ 1.108/mysql-test/r/information_schema.result	Tue Jun 13 17:22:23 2006
@@ -369,11 +369,11 @@
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 select * from information_schema.views where TABLE_NAME like "v%";
 TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE
-NULL	test	v0	select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata`	NONE	NO	root@localhost	DEFINER
-NULL	test	v1	select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1')	NONE	NO	root@localhost	DEFINER
-NULL	test	v2	select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2')	NONE	NO	root@localhost	DEFINER
-NULL	test	v3	select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%')	NONE	NO	root@localhost	DEFINER
-NULL	test	v4	select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%')	NONE	NO	root@localhost	DEFINER
+NULL	test	v0	/* ALGORITHM=UNDEFINED */ select sql_no_cache `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata`	NONE	NO	root@localhost	DEFINER
+NULL	test	v1	/* ALGORITHM=UNDEFINED */ select sql_no_cache `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1')	NONE	NO	root@localhost	DEFINER
+NULL	test	v2	/* ALGORITHM=UNDEFINED */ select sql_no_cache `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2')	NONE	NO	root@localhost	DEFINER
+NULL	test	v3	/* ALGORITHM=UNDEFINED */ select sql_no_cache `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%')	NONE	NO	root@localhost	DEFINER
+NULL	test	v4	/* ALGORITHM=UNDEFINED */ select sql_no_cache `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%')	NONE	NO	root@localhost	DEFINER
 drop view v0, v1, v2, v3, v4;
 create table t1 (a int);
 grant select,update,insert on t1 to mysqltest_1@localhost;
@@ -464,9 +464,9 @@
 create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
 select * from information_schema.views;
 TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE
-NULL	test	v1	select `test`.`t1`.`a` AS `c` from `test`.`t1`	CASCADED	YES	root@localhost	DEFINER
-NULL	test	v2	select `test`.`t1`.`a` AS `c` from `test`.`t1`	LOCAL	YES	root@localhost	DEFINER
-NULL	test	v3	select `test`.`t1`.`a` AS `c` from `test`.`t1`	CASCADED	YES	root@localhost	DEFINER
+NULL	test	v1	/* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1`	CASCADED	YES	root@localhost	DEFINER
+NULL	test	v2	/* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1`	LOCAL	YES	root@localhost	DEFINER
+NULL	test	v3	/* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1`	CASCADED	YES	root@localhost	DEFINER
 grant select (a) on test.t1 to joe@localhost with grant option;
 select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
 GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	PRIVILEGE_TYPE	IS_GRANTABLE
@@ -1121,7 +1121,7 @@
 where table_name='v1' or table_name='v2';
 TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE
 NULL	test	v1		NONE	YES	root@localhost	DEFINER
-NULL	test	v2	select 1 AS `1`	NONE	NO	mysqltest_1@localhost	DEFINER
+NULL	test	v2	/* ALGORITHM=UNDEFINED */ select 1 AS `1`	NONE	NO	mysqltest_1@localhost	DEFINER
 drop view v1, v2;
 drop table t1;
 drop user mysqltest_1@localhost;
Thread
bk commit into 5.0 tree (holyfoot:1.2174) BUG#16832holyfoot13 Jun