summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-03-04 21:08:14 +0400
committerunknown <vva@eagle.mysql.r18.ru>2004-03-04 21:08:14 +0400
commitc8bfc2324b14584f39dd271fa0dd34b0f181d167 (patch)
treef8d4d3bb4447a1e08ce9a2e62100aee706410a62 /client
parente269e9c95fad613b8b0152642a317e2082323230 (diff)
downloadmariadb-git-c8bfc2324b14584f39dd271fa0dd34b0f181d167.tar.gz
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'
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c43
1 files changed, 33 insertions, 10 deletions
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: