From: Date: March 23 2004 6:10pm Subject: bk commit into 4.1 tree (hf:1.1713) List-Archive: http://lists.mysql.com/internals/13074 Message-Id: <200403231710.i2NHAP9v012234@localhost.localdomain> 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://www.mysql.com/doc/I/n/Installing_source_tree.html ChangeSet 1.1713 04/03/23 21:10:23 hf@deer.(none) +3 -0 Fix for #3264 (FROM_DAYS doesn't work properly in range comparison) Item_func_from_days::get_date didn't change 'hr', 'min' and some other fields of incoming ltime, so they got random values. bzeroing of the ltime added sql/item_timefunc.cc 1.58 04/03/23 21:09:57 hf@deer.(none) +1 -0 cleaning ltime added mysql-test/t/func_time.test 1.25 04/03/23 21:09:57 hf@deer.(none) +8 -0 test case mysql-test/r/func_time.result 1.28 04/03/23 21:09:57 hf@deer.(none) +8 -0 appropriate test result # 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: hf # Host: deer.(none) # Root: /home/hf/work/mysql-4.1.3264 --- 1.57/sql/item_timefunc.cc Thu Mar 18 17:14:33 2004 +++ 1.58/sql/item_timefunc.cc Tue Mar 23 21:09:57 2004 @@ -1114,6 +1114,7 @@ longlong value=args[0]->val_int(); if ((null_value=args[0]->null_value)) return 1; + bzero(ltime, sizeof(TIME)); get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day); ltime->time_type= TIMESTAMP_DATE; return 0; --- 1.27/mysql-test/r/func_time.result Mon Mar 15 18:27:45 2004 +++ 1.28/mysql-test/r/func_time.result Tue Mar 23 21:09:57 2004 @@ -555,3 +555,11 @@ 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03! ')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interv! al 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SE! COND)` +CREATE TABLE t1 (d DATETIME); +INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES (NOW()); +SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(NOW())) AND d<=FROM_DAYS(TO_DAYS(NOW())+1); +count(*) +3 +DROP TABLE t1; --- 1.24/mysql-test/t/func_time.test Mon Mar 15 18:27:45 2004 +++ 1.25/mysql-test/t/func_time.test Tue Mar 23 21:09:57 2004 @@ -272,3 +272,11 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0; explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND); + +CREATE TABLE t1 (d DATETIME); +INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES (NOW()); +SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(NOW())) AND d<=FROM_DAYS(TO_DAYS(NOW())+1); +DROP TABLE t1; +