diff options
author | Bjorn Munch <Bjorn.Munch@sun.com> | 2010-06-15 11:29:24 +0200 |
---|---|---|
committer | Bjorn Munch <Bjorn.Munch@sun.com> | 2010-06-15 11:29:24 +0200 |
commit | 7f6ffe9a36099d94a68a5b44515464b07ca07768 (patch) | |
tree | f8e0474e0fe6014c9849fa2e83315c26c97e56e8 /client | |
parent | cb3768cdf63acd94dd1e6f8b8e1ef016923f6dbd (diff) | |
download | mariadb-git-7f6ffe9a36099d94a68a5b44515464b07ca07768.tar.gz |
Bug #54111 mysqltest command remove_files_wildcard does not work in embedded server
Wildcard chars are changed in embedded mode
Temporarily reset the wild_* variables before wild_compare, also for list_files
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a3ae0ebb18c..ba8e882f33e 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2877,6 +2877,41 @@ void do_system(struct st_command *command) /* SYNOPSIS + set_wild_chars + set true to set * etc. as wild char, false to reset + + DESCRIPTION + Auxiliary function to set "our" wild chars before calling wild_compare + This is needed because the default values are changed to SQL syntax + in mysqltest_embedded. +*/ + +void set_wild_chars (my_bool set) +{ + static char old_many= 0, old_one, old_prefix; + + if (set) + { + if (wild_many == '*') return; // No need + old_many= wild_many; + old_one= wild_one; + old_prefix= wild_prefix; + wild_many= '*'; + wild_one= '?'; + wild_prefix= 0; + } + else + { + if (! old_many) return; // Was not set + wild_many= old_many; + wild_one= old_one; + wild_prefix= old_prefix; + } +} + + +/* + SYNOPSIS do_remove_file command called command @@ -2951,6 +2986,10 @@ void do_remove_files_wildcard(struct st_command *command) dir_separator[0]= FN_LIBCHAR; dir_separator[1]= 0; dynstr_append(&ds_file_to_remove, dir_separator); + + /* Set default wild chars for wild_compare, is changed in embedded mode */ + set_wild_chars(1); + for (i= 0; i < (uint) dir_info->number_off_files; i++) { file= dir_info->dir_entry + i; @@ -2970,6 +3009,7 @@ void do_remove_files_wildcard(struct st_command *command) if (error) break; } + set_wild_chars(0); my_dirend(dir_info); end: @@ -3211,6 +3251,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, /* Note that my_dir sorts the list if not given any flags */ if (!(dir_info= my_dir(ds_dirname->str, MYF(0)))) DBUG_RETURN(1); + set_wild_chars(1); for (i= 0; i < (uint) dir_info->number_off_files; i++) { file= dir_info->dir_entry + i; @@ -3224,6 +3265,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, dynstr_append(ds, file->name); dynstr_append(ds, "\n"); } + set_wild_chars(0); my_dirend(dir_info); DBUG_RETURN(0); } |