~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/dayofmonth.test

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Test improper argument list 
17
17
#
18
18
# 1 arg is required.
19
 
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION # Wrong parameter count...
 
19
--error 1582 # Wrong parameter count...
20
20
SELECT DAYOFMONTH();
21
 
--error ER_WRONG_PARAMCOUNT_TO_FUNCTION # Wrong parameter count...
 
21
--error 1582 # Wrong parameter count...
22
22
SELECT DAYOFMONTH(1, 0);
23
23
 
24
24
26
26
# produce an error, not a NULL or anything
27
27
# else...
28
28
#
29
 
--error ER_INVALID_DATETIME_VALUE
 
29
--error 1686
30
30
SELECT DAYOFMONTH("xxx");
31
31
 
32
32
# Indy, bad dates!
33
 
--error ER_INVALID_DATETIME_VALUE
 
33
--error 1686
34
34
SELECT DAYOFMONTH("0000-00-00"); # No 0000-00-00 dates!...
35
 
--error ER_INVALID_DATETIME_VALUE
 
35
--error 1686
36
36
SELECT DAYOFMONTH("0000-01-01"); # No zero year parts
37
 
--error ER_INVALID_DATETIME_VALUE
 
37
--error 1686
38
38
SELECT DAYOFMONTH("0001-00-01"); # No zero month parts
39
 
--error ER_INVALID_DATETIME_VALUE
 
39
--error 1686
40
40
SELECT DAYOFMONTH("0001-01-00"); # No zero day parts
41
 
--error ER_INVALID_DATETIME_VALUE
 
41
--error 1686
42
42
SELECT DAYOFMONTH("2000-02-30"); # No Feb 30th!
43
 
--error ER_INVALID_DATETIME_VALUE
 
43
--error 1686
44
44
SELECT DAYOFMONTH("1900-02-29"); # Not a leap DAYOFMONTH since not divisible evenly by 400...
45
 
--error ER_INVALID_DATETIME_VALUE
 
45
--error 1686
46
46
SELECT DAYOFMONTH('1976-15-15'); # No 15th month!
47
47
 
48
48
# A good date, which should output 1