From c8bfc2324b14584f39dd271fa0dd34b0f181d167 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Mar 2004 21:08:14 +0400 Subject: Fixed bug #2082 'mysqldump converts "inf" to NULL' and added commands vertical_results and horisontal_results to client/mysqltest.c client/mysqltest.c: added commands vertical_results and horisontal_results mysql-test/r/insert.result: added test for bug #2082 'mysqldump converts "inf" to NULL' mysql-test/t/insert.test: Fixed bug #2082 'mysqldump converts "inf" to NULL' sql/field.cc: added test for Fixed bug #2082 'mysqldump converts "inf" to NULL' --- client/mysqltest.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/mysqltest.c b/client/mysqltest.c index 70dcc874b0f..823b4d8df1b 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -128,6 +128,8 @@ static CHARSET_INFO *charset_info= &my_charset_latin1; static int embedded_server_arg_count=0; static char *embedded_server_args[MAX_SERVER_ARGS]; +static my_bool display_result_vertically= FALSE; + static const char *embedded_server_groups[] = { "server", "embedded", @@ -213,6 +215,7 @@ Q_REQUIRE_VERSION, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_INFO, Q_DISABLE_INFO, Q_EXEC, Q_DELIMITER, +Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORISONTAL_RESULTS, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -286,6 +289,8 @@ const char *command_names[]= "disable_info", "exec", "delimiter", + "vertical_results", + "horisontal_results", 0 }; @@ -2110,6 +2115,7 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res) { MYSQL_ROW row; uint num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= !display_result_vertically ? 0 : mysql_fetch_fields(res); unsigned long *lengths; while ((row = mysql_fetch_row(res))) { @@ -2130,11 +2136,22 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res) val= "NULL"; len= 4; } - if (i) + if (!display_result_vertically) + { + if (i) + dynstr_append_mem(ds, "\t", 1); + replace_dynstr_append_mem(ds, val, len); + } + else + { + dynstr_append(ds, fields[i].name); dynstr_append_mem(ds, "\t", 1); - replace_dynstr_append_mem(ds, val, len); + replace_dynstr_append_mem(ds, val, len); + dynstr_append_mem(ds, "\n", 1); + } } - dynstr_append_mem(ds, "\n", 1); + if (!display_result_vertically) + dynstr_append_mem(ds, "\n", 1); } free_replace_column(); } @@ -2276,16 +2293,19 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) { if (res) { - int num_fields= mysql_num_fields(res); - MYSQL_FIELD *fields= mysql_fetch_fields(res); - for (i = 0; i < num_fields; i++) + if (!display_result_vertically) { - if (i) - dynstr_append_mem(ds, "\t", 1); - dynstr_append(ds, fields[i].name); + int num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= mysql_fetch_fields(res); + for (i = 0; i < num_fields; i++) + { + if (i) + dynstr_append_mem(ds, "\t", 1); + dynstr_append(ds, fields[i].name); + } + dynstr_append_mem(ds, "\n", 1); } - dynstr_append_mem(ds, "\n", 1); append_result(ds, res); } @@ -2557,6 +2577,9 @@ int main(int argc, char **argv) strmake(delimiter, q->first_argument, sizeof(delimiter) - 1); delimiter_length= strlen(delimiter); break; + case Q_DISPLAY_VERTICAL_RESULTS: display_result_vertically= TRUE; break; + case Q_DISPLAY_HORISONTAL_RESULTS: + display_result_vertically= FALSE; break; case Q_LET: do_let(q); break; case Q_EVAL_RESULT: eval_result = 1; break; case Q_EVAL: -- cgit v1.2.1