~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_time.result

  • Committer: Jay Pipes
  • Date: 2009-01-28 02:39:29 UTC
  • mto: This revision was merged to the branch mainline in revision 815.
  • Revision ID: jpipes@serialcoder-20090128023929-gy7mot4ki11taytg
First function cleanup for temporal handling: YEAR()

* Added source files for calendrical calculations:
 drizzled/calendar.h
 drizzled/calendar.cc
* Added source files for new Temporal classes
 drizzled/temporal.h
 drizzled/temporal.cc
 drizzled/temporal_format.h
 drizzled/temporal_format.cc

Modified drizzled/function/time/year.cc to use the new
Temporal classes instead of the DRIZZLE_TIME struct and 
get_date().

Added new error codes for invalid DATETIME values and ensured
bad datetimes throw errors in calls to YEAR().

Added new test case specifically for the YEAR() function

Modified existing func_time and type_date test cases to expect
errors when calling YEAR() with bad datetimes.

Edited Makefile.am in drizzled/ to ensure libpcre is used during
build and that calendar.cc, temporal.cc and temporal_format.cc are
built.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
43
43
month("1997-01-02")     year("98-02-03")        dayofyear("1997-12-31")
44
44
1       1998    365
45
 
select month("2001-02-00"),year("2001-00-00");
46
 
month("2001-02-00")     year("2001-00-00")
 
45
select month("2001-02-00"),year("2001-01-01");
 
46
month("2001-02-00")     year("2001-01-01")
47
47
2       2001
48
48
select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
49
49
DAYOFYEAR("1997-03-03") WEEK("1998-03-03")      QUARTER(980303)
450
450
Warnings:
451
451
Warning 1292    Incorrect datetime value: ''
452
452
SELECT year(updated) from t1;
453
 
year(updated)
454
 
NULL
455
 
Warnings:
456
 
Warning 1292    Incorrect datetime value: ''
 
453
ERROR HY000: Received an invalid datetime value ''.
457
454
drop table t1;
458
455
create table t1 (d date, dt datetime, t timestamp, c char(10));
459
456
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
479
476
Warning 1292    Incorrect datetime value: '0000-00-00'
480
477
Warning 1292    Incorrect datetime value: '0000-00-00'
481
478
select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
482
 
year("0000-00-00")      year(d) year(dt)        year(t) year(c)
483
 
0       0       0       0       0
 
479
ERROR HY000: Received an invalid datetime value '0000-00-00'.
484
480
select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) from t1;
485
481
yearweek("0000-00-00")  yearweek(d)     yearweek(dt)    yearweek(t)     yearweek(c)
486
482
NULL    NULL    NULL    NULL    NULL