Commit 2e72ae3d authored by unknown's avatar unknown

Bug#19564: mysql displays NULL instead of space

Correct a bug (that I introduced, after using Oracle's database software for 
too many years) where the length of the database-sent data is incorrectly 
used to infer NULLness.


client/mysql.cc:
  No longer use the length of the data to infer whether it is NULL or not.
mysql-test/r/mysql.result:
  Add result and version marker, and correct previous result.
mysql-test/t/mysql.test:
  Add test and version marker
parent 481493a6
...@@ -2319,7 +2319,7 @@ print_table_data(MYSQL_RES *result) ...@@ -2319,7 +2319,7 @@ print_table_data(MYSQL_RES *result)
uint extra_padding; uint extra_padding;
/* If this column may have a null value, use "NULL" for empty. */ /* If this column may have a null value, use "NULL" for empty. */
if (! not_null_flag[off] && (lengths[off] == 0)) if (! not_null_flag[off] && (cur[off] == NULL))
{ {
buffer= "NULL"; buffer= "NULL";
data_length= 4; data_length= 4;
......
...@@ -74,7 +74,7 @@ c_cp932 ...@@ -74,7 +74,7 @@ c_cp932
+----------------------+------------+--------+ +----------------------+------------+--------+
| >a < | b | 123421 | | >a < | b | 123421 |
| >a < | 0123456789 | 4 | | >a < | 0123456789 | 4 |
| >abcd< | NULL | 4 | | >abcd< | | 4 |
+----------------------+------------+--------+ +----------------------+------------+--------+
+------+------+---------------------------+ +------+------+---------------------------+
| i | j | k | | i | j | k |
...@@ -94,6 +94,14 @@ c_cp932 ...@@ -94,6 +94,14 @@ c_cp932
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | | | i | int(11) | YES | | NULL | |
| j | int(11) | NO | | NULL | | | j | int(11) | NO | | | |
| k | int(11) | YES | | NULL | | | k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
+------+------+
| i | s1 |
+------+------+
| 1 | x |
| 2 | NULL |
| 3 | |
+------+------+
End of 5.0 tests
...@@ -72,3 +72,11 @@ drop table t1; ...@@ -72,3 +72,11 @@ drop table t1;
# #
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;" --exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
#
# Bug#19564: mysql displays NULL instead of space
#
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
--echo End of 5.0 tests
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