summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-08-14 01:17:57 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-08-14 01:17:57 -0400
commit8a18bb969432242b7431231ff9cd1fb6fc8a707f (patch)
tree2277e02e01fa79c6bdadb336f93dc1930c3c7de9 /sql/sql_show.cc
parent91acc8b16fdd8409765f32b5453851366552a709 (diff)
parentc18e0dab8a24db9d8f84fef328c27a28939a6ef5 (diff)
downloadmariadb-git-8a18bb969432242b7431231ff9cd1fb6fc8a707f.tar.gz
Merge branch '5.5-galera' into 10.0-galera
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc59
1 files changed, 37 insertions, 22 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 0cdf89a88fb..c2ae37248b8 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -122,8 +122,6 @@ static void get_cs_converted_string_value(THD *thd,
static int show_create_view(THD *thd, TABLE_LIST *table, String *buff);
-static void append_algorithm(TABLE_LIST *table, String *buff);
-
static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
/**
@@ -2082,32 +2080,30 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
}
}
-
-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.
+ Append ALGORITHM 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
+ append_algorithm()
+ table [in] table list
+ buff [inout] buffer to hold the ALGORITHM clause
+ check_inherit [in] if true, do nothing if algorithm is INHERIT
*/
-static void append_algorithm(TABLE_LIST *table, String *buff)
+static void append_algorithm(TABLE_LIST *table, String *buff,
+ bool check_inherit)
{
+ int16 algorithm= (int16) table->algorithm;
+
+ DBUG_ENTER("append_algorithm");
+
+ /*
+ Handle a special case when ALGORITHM is not specified, in which case we
+ simply return.
+ */
+ if (check_inherit && (algorithm == VIEW_ALGORITHM_INHERIT))
+ DBUG_VOID_RETURN;
+
buff->append(STRING_WITH_LEN("ALGORITHM="));
switch ((int16)table->algorithm) {
case VIEW_ALGORITHM_UNDEFINED:
@@ -2122,6 +2118,8 @@ static void append_algorithm(TABLE_LIST *table, String *buff)
default:
DBUG_ASSERT(0); // never should happen
}
+
+ DBUG_VOID_RETURN;
}
/*
@@ -2148,6 +2146,23 @@ void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
buffer->append(' ');
}
+void
+view_store_options4(THD *thd, TABLE_LIST *table, String *buff,
+ bool check_inherit)
+{
+ append_algorithm(table, buff, check_inherit);
+ 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 "));
+}
+
+void
+view_store_options(THD *thd, TABLE_LIST *table, String *buff)
+{
+ view_store_options4(thd, table, buff, false);
+}
static int show_create_view(THD *thd, TABLE_LIST *table, String *buff)
{