List:Commits« Previous MessageNext Message »
From:ramil Date:July 23 2006 9:17am
Subject:bk commit into 4.1 tree (ramil:1.2524)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram 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-07-23 14:17:01+05:00, ramil@stripped +3 -0
  Merge rkalimullin@stripped:/home/bk/mysql-4.1
  into  mysql.com:/usr/home/ram/work/4.1.b16327
  MERGE: 1.2477.4.1

  mysql-test/r/func_time.result@stripped, 2006-07-23 14:16:50+05:00, ramil@stripped +7 -7
    merging
    MERGE: 1.38.1.4

  mysql-test/t/func_time.test@stripped, 2006-07-23 14:16:50+05:00, ramil@stripped +10 -10
    merging
    MERGE: 1.33.1.4

  sql/field.cc@stripped, 2006-07-23 14:14:19+05:00, ramil@stripped +0 -0
    Auto merged
    MERGE: 1.229.1.2

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/4.1.b16327/RESYNC

--- 1.230/sql/field.cc	2006-07-23 14:17:23 +05:00
+++ 1.231/sql/field.cc	2006-07-23 14:17:23 +05:00
@@ -5072,17 +5072,6 @@
 {
   uint a_len, b_len;
 
-  if (field_charset->strxfrm_multiply > 1)
-  {
-    /*
-      We have to remove end space to be able to compare multi-byte-characters
-      like in latin_de 'ae' and 0xe4
-    */
-    return field_charset->coll->strnncollsp(field_charset,
-                                            (const uchar*) a_ptr, field_length,
-                                            (const uchar*) b_ptr,
-                                            field_length);
-  }
   if (field_charset->mbmaxlen != 1)
   {
     uint char_len= field_length/field_charset->mbmaxlen;
@@ -5091,8 +5080,13 @@
   }
   else
     a_len= b_len= field_length;
-  return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len,
-                                    (const uchar*) b_ptr, b_len);
+  /*
+    We have to remove end space to be able to compare multi-byte-characters
+    like in latin_de 'ae' and 0xe4
+  */
+  return field_charset->coll->strnncollsp(field_charset,
+                                          (const uchar*) a_ptr, a_len,
+                                          (const uchar*) b_ptr, b_len);
 }
 
 
@@ -6841,7 +6835,11 @@
 bool 
 Field::set_warning(const uint level, const uint code, int cuted_increment)
 {
-  THD *thd= table->in_use;
+  /*
+    If this field was created only for type conversion purposes it
+    will have table == NULL.
+  */
+  THD *thd= table ? table->in_use : current_thd;
   if (thd->count_cuted_fields)
   {
     thd->cuted_fields+= cuted_increment;
@@ -6876,7 +6874,8 @@
                             timestamp_type ts_type, int cuted_increment)
 {
   if (set_warning(level, code, cuted_increment))
-    make_truncated_value_warning(table->in_use, str, str_length, ts_type);
+    make_truncated_value_warning(table ? table->in_use : current_thd,
+                                 str, str_length, ts_type);
 }
 
 
@@ -6905,8 +6904,8 @@
   {
     char str_nr[22];
     char *str_end= longlong10_to_str(nr, str_nr, -10);
-    make_truncated_value_warning(table->in_use, str_nr, str_end - str_nr, 
-                                 ts_type);
+    make_truncated_value_warning(table ? table->in_use : current_thd,
+                                 str_nr, str_end - str_nr, ts_type);
   }
 }
 
@@ -6935,7 +6934,8 @@
     /* DBL_DIG is enough to print '-[digits].E+###' */
     char str_nr[DBL_DIG + 8];
     uint str_len= my_sprintf(str_nr, (str_nr, "%g", nr));
-    make_truncated_value_warning(table->in_use, str_nr, str_len, ts_type);
+    make_truncated_value_warning(table ? table->in_use : current_thd,
+                                 str_nr, str_len, ts_type);
   }
 }
 

--- 1.39/mysql-test/r/func_time.result	2006-07-23 14:17:23 +05:00
+++ 1.40/mysql-test/r/func_time.result	2006-07-23 14:17:23 +05:00
@@ -7,20 +7,20 @@
 199502	13
 select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
 now()-now()	weekday(curdate())-weekday(now())	unix_timestamp()-unix_timestamp(now())
-0	0	0
+0.000000	0	0
 select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
 from_unixtime(unix_timestamp("1994-03-02 10:11:12"))	from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s")	from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0
-1994-03-02 10:11:12	1994-03-02 10:11:12	19940302101112
+1994-03-02 10:11:12	1994-03-02 10:11:12	19940302101112.000000
 select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
 sec_to_time(time_to_sec("0:30:47")/6.21);
 sec_to_time(9001)	sec_to_time(9001)+0	time_to_sec("15:12:22")	sec_to_time(time_to_sec("0:30:47")/6.21)
-02:30:01	23001	54742	00:04:57
+02:30:01	23001.000000	54742	00:04:57
 select sec_to_time(time_to_sec('-838:59:59'));
 sec_to_time(time_to_sec('-838:59:59'))
 -838:59:59
 select now()-curdate()*1000000-curtime();
 now()-curdate()*1000000-curtime()
-0
+0.000000
 select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
 strcmp(current_timestamp(),concat(current_date()," ",current_time()))
 0
@@ -352,6 +352,12 @@
 select extract(MONTH FROM "2001-02-00");
 extract(MONTH FROM "2001-02-00")
 2
+SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
+DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
+9999-12-31 00:00:00
+SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
+DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE)
+9999-12-31 00:00:00
 SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
 "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
 1968-01-20 03:14:08
@@ -636,4 +642,56 @@
 select * from t1;
 a
 1969-12-31 19:00:01
+drop table t1;
+create table t1(f1 date, f2 time, f3 datetime);
+insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
+insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
+select f1 from t1 where f1 between "2006-1-1" and 20060101;
+f1
+2006-01-01
+select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
+f1
+2006-01-01
+select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
+f1
+2006-01-01
+select f2 from t1 where f2 between "12:1:2" and "12:2:2";
+f2
+12:01:02
+select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
+f2
+12:01:02
+select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+f3
+2006-01-01 12:01:01
+select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+f3
+2006-01-01 12:01:01
+select f1 from t1 where "2006-1-1" between f1 and f3;
+f1
+2006-01-01
+select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
+f1
+2006-01-01
+select f1 from t1 where "2006-1-1" between f1 and 'zzz';
+f1
+Warnings:
+Warning	1292	Truncated incorrect date value: 'zzz'
+select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
+f1
+2006-01-01
+select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
+f1
+2006-01-02
+drop table t1;
+create table t1 select now() - now(), curtime() - curtime(), 
+sec_to_time(1) + 0, from_unixtime(1) + 0;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `now() - now()` double(23,6) NOT NULL default '0.000000',
+  `curtime() - curtime()` double(23,6) NOT NULL default '0.000000',
+  `sec_to_time(1) + 0` double(23,6) default NULL,
+  `from_unixtime(1) + 0` double(23,6) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;

--- 1.34/mysql-test/t/func_time.test	2006-07-23 14:17:23 +05:00
+++ 1.35/mysql-test/t/func_time.test	2006-07-23 14:17:23 +05:00
@@ -140,6 +140,12 @@
 select extract(MONTH FROM "2001-02-00");
 
 #
+# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
+#
+SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
+SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
+
+#
 # Test big intervals (Bug #3498)
 #
 SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
@@ -330,6 +336,36 @@
 create table t1(a timestamp);
 insert into t1 values (19691231190001);
 select * from t1;
+drop table t1;
+
+#
+# Bug#16377 result of DATE/TIME functions were compared as strings which
+#           can lead to a wrong result.
+#
+create table t1(f1 date, f2 time, f3 datetime);
+insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
+insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
+select f1 from t1 where f1 between "2006-1-1" and 20060101;
+select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
+select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
+select f2 from t1 where f2 between "12:1:2" and "12:2:2";
+select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
+select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
+select f1 from t1 where "2006-1-1" between f1 and f3;
+select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
+select f1 from t1 where "2006-1-1" between f1 and 'zzz';
+select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
+select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
+drop table t1;
+
+#
+# Bug #16546
+# 
+
+create table t1 select now() - now(), curtime() - curtime(), 
+                       sec_to_time(1) + 0, from_unixtime(1) + 0;
+show create table t1;
 drop table t1;
 
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (ramil:1.2524)ramil23 Jul