Commit b379016d authored by unknown's avatar unknown

Fixed a bug in mysql client.


client/mysql.cc:
  Fixed a bug in option -N
parent 79efd9db
......@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
const char *VER= "12.9";
const char *VER= "12.10";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
......@@ -645,6 +645,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'A':
rehash= 0;
break;
case 'N':
column_names= 0;
break;
case 'e':
status.batch= 1;
status.add_to_history= 0;
......@@ -1597,18 +1600,19 @@ print_table_data(MYSQL_RES *result)
tee_puts(separator.c_ptr(), PAGER);
}
while ((cur = mysql_fetch_row(result)))
while ((cur= mysql_fetch_row(result)))
{
(void) tee_fputs("|", PAGER);
mysql_field_seek(result,0);
for (uint off=0 ; off < mysql_num_fields(result); off++)
mysql_field_seek(result, 0);
for (uint off= 0; off < mysql_num_fields(result); off++)
{
const char *str=cur[off] ? cur[off] : "NULL";
field = mysql_fetch_field(result);
uint length=field->max_length;
const char *str= cur[off] ? cur[off] : "NULL";
field= mysql_fetch_field(result);
uint length= field->max_length;
if (length > MAX_COLUMN_LENGTH)
{
tee_fputs(str,PAGER); tee_fputs(" |",PAGER);
tee_fputs(str, PAGER);
tee_fputs(" |", PAGER);
}
else
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment