1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Some bug fixes and a feature add to mysql-test-run

This commit is contained in:
jani@ua141d10.elisa.omakaista.fi
2005-01-25 18:32:09 +02:00
parent 8a5316a425
commit d5f76d50f6
5 changed files with 40 additions and 5 deletions

View File

@@ -44,7 +44,7 @@
#include <locale.h>
#endif
const char *VER= "14.7";
const char *VER= "14.8";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -144,6 +144,7 @@ static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static char *histfile;
static char *histfile_tmp;
static String glob_buffer,old_buffer;
static String processed_prompt;
static char *full_username=0,*part_username=0,*default_prompt=0;
@@ -442,6 +443,13 @@ int main(int argc,char *argv[])
if (verbose)
tee_fprintf(stdout, "Reading history-file %s\n",histfile);
read_history(histfile);
if (!(histfile_tmp= (char*) my_malloc((uint) strlen(histfile) + 5,
MYF(MY_WME))))
{
fprintf(stderr, "Couldn't allocate memory for temp histfile!\n");
exit(1);
}
sprintf(histfile_tmp, "%s.TMP", histfile);
}
}
#endif
@@ -470,7 +478,8 @@ sig_handler mysql_end(int sig)
/* write-history */
if (verbose)
tee_fprintf(stdout, "Writing history-file %s\n",histfile);
write_history(histfile);
if (!write_history(histfile_tmp))
my_rename(histfile_tmp, histfile, MYF(MY_WME));
}
batch_readline_end(status.line_buff);
completion_hash_free(&ht);
@@ -485,6 +494,7 @@ sig_handler mysql_end(int sig)
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));