summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-11-29 23:53:07 +0100
committerunknown <msvensson@neptunus.(none)>2006-11-29 23:53:07 +0100
commit49e3024c1a1e950e0fe9fecbccfd13c9728a5b82 (patch)
tree2e5fd2ea8d04d6274f3da86ac5b02bed3f38bb8a /client
parentcadef27521616ba6caea1556ae053a09e3bde6d8 (diff)
parent4b13e338241778aefad46fde158a4cb99db083e1 (diff)
downloadmariadb-git-49e3024c1a1e950e0fe9fecbccfd13c9728a5b82.tar.gz
Merge 192.168.0.5:mysql/mysql-5.1-maint
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint client/mysqltest.c: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/mysql.result: Auto merged mysql-test/t/mysql.test: Auto merged sql/field_conv.cc: Auto merged sql/handler.cc: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/client_priv.h3
-rw-r--r--client/mysql.cc23
-rw-r--r--client/mysql_upgrade.c2
-rw-r--r--client/mysqladmin.cc8
-rw-r--r--client/mysqlbinlog.cc12
-rw-r--r--client/mysqlcheck.c10
-rw-r--r--client/mysqldump.c171
-rw-r--r--client/mysqlimport.c8
-rw-r--r--client/mysqlshow.c13
-rw-r--r--client/mysqlslap.c4
-rw-r--r--client/mysqltest.c122
11 files changed, 245 insertions, 131 deletions
diff --git a/client/client_priv.h b/client/client_priv.h
index bcaa74d3228..78457a4977d 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -58,5 +58,6 @@ enum options_client
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
- OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT
+ OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
+ OPT_DEBUG_INFO, OPT_COLUMN_TYPES
};
diff --git a/client/mysql.cc b/client/mysql.cc
index b0aa4637d9d..862f3cad700 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -44,7 +44,7 @@
#include <locale.h>
#endif
-const char *VER= "14.12";
+const char *VER= "14.13";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -140,6 +140,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0;
+static my_bool column_types_flag;
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;
@@ -545,7 +546,7 @@ sig_handler mysql_end(int sig)
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
mysql_server_end();
free_defaults(defaults_argv);
- my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(status.exit_status);
}
@@ -600,12 +601,13 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"default-character-set", OPT_DEFAULT_CHARSET,
- "Set the default character set.", (gptr*) &default_charset,
- (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
+ (gptr*) &column_types_flag, (gptr*) &column_types_flag,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
+
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -613,8 +615,13 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &current_db,
(gptr*) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"default-character-set", OPT_DEFAULT_CHARSET,
+ "Set the default character set.", (gptr*) &default_charset,
+ (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str,
(gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0,
@@ -711,8 +718,6 @@ static struct my_option my_long_options[] =
#include "sslopt-longopts.h"
{"table", 't', "Output in table format.", (gptr*) &output_tables,
(gptr*) &output_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag,
- (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"tee", OPT_TEE,
"Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -2098,7 +2103,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
time_buff[0]=0;
if (result)
{
- if (!mysql_num_rows(result) && ! quick && !info_flag)
+ if (!mysql_num_rows(result) && ! quick && !column_types_flag)
{
strmov(buff, "Empty set");
}
@@ -2337,7 +2342,7 @@ print_table_data(MYSQL_RES *result)
bool *num_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
- if (info_flag)
+ if (column_types_flag)
{
print_field_types(result);
if (!mysql_num_rows(result))
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index cce4b440be0..411d3029c14 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -638,7 +638,7 @@ error:
if (upgrade_defaults_created)
my_delete(upgrade_defaults_path, MYF(0));
- my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
return ret;
}
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 57ab4e071fb..bde0a5fa143 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -28,7 +28,7 @@
#include "../ndb/src/mgmclient/ndb_mgmclient.h"
#endif
-#define ADMIN_VERSION "8.41"
+#define ADMIN_VERSION "8.42"
#define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -41,7 +41,7 @@ ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
- tty_password=0;
+ tty_password= 0, info_flag= 0;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
@@ -136,6 +136,8 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
(gptr*) &option_force, (gptr*) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -412,7 +414,7 @@ int main(int argc,char *argv[])
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(save_argv);
- my_end(0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(error ? 1 : 0);
return 0;
}
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 660be6bce50..d3fd7386fb8 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -66,7 +66,7 @@ static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0;
static bool opt_base64_output= 0;
static const char* database= 0;
-static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
+static my_bool force_opt= 0, short_form= 0, remote_opt= 0, info_flag;
static ulonglong offset = 0;
static const char* host = 0;
static int port= 0;
@@ -716,6 +716,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it "
@@ -844,7 +846,7 @@ static void die(const char* fmt, ...)
va_end(args);
cleanup();
/* We cannot free DBUG, it is used in global destructors after exit(). */
- my_end(MY_DONT_FREE_DBUG);
+ my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
exit(1);
}
@@ -852,7 +854,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
- printf("%s Ver 3.1 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
NETWARE_SET_SCREEN_MODE(1);
}
@@ -1138,7 +1140,7 @@ could be out of memory");
}
if (len < 8 && net->read_pos[0] == 254)
break; // end of data
- DBUG_PRINT("info",( "len= %u, net->read_pos[5] = %d\n",
+ DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n",
len, net->read_pos[5]));
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error_msg,
@@ -1545,7 +1547,7 @@ int main(int argc, char** argv)
free_defaults(defaults_argv);
my_free_open_file_info();
/* We cannot free DBUG, it is used in global destructors after exit(). */
- my_end(MY_DONT_FREE_DBUG);
+ my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
exit(exit_value);
DBUG_RETURN(exit_value); // Keep compilers happy
}
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index fdfd9fc36fb..09ddaadf233 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.4.4"
+#define CHECK_VERSION "2.4.5"
#include "client_priv.h"
#include <m_ctype.h>
@@ -34,7 +34,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
- tty_password = 0, opt_frm = 0,
+ tty_password= 0, opt_frm= 0, info_flag= 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
@@ -96,6 +96,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -761,7 +763,7 @@ int main(int argc, char **argv)
*/
if (get_options(&argc, &argv))
{
- my_end(0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(EX_USAGE);
}
if (dbConnect(current_host, current_user, opt_password))
@@ -803,6 +805,6 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
- my_end(0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
return(first_error!=0);
} /* main */
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 992f20db6b6..4a32d1617c2 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
-#define DUMP_VERSION "10.10"
+#define DUMP_VERSION "10.12"
#include <my_global.h>
#include <my_sys.h>
@@ -103,7 +103,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
opt_alltspcs=0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
-static my_bool insert_pat_inited=0;
+static my_bool insert_pat_inited= 0, info_flag;
static DYNAMIC_STRING insert_pat;
static char *opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
@@ -111,6 +111,7 @@ static char *opt_password=0,*current_user=0,
*where=0, *order_by=0,
*opt_compatible_mode_str= 0,
*err_ptr= 0;
+static char **defaults_argv= 0;
static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
@@ -120,7 +121,7 @@ static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
#include <sslopt-vars.h>
-FILE *md_result_file;
+FILE *md_result_file= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
@@ -222,6 +223,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -537,8 +540,10 @@ static void write_header(FILE *sql_file, char *db_name)
if (opt_xml)
{
fputs("<?xml version=\"1.0\"?>\n", sql_file);
- /* Schema reference. Allows use of xsi:nil for NULL values and
- xsi:type to define an element's data type. */
+ /*
+ Schema reference. Allows use of xsi:nil for NULL values and
+ xsi:type to define an element's data type.
+ */
fputs("<mysqldump ", sql_file);
fputs("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
sql_file);
@@ -641,14 +646,6 @@ byte* get_table_key(const char *entry, uint *length,
}
-void init_table_rule_hash(HASH* h)
-{
- if (hash_init(h, charset_info, 16, 0, 0,
- (hash_get_key) get_table_key,
- (hash_free_key) free_table_ent, 0))
- exit(EX_EOM);
-}
-
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
@@ -691,6 +688,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
+ info_flag= 1;
break;
#include <sslopt-case.h>
case 'V': print_version(); exit(0);
@@ -731,9 +729,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fprintf(stderr, "Illegal use of option --ignore-table=<database>.<table>\n");
exit(1);
}
- if (!hash_inited(&ignore_table))
- init_table_rule_hash(&ignore_table);
-
if (my_hash_insert(&ignore_table, (byte*)my_strdup(argument, MYF(0))))
exit(EX_EOM);
break;
@@ -809,9 +804,21 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout;
load_defaults("my",load_default_groups,argc,argv);
+ defaults_argv= *argv;
+
+ if (hash_init(&ignore_table, charset_info, 16, 0, 0,
+ (hash_get_key) get_table_key,
+ (hash_free_key) free_table_ent, 0))
+ return(EX_EOM);
+ /* Don't copy cluster internal log tables */
+ if (my_hash_insert(&ignore_table,
+ (byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (byte*) my_strdup("mysql.schema", MYF(MY_WME))))
+ return(EX_EOM);
- if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- exit(ho_error);
+ if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
+ return(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
*mysql_params->p_net_buffer_length= opt_net_buffer_length;
@@ -823,7 +830,7 @@ static int get_options(int *argc, char ***argv)
{
fprintf(stderr,
"%s: You must use option --tab with --fields-...\n", my_progname);
- return(1);
+ return(EX_USAGE);
}
/* Ensure consistency of the set of binlog & locking options */
@@ -833,7 +840,7 @@ static int get_options(int *argc, char ***argv)
{
fprintf(stderr, "%s: You can't use --single-transaction and "
"--lock-all-tables at the same time.\n", my_progname);
- return(1);
+ return(EX_USAGE);
}
if (opt_master_data)
opt_lock_all_tables= !opt_single_transaction;
@@ -842,14 +849,14 @@ static int get_options(int *argc, char ***argv)
if (enclosed && opt_enclosed)
{
fprintf(stderr, "%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n", my_progname);
- return(1);
+ return(EX_USAGE);
}
if ((opt_databases || opt_alldbs) && path)
{
fprintf(stderr,
"%s: --databases or --all-databases can't be used with --tab.\n",
my_progname);
- return(1);
+ return(EX_USAGE);
}
if (strcmp(default_charset, charset_info->csname) &&
!(charset_info= get_charset_by_csname(default_charset,
@@ -858,7 +865,7 @@ static int get_options(int *argc, char ***argv)
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
{
short_usage();
- return 1;
+ return EX_USAGE;
}
if (tty_password)
opt_password=get_tty_password(NullS);
@@ -933,6 +940,23 @@ static FILE* open_sql_file_for_table(const char* table)
}
+static void free_resources()
+{
+ if (md_result_file && md_result_file != stdout)
+ my_fclose(md_result_file, MYF(0));
+ my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ if (hash_inited(&ignore_table))
+ hash_free(&ignore_table);
+ if (extended_insert)
+ dynstr_free(&extended_row);
+ if (insert_pat_inited)
+ dynstr_free(&insert_pat);
+ if (defaults_argv)
+ free_defaults(defaults_argv);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
+}
+
+
static void safe_exit(int error)
{
if (!first_error)
@@ -941,18 +965,19 @@ static void safe_exit(int error)
return;
if (mysql)
mysql_close(mysql);
+ free_resources();
exit(error);
}
-/* safe_exit */
/*
-** dbConnect -- connects to the host and selects DB.
+ db_connect -- connects to the host and selects DB.
*/
-static int dbConnect(char *host, char *user,char *passwd)
+
+static int connect_to_db(char *host, char *user,char *passwd)
{
char buff[20+FN_REFLEN];
- DBUG_ENTER("dbConnect");
+ DBUG_ENTER("connect_to_db");
verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
mysql_init(&mysql_connection);
@@ -973,11 +998,11 @@ static int dbConnect(char *host, char *user,char *passwd)
#endif
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql= mysql_real_connect(&mysql_connection,host,user,passwd,
- NULL,opt_mysql_port,opt_mysql_unix_port,
- 0)))
+ NULL,opt_mysql_port,opt_mysql_unix_port,
+ 0)))
{
DB_error(&mysql_connection, "when trying to connect");
- return 1;
+ DBUG_RETURN(1);
}
/*
Don't dump SET NAMES with a pre-4.1 server (bug#7997).
@@ -994,7 +1019,7 @@ static int dbConnect(char *host, char *user,char *passwd)
if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
- return 1;
+ DBUG_RETURN(1);
}
/*
set time_zone to UTC to allow dumping date types between servers with
@@ -1006,11 +1031,11 @@ static int dbConnect(char *host, char *user,char *passwd)
if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
- return 1;
+ DBUG_RETURN(1);
}
}
- return 0;
-} /* dbConnect */
+ DBUG_RETURN(0);
+} /* connect_to_db */
/*
@@ -1535,8 +1560,8 @@ static uint dump_routines_for_db(char *db)
if the user has EXECUTE privilege he see routine names, but NOT the
routine body of other routines that are not the creator of!
*/
- DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d",
- routine_name, row[2], strlen(row[2])));
+ DBUG_PRINT("info",("length of body for %s row[2] '%s' is %ld",
+ routine_name, row[2], (long) strlen(row[2])));
if (strlen(row[2]))
{
char *query_str= NULL;
@@ -1659,7 +1684,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
complete_insert= opt_complete_insert;
if (!insert_pat_inited)
- insert_pat_inited= init_dynamic_string(&insert_pat, "", 1024, 1024);
+ {
+ insert_pat_inited= 1;
+ if (init_dynamic_string(&insert_pat, "", 1024, 1024))
+ safe_exit(EX_MYSQLERR);
+ }
else
dynstr_set(&insert_pat, "");
}
@@ -2134,7 +2163,7 @@ continue_xml:
*/
-static void dump_triggers_for_table (char *table, char *db)
+static void dump_triggers_for_table(char *table, char *db)
{
char *result_table;
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
@@ -2322,7 +2351,7 @@ static void dump_table(char *table, char *db)
The "table" could be a view. If so, we don't do anything here.
*/
if (strcmp (table_type, "VIEW") == 0)
- return;
+ DBUG_VOID_RETURN;
/* Check --no-data flag */
if (opt_no_data)
@@ -2630,16 +2659,16 @@ static void dump_table(char *table, char *db)
{
if (opt_hex_blob && is_blob && length)
{
- /* Define xsi:type="xs:hexBinary" for hex encoded data */
- print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
- field->name, "xsi:type=", "xs:hexBinary", NullS);
- print_blob_as_hex(md_result_file, row[i], length);
+ /* Define xsi:type="xs:hexBinary" for hex encoded data */
+ print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
+ field->name, "xsi:type=", "xs:hexBinary", NullS);
+ print_blob_as_hex(md_result_file, row[i], length);
}
else
{
- print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
- field->name, NullS);
- print_quoted_xml(md_result_file, row[i], length);
+ print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
+ field->name, NullS);
+ print_quoted_xml(md_result_file, row[i], length);
}
fputs("</field>\n", md_result_file);
}
@@ -2980,6 +3009,8 @@ static int dump_databases(char **db_names)
{
int result=0;
char **db;
+ DBUG_ENTER("dump_databases");
+
for (db= db_names ; *db ; db++)
{
if (dump_all_tables_in_db(*db))
@@ -2993,7 +3024,7 @@ static int dump_databases(char **db_names)
result=1;
}
}
- return result;
+ DBUG_RETURN(result);
} /* dump_databases */
@@ -3008,7 +3039,7 @@ RETURN VALUES
0 Success.
1 Failure.
*/
-int init_dumping_views(char *qdatabase)
+int init_dumping_views(char *qdatabase __attribute__((unused)))
{
return 0;
} /* init_dumping_views */
@@ -3105,12 +3136,11 @@ static int init_dumping(char *database, int init_func(char*))
} /* init_dumping */
+/* Return 1 if we should copy the table */
+
my_bool include_table(byte* hash_key, uint len)
{
- if (hash_search(&ignore_table, (byte*) hash_key, len))
- return FALSE;
-
- return TRUE;
+ return !hash_search(&ignore_table, (byte*) hash_key, len);
}
@@ -3119,18 +3149,16 @@ static int dump_all_tables_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
-
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot;
int using_mysql_db= my_strcasecmp(&my_charset_latin1, database, "mysql");
+ DBUG_ENTER("dump_all_tables_in_db");
afterdot= strmov(hash_key, database);
*afterdot++= '.';
- if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */
- return 0;
if (init_dumping(database, init_dumping_tables))
- return 1;
+ DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables)
@@ -3190,7 +3218,7 @@ static int dump_all_tables_in_db(char *database)
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n");
}
- return 0;
+ DBUG_RETURN(0);
} /* dump_all_tables_in_db */
@@ -3558,7 +3586,6 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
/*
-
SYNOPSIS
Check if we the table is one of the table types that should be ignored:
@@ -3598,8 +3625,8 @@ char check_if_ignore_table(const char *table_name, char *table_type)
{
if (mysql_errno(mysql) != ER_PARSE_ERROR)
{ /* If old MySQL version */
- verbose_msg("-- Warning: Couldn't get status information for " \
- "table %s (%s)\n", table_name,mysql_error(mysql));
+ verbose_msg("-- Warning: Couldn't get status information for "
+ "table %s (%s)\n", table_name, mysql_error(mysql));
DBUG_RETURN(result); /* assume table is ok */
}
}
@@ -3954,19 +3981,24 @@ static my_bool get_view_structure(char *table, char* db)
int main(int argc, char **argv)
{
+ int exit_code;
MY_INIT("mysqldump");
compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset;
bzero((char*) &ignore_table, sizeof(ignore_table));
- if (get_options(&argc, &argv))
+ exit_code= get_options(&argc, &argv);
+ if (exit_code)
{
- my_end(0);
- exit(EX_USAGE);
+ free_resources(0);
+ exit(exit_code);
}
- if (dbConnect(current_host, current_user, opt_password))
+ if (connect_to_db(current_host, current_user, opt_password))
+ {
+ free_resources(0);
exit(EX_MYSQLERR);
+ }
if (!path)
write_header(md_result_file, *argv);
@@ -4016,15 +4048,6 @@ err:
dbDisconnect(current_host);
if (!path)
write_footer(md_result_file);
- if (md_result_file != stdout)
- my_fclose(md_result_file, MYF(0));
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
- if (hash_inited(&ignore_table))
- hash_free(&ignore_table);
- if (extended_insert)
- dynstr_free(&extended_row);
- if (insert_pat_inited)
- dynstr_free(&insert_pat);
- my_end(0);
+ free_resources();
return(first_error);
} /* main */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 2ef08c9a504..447c3322de7 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "3.5"
+#define IMPORT_VERSION "3.6"
#include "client_priv.h"
#include "mysql_version.h"
@@ -50,7 +50,7 @@ static char *add_load_option(char *ptr,const char *object,
static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
replace=0,silent=0,ignore=0,opt_compress=0,
opt_low_priority= 0, tty_password= 0;
-static my_bool opt_use_threads= 0;
+static my_bool opt_use_threads= 0, info_flag= 0;
static uint opt_local_file=0;
static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
@@ -88,6 +88,8 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", (gptr*) &opt_delete,
(gptr*) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
@@ -663,6 +665,6 @@ int main(int argc, char **argv)
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
free_defaults(argv_to_free);
- my_end(0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
return(exitcode);
}
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 40405c53565..153bddc48d7 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -16,7 +16,7 @@
/* Show databases, tables or columns */
-#define SHOW_VERSION "9.5"
+#define SHOW_VERSION "9.6"
#include "client_priv.h"
#include <my_sys.h>
@@ -28,8 +28,8 @@
#include <sslopt-vars.h>
static my_string host=0,opt_password=0,user=0;
-static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0,
- tty_password= 0, opt_table_type= 0;
+static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
+static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
@@ -129,8 +129,7 @@ int main(int argc, char **argv)
}
mysql.reconnect= 1;
- switch (argc)
- {
+ switch (argc) {
case 0: error=list_dbs(&mysql,wild); break;
case 1:
if (opt_status)
@@ -151,7 +150,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SMEM
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
- my_end(0);
+ my_end(info_flag ? MY_CHECK_ERROR : 0);
exit(error ? 1 : 0);
return 0; /* No compiler warnings */
}
@@ -177,6 +176,8 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 9c8585915a9..cba6f3009be 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -592,7 +592,7 @@ get_random_string(char *buf)
DBUG_ENTER("get_random_string");
for (x= RAND_STRING_SIZE; x > 0; x--)
*buf_ptr++= ALPHANUMERICS[random() % ALPHANUMERICS_SIZE];
- DBUG_PRINT("info", ("random string: '%*s'", buf_ptr - buf, buf));
+ DBUG_PRINT("info", ("random string: '%*s'", (int) (buf_ptr - buf), buf));
DBUG_RETURN(buf_ptr - buf);
}
@@ -1031,7 +1031,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
for (x= 0; x < concur; x++)
{
int pid;
- DBUG_PRINT("info", ("x %d concurrency %d", x, concurrency));
+ DBUG_PRINT("info", ("x: %d concurrency: %u", x, *concurrency));
pid= fork();
switch(pid)
{
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 1d7c3f0575d..a45984ffe02 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -29,6 +29,7 @@
Matt Wagner <matt@mysql.com>
Monty
Jani
+ Holyfoot
*/
#define MTEST_VERSION "3.0"
@@ -80,12 +81,13 @@ enum {
OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_PS_PROTOCOL,
OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
OPT_SSL_VERIFY_SERVER_CERT, OPT_MAX_CONNECT_RETRIES,
- OPT_MARK_PROGRESS, OPT_CHARSETS_DIR
+ OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR, OPT_DEBUG_INFO
};
static int record= 0, opt_sleep= -1;
static char *db= 0, *pass= 0;
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
+const char *opt_logdir= "";
const char *opt_include= 0, *opt_charsets_dir;
static int port= 0;
static int opt_max_connect_retries;
@@ -97,6 +99,7 @@ static my_bool sp_protocol= 0, sp_protocol_enabled= 0;
static my_bool view_protocol= 0, view_protocol_enabled= 0;
static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0;
static my_bool parsing_disabled= 0;
+static my_bool info_flag;
static my_bool display_result_vertically= FALSE, display_metadata= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0;
static my_bool disable_warnings= 0, disable_ps_warnings= 0;
@@ -220,6 +223,12 @@ struct st_connection
MYSQL* util_mysql;
char *name;
MYSQL_STMT* stmt;
+
+ const char *cur_query;
+ int cur_query_len;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int query_done;
};
struct st_connection connections[128];
struct st_connection* cur_con, *next_con, *connections_end;
@@ -460,7 +469,6 @@ void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif
-
void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len);
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
@@ -471,7 +479,56 @@ void handle_error(struct st_command*,
const char *err_sqlstate, DYNAMIC_STRING *ds);
void handle_no_error(struct st_command*);
+#ifdef EMBEDDED_LIBRARY
+/*
+ send_one_query executes query in separate thread what is
+ necessary in embedded library to run 'send' in proper way.
+ This implementation doesn't handle errors returned
+ by mysql_send_query. It's technically possible, though
+ i don't see where it is needed.
+*/
+pthread_handler_t send_one_query(void *arg)
+{
+ struct st_connection *cn= (struct st_connection*)arg;
+
+ mysql_thread_init();
+ VOID(mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len));
+
+ mysql_thread_end();
+ pthread_mutex_lock(&cn->mutex);
+ cn->query_done= 1;
+ VOID(pthread_cond_signal(&cn->cond));
+ pthread_mutex_unlock(&cn->mutex);
+ pthread_exit(0);
+ return 0;
+}
+
+static int do_send_query(struct st_connection *cn, const char *q, int q_len,
+ int flags)
+{
+ pthread_t tid;
+ if (flags & QUERY_REAP_FLAG)
+ return mysql_send_query(&cn->mysql, q, q_len);
+
+ if (pthread_mutex_init(&cn->mutex, NULL) ||
+ pthread_cond_init(&cn->cond, NULL))
+ die("Error in the thread library");
+
+ cn->cur_query= q;
+ cn->cur_query_len= q_len;
+ cn->query_done= 0;
+ if (pthread_create(&tid, NULL, send_one_query, (void*)cn))
+ die("Cannot start new thread for query");
+
+ return 0;
+}
+
+#else /*EMBEDDED_LIBRARY*/
+
+#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
+
+#endif /*EMBEDDED_LIBRARY*/
void do_eval(DYNAMIC_STRING *query_eval, const char *query,
const char *query_end, my_bool pass_through_escape_chars)
@@ -754,7 +811,7 @@ void die(const char *fmt, ...)
/* Clean up and exit */
free_used_memory();
- my_end(MY_CHECK_ERROR);
+ my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("not ok\n");
@@ -794,7 +851,7 @@ void abort_not_supported_test(const char *fmt, ...)
/* Clean up and exit */
free_used_memory();
- my_end(MY_CHECK_ERROR);
+ my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
if (!silent)
printf("skipped\n");
@@ -893,8 +950,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
die(NullS);
if (!eval_result && (uint) stat_info.st_size != ds->length)
{
- DBUG_PRINT("info",("Size differs: result size: %u file size: %llu",
- ds->length, stat_info.st_size));
+ DBUG_PRINT("info",("Size differs: result size: %u file size: %lu",
+ ds->length, (ulong) stat_info.st_size));
DBUG_PRINT("info",("result: '%s'", ds->str));
DBUG_RETURN(RESULT_LENGTH_MISMATCH);
}
@@ -3119,14 +3176,14 @@ void do_connect(struct st_command *command)
else if (!strncmp(con_options, "COMPRESS", 8))
con_compress= 1;
else
- die("Illegal option to connect: %.*s", end - con_options, con_options);
+ die("Illegal option to connect: %.*s", (int) (end - con_options), con_options);
/* Process next option */
con_options= end;
}
if (next_con == connections_end)
- die("Connection limit exhausted, you can have max %d connections",
- (sizeof(connections)/sizeof(struct st_connection)));
+ die("Connection limit exhausted, you can have max %ld connections",
+ (long) (sizeof(connections)/sizeof(struct st_connection)));
if (find_connection_by_name(ds_connection_name.str))
die("Connection %s already exists", ds_connection_name.str);
@@ -3844,12 +3901,16 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag,
+ (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir,
+ (gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mark-progress", OPT_MARK_PROGRESS,
- "Write linenumber and elapsed time to <testname>.progress ",
+ "Write linenumber and elapsed time to <testname>.progress",
(gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
@@ -4130,7 +4191,8 @@ void dump_result_to_reject_file(char *buf, int size)
void dump_result_to_log_file(char *buf, int size)
{
char log_file[FN_REFLEN];
- str_to_file(fn_format(log_file, result_file_name, "", ".log",
+ str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log",
+ *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT:
MY_REPLACE_EXT),
buf, size);
}
@@ -4138,8 +4200,9 @@ void dump_result_to_log_file(char *buf, int size)
void dump_progress(void)
{
char log_file[FN_REFLEN];
- str_to_file(fn_format(log_file, result_file_name, "", ".progress",
- MY_REPLACE_EXT),
+ str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".progress",
+ *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT:
+ MY_REPLACE_EXT),
ds_progress.str, ds_progress.length);
}
@@ -4550,7 +4613,6 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
}
-
/*
Run query using MySQL C API
@@ -4567,11 +4629,12 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
error - function will not return
*/
-void run_query_normal(MYSQL *mysql, struct st_command *command,
+void run_query_normal(struct st_connection *cn, struct st_command *command,
int flags, char *query, int query_len,
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
{
MYSQL_RES *res= 0;
+ MYSQL *mysql= &cn->mysql;
int err= 0, counter= 0;
DBUG_ENTER("run_query_normal");
DBUG_PRINT("enter",("flags: %d", flags));
@@ -4582,14 +4645,26 @@ void run_query_normal(MYSQL *mysql, struct st_command *command,
/*
Send the query
*/
- if (mysql_send_query(mysql, query, query_len))
+ if (do_send_query(cn, query, query_len, flags))
{
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
goto end;
}
}
-
+#ifdef EMBEDDED_LIBRARY
+ /*
+ Here we handle 'reap' command, so we need to check if the
+ query's thread was finished and probably wait
+ */
+ else if (flags & QUERY_REAP_FLAG)
+ {
+ pthread_mutex_lock(&cn->mutex);
+ while (!cn->query_done)
+ pthread_cond_wait(&cn->cond, &cn->mutex);
+ pthread_mutex_unlock(&cn->mutex);
+ }
+#endif /*EMBEDDED_LIBRARY*/
if (!(flags & QUERY_REAP_FLAG))
DBUG_VOID_RETURN;
@@ -5080,8 +5155,9 @@ int util_query(MYSQL* org_mysql, const char* query){
*/
-void run_query(MYSQL *mysql, struct st_command *command, int flags)
+void run_query(struct st_connection *cn, struct st_command *command, int flags)
{
+ MYSQL *mysql= &cn->mysql;
DYNAMIC_STRING *ds;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_warnings;
@@ -5238,7 +5314,7 @@ void run_query(MYSQL *mysql, struct st_command *command, int flags)
match_re(&ps_re, query))
run_query_stmt(mysql, command, query, query_len, ds, &ds_warnings);
else
- run_query_normal(mysql, command, flags, query, query_len,
+ run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
if (sp_created)
@@ -5704,7 +5780,7 @@ int main(int argc, char **argv)
strmake(command->require_file, save_file, sizeof(save_file));
save_file[0]= 0;
}
- run_query(&cur_con->mysql, command, QUERY_REAP_FLAG|QUERY_SEND_FLAG);
+ run_query(cur_con, command, QUERY_REAP_FLAG|QUERY_SEND_FLAG);
display_result_vertically= old_display_result_vertically;
command->last_argument= command->end;
command_executed++;
@@ -5735,7 +5811,7 @@ int main(int argc, char **argv)
strmake(command->require_file, save_file, sizeof(save_file));
save_file[0]= 0;
}
- run_query(&cur_con->mysql, command, flags);
+ run_query(cur_con, command, flags);
command_executed++;
command->last_argument= command->end;
break;
@@ -5761,7 +5837,7 @@ int main(int argc, char **argv)
the query and read the result some time later when reap instruction
is given on this connection.
*/
- run_query(&cur_con->mysql, command, QUERY_SEND_FLAG);
+ run_query(cur_con, command, QUERY_SEND_FLAG);
command_executed++;
command->last_argument= command->end;
break;
@@ -5963,7 +6039,7 @@ int main(int argc, char **argv)
timer_output();
free_used_memory();
- my_end(MY_CHECK_ERROR);
+ my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
/* Yes, if we got this far the test has suceeded! Sakila smiles */
if (!silent)