List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:June 10 2010 1:03pm
Subject:bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2911) Bug#54111
View as plain text  
#At file:///home/bm136801/my/embwild-51/ based on revid:bjorn.munch@stripped

 2911 Bjorn Munch	2010-06-10
      Bug #54111 mysqltest command remove_files_wildcard does not work in embedded server
      Wildcard chars are changed in embedded mode
      emporarily reset the wild_* variables before wild_compare, also for list_files

    modified:
      client/mysqltest.cc
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-06-02 14:23:29 +0000
+++ b/client/mysqltest.cc	2010-06-10 13:02:10 +0000
@@ -2877,6 +2877,39 @@ void do_system(struct st_command *comman
 
 /*
   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
+*/
+
+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 +2984,10 @@ void do_remove_files_wildcard(struct st_
   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 +3007,7 @@ void do_remove_files_wildcard(struct st_
     if (error)
       break;
   }
+  set_wild_chars(0);
   my_dirend(dir_info);
 
 end:
@@ -3211,6 +3249,7 @@ static int get_list_files(DYNAMIC_STRING
   /* 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 +3263,7 @@ static int get_list_files(DYNAMIC_STRING
     dynstr_append(ds, file->name);
     dynstr_append(ds, "\n");
   }
+  set_wild_chars(0);
   my_dirend(dir_info);
   DBUG_RETURN(0);
 }


Attachment: [text/bzr-bundle] bzr/bjorn.munch@sun.com-20100610130210-sqjgpnaudq1rhnzo.bundle
Thread
bzr commit into mysql-5.1-mtr branch (Bjorn.Munch:2911) Bug#54111Bjorn Munch10 Jun