MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:March 22 2007 8:24am
Subject:bk commit into 4.1 tree (holyfoot:1.2624) BUG#16546
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf 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, 2007-03-22 12:24:56+04:00, holyfoot@stripped +3 -0
   bug #16546 (DATETIME + 0 not always coerced in the same way)
    fix for cast( AS DATETIME) + 0 operation.
    I just implemented Item_datetime_typecast::val() method
    as it is usually done in other classes.
    Should be fixed more radically in 5.0

  mysql-test/r/type_datetime.result@stripped, 2007-03-22 12:24:55+04:00, holyfoot@stripped +3 -0
    result added

  mysql-test/t/type_datetime.test@stripped, 2007-03-22 12:24:56+04:00, holyfoot@stripped +6 -0
    testcase

  sql/item_timefunc.h@stripped, 2007-03-22 12:24:56+04:00, holyfoot@stripped +7 -0
    added double conversion to Item_datetime_typecast

# 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:	holyfoot
# Host:	hfmain.(none)
# Root:	/home/hf/work/mrg/mysql-4.1-opt

--- 1.58/sql/item_timefunc.h	2007-03-22 12:24:59 +04:00
+++ 1.59/sql/item_timefunc.h	2007-03-22 12:24:59 +04:00
@@ -751,12 +751,19 @@ public:
   String *val_str(String *str);
   const char *cast_type() const { return "datetime"; }
   enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
+  void fix_length_and_dec()
+  {
+    Item_typecast_maybe_null::fix_length_and_dec();
+    decimals= DATETIME_DEC;
+  }
+
   Field *tmp_table_field(TABLE *t_arg)
   {
     return (new Field_datetime(maybe_null, name, t_arg, &my_charset_bin));
   }
   bool result_as_longlong() { return TRUE; }
   longlong val_int();
+  double val() { return (double) val_int(); }
 };
 
 class Item_func_makedate :public Item_str_func

--- 1.25/mysql-test/r/type_datetime.result	2007-03-22 12:24:59 +04:00
+++ 1.26/mysql-test/r/type_datetime.result	2007-03-22 12:24:59 +04:00
@@ -166,3 +166,6 @@ dt
 0000-00-00 00:00:00
 0000-00-00 00:00:00
 drop table t1;
+select cast('2006-12-05 22:10:10' as datetime) + 0;
+cast('2006-12-05 22:10:10' as datetime) + 0
+20061205221010.000000

--- 1.18/mysql-test/t/type_datetime.test	2007-03-22 12:24:59 +04:00
+++ 1.19/mysql-test/t/type_datetime.test	2007-03-22 12:24:59 +04:00
@@ -113,4 +113,10 @@ insert into t1 values ("00-00-00"), ("00
 select * from t1;
 drop table t1;
 
+#
+# Bug #16546 DATETIME+0 not always coerced the same way 
+#
+select cast('2006-12-05 22:10:10' as datetime) + 0;
+
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (holyfoot:1.2624) BUG#16546holyfoot22 Mar