MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:September 13 2006 3:41pm
Subject:bk commit into 5.0 tree (cmiller:1.2234) BUG#21618
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-09-13 11:41:41-04:00, cmiller@stripped +3 -0
  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@stripped, 2006-09-13 11:41:39-04:00, cmiller@stripped +1 -5
    Don't check the column's NOT NULL flag when determining whether to print 
    "NULL" or not.

  mysql-test/r/mysql.result@stripped, 2006-09-13 11:41:39-04:00, cmiller@stripped +17 -0
    Add results and confirm that the other output forms give the same results
    for other similar tests.

  mysql-test/t/mysql.test@stripped, 2006-09-13 11:41:39-04:00, cmiller@stripped +8 -0
    Add regression tests for this bug and two similar bugs.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/bug21618/my50-bug21618

--- 1.209/client/mysql.cc	2006-09-13 11:41:44 -04:00
+++ 1.210/client/mysql.cc	2006-09-13 11:41:44 -04:00
@@ -2270,10 +2270,8 @@
   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 @@
                                             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 @@
       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 @@
   }
   tee_puts((char*) separator.ptr(), PAGER);
   my_afree((gptr) num_flag);
-  my_afree((gptr) not_null_flag);
 }
 
 

--- 1.11/mysql-test/r/mysql.result	2006-09-13 11:41:44 -04:00
+++ 1.12/mysql-test/r/mysql.result	2006-09-13 11:41:44 -04:00
@@ -85,6 +85,12 @@
 | NULL | NULL | Τη γλώσσα                 | 
 | NULL | NULL | ᛖᚴ ᚷᛖᛏ                    | 
 +------+------+---------------------------+
+i	j	k
+NULL	1	NULL
+Field	Type	Null	Key	Default	Extra
+i	int(11)	YES		NULL	
+j	int(11)	NO			
+k	int(11)	YES		NULL	
 +------+---+------+
 | i    | j | k    |
 +------+---+------+
@@ -97,6 +103,10 @@
 | j     | int(11) | NO   |     |         |       | 
 | k     | int(11) | YES  |     | NULL    |       | 
 +-------+---------+------+-----+---------+-------+
+i	s1
+1	x
+2	NULL
+3	
 +------+------+
 | i    | s1   |
 +------+------+
@@ -104,4 +114,11 @@
 |    2 | NULL | 
 |    3 |      | 
 +------+------+
+unhex('zz')
+NULL
++-------------+
+| unhex('zz') |
++-------------+
+| NULL        | 
++-------------+
 End of 5.0 tests

--- 1.11/mysql-test/t/mysql.test	2006-09-13 11:41:44 -04:00
+++ 1.12/mysql-test/t/mysql.test	2006-09-13 11:41:44 -04:00
@@ -70,12 +70,20 @@
 #
 # "DESCRIBE" commands may return strange NULLness flags.
 #
+--exec $MYSQL --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 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;" 
 --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;" 
+
+#
+# Bug#21618: NULL shown as empty string in client
+#
+--exec $MYSQL test -e "select unhex('zz');" 
+--exec $MYSQL -t test -e "select unhex('zz');" 
 
 --echo End of 5.0 tests
 
Thread
bk commit into 5.0 tree (cmiller:1.2234) BUG#21618Chad MILLER13 Sep