summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2006-09-13 11:41:41 -0400
committerunknown <cmiller@zippy.cornsilk.net>2006-09-13 11:41:41 -0400
commit306827a5ccb5c92b964b847e4927601b9fecd5ae (patch)
treea5f1f2c07aca67c9630a82a7f968a47bc7d90961 /client
parentd31a3434650a9991bcc16478e65efd7d2ea23c76 (diff)
downloadmariadb-git-306827a5ccb5c92b964b847e4927601b9fecd5ae.tar.gz
Bug #21618: NULL shown as empty string in client
The column's NOT NULL flag doesn't affect what we should print. Remove the wrong logic that does check it. Also, verify that this and the previous two tests print the same data as other output formats. client/mysql.cc: Don't check the column's NOT NULL flag when determining whether to print "NULL" or not. mysql-test/r/mysql.result: Add results and confirm that the other output forms give the same results for other similar tests. mysql-test/t/mysql.test: Add regression tests for this bug and two similar bugs.
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 94b43d030e8..bd97ffd4947 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2270,10 +2270,8 @@ print_table_data(MYSQL_RES *result)
MYSQL_ROW cur;
MYSQL_FIELD *field;
bool *num_flag;
- bool *not_null_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
- not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
if (info_flag)
{
print_field_types(result);
@@ -2307,7 +2305,6 @@ print_table_data(MYSQL_RES *result)
MAX_COLUMN_LENGTH),
field->name);
num_flag[off]= IS_NUM(field->type);
- not_null_flag[off]= IS_NOT_NULL(field->flags);
}
(void) tee_fputs("\n", PAGER);
tee_puts((char*) separator.ptr(), PAGER);
@@ -2328,7 +2325,7 @@ print_table_data(MYSQL_RES *result)
uint extra_padding;
/* If this column may have a null value, use "NULL" for empty. */
- if (! not_null_flag[off] && (cur[off] == NULL))
+ if (cur[off] == NULL)
{
buffer= "NULL";
data_length= 4;
@@ -2368,7 +2365,6 @@ print_table_data(MYSQL_RES *result)
}
tee_puts((char*) separator.ptr(), PAGER);
my_afree((gptr) num_flag);
- my_afree((gptr) not_null_flag);
}