Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson 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.1884 05/09/13 14:45:15 msvensson@neptunus.(none) +1 -0
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into neptunus.(none):/home/msvensson/mysql/bug10713_new/my51-bug10713_new
sql/sql_show.cc
1.264 05/09/13 14:45:09 msvensson@neptunus.(none) +0 -0
Auto merged
# 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: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/bug10713_new/my51-bug10713_new/RESYNC
--- 1.263/sql/sql_show.cc 2005-09-09 21:05:52 +02:00
+++ 1.264/sql/sql_show.cc 2005-09-13 14:45:09 +02:00
@@ -347,7 +347,6 @@
bool
mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{
- TABLE *table;
Protocol *protocol= thd->protocol;
char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info);
@@ -360,9 +359,8 @@
/* Only one table for now, but VIEW can involve several tables */
if (open_normal_and_derived_tables(thd, table_list, 0))
- {
DBUG_RETURN(TRUE);
- }
+
/* TODO: add environment variables show when it become possible */
if (thd->lex->only_view && !table_list->view)
{
@@ -371,8 +369,7 @@
DBUG_RETURN(TRUE);
}
- table= table_list->table;
-
+ buffer.length(0);
if ((table_list->view ?
view_store_create_info(thd, table_list, &buffer) :
store_create_info(thd, table_list, &buffer)))
@@ -397,22 +394,15 @@
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
protocol->prepare_for_resend();
- buffer.length(0);
if (table_list->view)
- {
protocol->store(table_list->view_name.str, system_charset_info);
- if (view_store_create_info(thd, table_list, &buffer))
- DBUG_RETURN(TRUE);
- }
else
{
if (table_list->schema_table)
protocol->store(table_list->schema_table->table_name,
system_charset_info);
else
- protocol->store(table->alias, system_charset_info);
- if (store_create_info(thd, table_list, &buffer))
- DBUG_RETURN(TRUE);
+ protocol->store(table_list->table->alias, system_charset_info);
}
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
@@ -1077,6 +1067,29 @@
MODE_DB2 |
MODE_MAXDB |
MODE_ANSI)) != 0;
+ /*
+ Compact output format for view can be used
+ - if user has db of this view as current db
+ - if this view only references table inside it's own db
+ */
+ if (!thd->db || strcmp(thd->db, table->view_db.str))
+ table->compact_view_format= FALSE;
+ else
+ {
+ TABLE_LIST *tbl;
+ table->compact_view_format= TRUE;
+ for (tbl= thd->lex->query_tables;
+ tbl;
+ tbl= tbl->next_global)
+ {
+ if (strcmp(table->view_db.str, tbl->view ? tbl->view_db.str :tbl->db)!= 0)
+ {
+ table->compact_view_format= FALSE;
+ break;
+ }
+ }
+ }
+
buff->append("CREATE ", 7);
if (!foreign_db_mode)
{
@@ -1097,8 +1110,11 @@
}
}
buff->append("VIEW ", 5);
- append_identifier(thd, buff, table->view_db.str, table->view_db.length);
- buff->append('.');
+ if (!table->compact_view_format)
+ {
+ append_identifier(thd, buff, table->view_db.str, table->view_db.length);
+ buff->append('.');
+ }
append_identifier(thd, buff, table->view_name.str, table->view_name.length);
buff->append(" AS ", 4);
| Thread |
|---|
| • bk commit into 5.1 tree (msvensson:1.1884) | msvensson | 13 Sep |