List:Internals« Previous MessageNext Message »
From:bar Date:March 16 2005 1:52pm
Subject:bk commit into 4.1 tree (bar:1.2125)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar 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
  1.2125 05/03/16 16:52:40 bar@stripped +4 -0
  Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
  not always correct for NULL values.
  Now they always result a non NULL value even
  the argument is NULL. It is more usefull for 
  debugging purposes.

  sql/item_strfunc.cc
    1.221 05/03/16 16:52:31 bar@stripped +7 -8
    Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
    not always correct for NULL values.
    
    A minor mistake in EXPORT_SET() was fixed.

  sql/item_func.cc
    1.237 05/03/16 16:52:30 bar@stripped +0 -5
    Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
    not always correct for NULL values.

  mysql-test/t/func_str.test
    1.70 05/03/16 16:52:30 bar@stripped +9 -0
    Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
    not always correct for NULL values.

  mysql-test/r/func_str.result
    1.89 05/03/16 16:52:30 bar@stripped +10 -1
    Bugs#9129: CHARSET(), COLLATION(), COERCIBILITY()
    not always correct for NULL values.
    
    Also, a mistake in EXPORT_SET was fixed.

# 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:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1

--- 1.236/sql/item_func.cc	2005-03-04 14:16:47 +04:00
+++ 1.237/sql/item_func.cc	2005-03-16 16:52:30 +04:00
@@ -1346,11 +1346,6 @@
 longlong Item_func_coercibility::val_int()
 {
   DBUG_ASSERT(fixed == 1);
-  if (args[0]->null_value)
-  {
-    null_value= 1;
-    return 0;
-  }
   null_value= 0;
   return (longlong) args[0]->collation.derivation;
 }

--- 1.220/sql/item_strfunc.cc	2005-03-15 17:15:43 +04:00
+++ 1.221/sql/item_strfunc.cc	2005-03-16 16:52:31 +04:00
@@ -2290,12 +2290,11 @@
 String *Item_func_charset::val_str(String *str)
 {
   DBUG_ASSERT(fixed == 1);
-  String *res = args[0]->val_str(str);
   uint dummy_errors;
 
-  if ((null_value=(args[0]->null_value || !res->charset())))
-    return 0;
-  str->copy(res->charset()->csname,strlen(res->charset()->csname),
+  CHARSET_INFO *cs= args[0]->collation.collation; 
+  null_value= 0;
+  str->copy(cs->csname, strlen(cs->csname),
 	    &my_charset_latin1, collation.collation, &dummy_errors);
   return str;
 }
@@ -2303,12 +2302,11 @@
 String *Item_func_collation::val_str(String *str)
 {
   DBUG_ASSERT(fixed == 1);
-  String *res = args[0]->val_str(str);
   uint dummy_errors;
+  CHARSET_INFO *cs= args[0]->collation.collation; 
 
-  if ((null_value=(args[0]->null_value || !res->charset())))
-    return 0;
-  str->copy(res->charset()->name,strlen(res->charset()->name),
+  null_value= 0;
+  str->copy(cs->name, strlen(cs->name),
 	    &my_charset_latin1, collation.collation, &dummy_errors);
   return str;
 }
@@ -2472,6 +2470,7 @@
   uint num_set_values = 64;
   ulonglong mask = 0x1;
   str->length(0);
+  str->set_charset(collation.collation);
 
   /* Check if some argument is a NULL value */
   if (args[0]->null_value || args[1]->null_value || args[2]->null_value)

--- 1.88/mysql-test/r/func_str.result	2005-03-10 01:19:40 +04:00
+++ 1.89/mysql-test/r/func_str.result	2005-03-16 16:52:30 +04:00
@@ -512,7 +512,7 @@
 latin2_general_ci	4
 select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')),
coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '));
 collation(export_set(255,_latin2'y',_latin2'n',_latin2'
'))	coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '))
-binary	4
+latin2_general_ci	4
 select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a '));
 collation(trim(_latin2' a '))	coercibility(trim(_latin2' a '))
 latin2_general_ci	4
@@ -627,6 +627,15 @@
   `encode('abcd','ab')` binary(4) NOT NULL default ''
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+create table t1 (a char character set latin2);
+insert into t1 values (null);
+select charset(a), collation(a), coercibility(a) from t1;
+charset(a)	collation(a)	coercibility(a)
+latin2	latin2_general_ci	2
+drop table t1;
+select charset(null), collation(null), coercibility(null);
+charset(null)	collation(null)	coercibility(null)
+binary	binary	5
 select SUBSTR('abcdefg',3,2);
 SUBSTR('abcdefg',3,2)
 cd

--- 1.69/mysql-test/t/func_str.test	2005-03-09 22:58:48 +04:00
+++ 1.70/mysql-test/t/func_str.test	2005-03-16 16:52:30 +04:00
@@ -369,6 +369,15 @@
 drop table t1;
 
 #
+# Bug#9129
+#
+create table t1 (a char character set latin2);
+insert into t1 values (null);
+select charset(a), collation(a), coercibility(a) from t1;
+drop table t1;
+select charset(null), collation(null), coercibility(null);
+
+#
 # test for SUBSTR
 #
 select SUBSTR('abcdefg',3,2);
Thread
bk commit into 4.1 tree (bar:1.2125)bar16 Mar