Commit 7c0b76a8 authored by unknown's avatar unknown

BUG#20839 Illegal error code: 155 returned downgrading from 5.1.12-> 5.1.11

post-review fixups - magnus suggested creating dynstr_trunc instead of doing
it manually.


client/mysqldump.c:
  use dynstr_trunc instead of manually fiddling with the string
include/my_sys.h:
  add dynstr_trunc
mysys/string.c:
  add dynstr_trunc
parent 5fd7e5e3
......@@ -2783,7 +2783,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
dynstr_append(&where, name_buff);
dynstr_append(&where, "',");
}
where.str[--where.length]= '\0';
dynstr_trunc(&where, 1);
dynstr_append(&where,"))");
DBUG_PRINT("info",("Dump TS for Tables where: %s",where));
......@@ -2813,7 +2813,7 @@ static int dump_tablespaces_for_databases(char** databases)
dynstr_append(&where, db_name_buff);
dynstr_append(&where, "',");
}
where.str[--where.length]='\0';
dynstr_trunc(&where, 1);
dynstr_append(&where,"))");
DBUG_PRINT("info",("Dump TS for DBs where: %s",where));
......
......@@ -778,6 +778,7 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
uint length);
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, int n);
extern void dynstr_free(DYNAMIC_STRING *str);
#ifdef HAVE_MLOCK
extern byte *my_malloc_lock(uint length,myf flags);
......
......@@ -115,6 +115,12 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
return FALSE;
}
my_bool dynstr_trunc(DYNAMIC_STRING *str, int n)
{
str->length-=n;
str->str[str->length]= '\0';
return FALSE;
}
void dynstr_free(DYNAMIC_STRING *str)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment