diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-30 22:57:18 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-30 22:57:18 +0200 |
commit | efcfb195e3fc4a2b87bfcb9ad136d46b9961f49e (patch) | |
tree | 9eb3b78e20ecf4bd9e5cd587db50d51c1f06d336 /sql | |
parent | a7f87effa57f6486c23bf5b340c8474a635dcf71 (diff) | |
parent | 6378bdbf47af72b2f899853586faa5a2d2f0fee1 (diff) | |
download | mariadb-git-efcfb195e3fc4a2b87bfcb9ad136d46b9961f49e.tar.gz |
Merge with 5.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/filesort.cc | 2 | ||||
-rw-r--r-- | sql/slave.cc | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 6 | ||||
-rw-r--r-- | sql/sql_load.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 42 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_view.cc | 2 |
7 files changed, 43 insertions, 15 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index ad891db3991..d2166ad701c 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -834,7 +834,7 @@ static void make_sortkey(register SORTPARAM *param, if (sort_field->need_strxnfrm) { char *from=(char*) res->ptr(); - uint tmp_length; + uint tmp_length __attribute__((unused)); if ((uchar*) from == to) { set_if_smaller(length,sort_field->length); diff --git a/sql/slave.cc b/sql/slave.cc index 813cf20464e..ff12a660883 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -513,7 +513,7 @@ terminate_slave_thread(THD *thd, while (*slave_running) // Should always be true { - int error; + int error __attribute__((unused)); DBUG_PRINT("loop", ("killing slave thread")); pthread_mutex_lock(&thd->LOCK_thd_data); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 600bb641448..4616b5c2430 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4722,9 +4722,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) */ for (tables= *start; tables ;tables= tables->next_global) { - DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx", - tables->db, tables->table_name, (long) tables)); - safe_to_ignore_table= FALSE; /* @@ -4737,8 +4734,11 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) { if (tables->view) goto process_view_routines; + DBUG_PRINT("tcache", ("ignoring placeholder for derived table")); continue; } + DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx", + tables->db, tables->table_name, (long) tables)); /* If this TABLE_LIST object is a placeholder for an information_schema table, create a temporary table to represent the information_schema diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 3a1dbef4f3f..e4ba53ac53c 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -140,7 +140,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, */ char *tdb= thd->db ? thd->db : db; // Result is never null ulong skip_lines= ex->skip_lines; - bool transactional_table; + bool transactional_table __attribute__((unused)); DBUG_ENTER("mysql_load"); /* diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1d5d53114a3..e90c3141f84 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -739,12 +739,30 @@ public: }; +/* + Return CREATE command for table or view + + @param thd Thread handler + @param table_list Table / view + + @return + @retval 0 OK + @retval 1 Error + + @notes + table_list->db and table_list->table_name are kept unchanged to + not cause problems with SP. +*/ + bool mysqld_show_create(THD *thd, TABLE_LIST *table_list) { Protocol *protocol= thd->protocol; char buff[2048]; String buffer(buff, sizeof(buff), system_charset_info); + char *save_db, *save_table_name; + bool retval= TRUE; // Assume error + List<Item> field_list; DBUG_ENTER("mysqld_show_create"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, table_list->table_name)); @@ -752,13 +770,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) /* We want to preserve the tree for views. */ thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; + /* Store original names if called from SP */ + save_db= table_list->db; + save_table_name= table_list->table_name; + { Show_create_error_handler view_error_suppressor(thd, table_list); thd->push_internal_handler(&view_error_suppressor); bool error= open_normal_and_derived_tables(thd, table_list, 0); thd->pop_internal_handler(); if (error && (thd->killed || thd->main_da.is_error())) - DBUG_RETURN(TRUE); + goto error; } /* TODO: add environment variables show when it become possible */ @@ -766,7 +788,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) { my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, table_list->table_name, "VIEW"); - DBUG_RETURN(TRUE); + goto error; } buffer.length(0); @@ -778,9 +800,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) view_store_create_info(thd, table_list, &buffer) : store_create_info(thd, table_list, &buffer, NULL, FALSE /* show_database */))) - DBUG_RETURN(TRUE); + goto error; - List<Item> field_list; if (table_list->view) { field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN)); @@ -801,7 +822,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(TRUE); + goto error; protocol->prepare_for_resend(); if (table_list->view) protocol->store(table_list->view_name.str, system_charset_info); @@ -829,10 +850,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); if (protocol->write()) - DBUG_RETURN(TRUE); + goto error; my_eof(thd); - DBUG_RETURN(FALSE); + retval= FALSE; // ok + +error: + /* Restore table list if called by stored procedure */ + table_list->db= save_db; + table_list->table_name= save_table_name; + DBUG_RETURN(retval); + } bool mysqld_show_create_db(THD *thd, char *dbname, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bb062615966..504059eb040 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6711,7 +6711,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint fast_alter_partition= 0; bool partition_changed= FALSE; #endif - bool need_lock_for_indexes= TRUE; + bool need_lock_for_indexes __attribute__((unused)) = TRUE; KEY *key_info_buffer; uint index_drop_count= 0; uint *index_drop_buffer= NULL; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 2fc6918e49f..0fe1b597d82 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -848,7 +848,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, thd->variables.sql_mode|= sql_mode; } - DBUG_PRINT("info", ("View: %s", view_query.c_ptr_safe())); + DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr())); /* fill structure */ view->source= thd->lex->create_view_select; |