--- client/orig-client_priv.h 2006-04-26 11:31:04.000000000 -0700 +++ client/client_priv.h 2006-05-02 15:36:08.000000000 -0700 @@ -49,7 +49,7 @@ #ifdef HAVE_NDBCLUSTER_DB OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif OPT_TRIGGERS, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_AUTO_CLOSE + OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_WRITE_HISTORY_FILE }; --- client/orig-mysql.cc 2006-04-26 11:31:04.000000000 -0700 +++ client/mysql.cc 2006-05-02 15:44:08.000000000 -0700 @@ -134,11 +134,11 @@ vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, default_charset_used= 0, opt_secure_auth= 0, default_pager_set= 0, opt_sigint_ignore= 0, - show_warnings = 0; + show_warnings = 0, opt_write_history_file=1; static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; static char *current_host,*current_db,*current_user=0,*opt_password=0, @@ -388,10 +388,12 @@ { free_defaults(defaults_argv); my_end(0); exit(1); } + if(!opt_write_history_file) + status.add_to_history=0; if (status.batch && !status.line_buff && !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin))) { free_defaults(defaults_argv); my_end(0); @@ -482,11 +484,11 @@ sig_handler mysql_end(int sig) { mysql_close(&mysql); #ifdef HAVE_READLINE - if (!status.batch && !quick && !opt_html && !opt_xml) + if (!status.batch && !quick && !opt_html && !opt_xml && status.add_to_history) { /* write-history */ if (verbose) tee_fprintf(stdout, "Writing history-file %s\n",histfile); if (!write_history(histfile_tmp)) @@ -707,10 +709,13 @@ " uses old (pre-4.1.1) protocol", (gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.", (gptr*) &show_warnings, (gptr*) &show_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"write-history-file", OPT_WRITE_HISTORY_FILE, "Write a .mysql_history file.", + (gptr*) &opt_write_history_file, (gptr*) &opt_write_history_file, 0, + GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void usage(int version)