From 49124e987cdbeed6ec76600ffba4260c3fcd99e2 Mon Sep 17 00:00:00 2001 From: "stewart@willster.(none)" <> Date: Tue, 17 Oct 2006 01:02:12 +1000 Subject: [PATCH] BUG#20839 Illegal error code: 155 returned downgrading from 5.1.12-> 5.1.11 post-review fixes. Magnus suggested use of DYNAMIC_STRING instead of futzing with c strings. also making usage of TABLEs clearer in store_schema_partitions_record. --- client/mysqldump.c | 160 +++++++++++++++++++++------------------------ sql/sql_show.cc | 8 +-- 2 files changed, 80 insertions(+), 88 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 4008668b4bc..660de5d72ef 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2759,86 +2759,66 @@ static int dump_all_tablespaces() static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) { - char *where; + DYNAMIC_STRING where; int r; int i; - - size_t sz= 200+tables*(NAME_LEN*2+3); - where= my_malloc(sz, MYF(MY_WME)); - - if (!where) - return 1; - char name_buff[NAME_LEN*2+3]; + mysql_real_escape_string(mysql, name_buff, db, strlen(db)); - snprintf(where,sz-1, - " AND TABLESPACE_NAME IN (" - "SELECT DISTINCT TABLESPACE_NAME FROM" - " INFORMATION_SCHEMA.PARTITIONS" - " WHERE" - " TABLE_SCHEMA='%s'" - " AND TABLE_NAME IN (", name_buff); + init_dynamic_string(&where, " AND TABLESPACE_NAME IN (" + "SELECT DISTINCT TABLESPACE_NAME FROM" + " INFORMATION_SCHEMA.PARTITIONS" + " WHERE" + " TABLE_SCHEMA='", 256, 1024); + dynstr_append(&where, name_buff); + dynstr_append(&where, "' AND TABLE_NAME IN ("); for (i=0 ; i &field_list, String *str) } -static void store_schema_partitions_record(THD *thd, TABLE *table, - TABLE *show_table, +static void store_schema_partitions_record(THD *thd, TABLE *schema_table, + TABLE *showing_table, partition_element *part_elem, handler *file, uint part_id) { + TABLE* table= schema_table; CHARSET_INFO *cs= system_charset_info; PARTITION_INFO stat_info; TIME time; @@ -3950,8 +3951,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *table, strlen(part_elem->tablespace_name), cs); else { - DBUG_PRINT("info",("FOO")); - char *ts= show_table->file->get_tablespace_name(thd); + char *ts= showing_table->file->get_tablespace_name(thd); if(ts) table->field[24]->store(ts, strlen(ts), cs); else