~drizzle-trunk/drizzle/development

813.1.16 by Jay Pipes
Fixes MINUTE() to use new Temporal system and throw appropriate errors on bad datetimes. Adds new minute.test case.
1
SELECT MINUTE(NULL);
2
MINUTE(NULL)
3
NULL
4
SELECT MINUTE();
5
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ')' at line 1
6
SELECT MINUTE(1, 0);
7
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ' 0)' at line 1
8
SELECT MINUTE("xxx");
9
ERROR HY000: Received an invalid datetime value 'xxx'.
10
SELECT MINUTE("0000-00-00");
11
ERROR HY000: Received an invalid datetime value '0000-00-00'.
12
SELECT MINUTE("0000-01-01");
13
ERROR HY000: Received an invalid datetime value '0000-01-01'.
14
SELECT MINUTE("0001-00-01");
15
ERROR HY000: Received an invalid datetime value '0001-00-01'.
16
SELECT MINUTE("0001-01-00");
17
ERROR HY000: Received an invalid datetime value '0001-01-00'.
18
SELECT MINUTE("2000-02-30");
19
ERROR HY000: Received an invalid datetime value '2000-02-30'.
20
SELECT MINUTE("1900-02-29");
21
ERROR HY000: Received an invalid datetime value '1900-02-29'.
22
SELECT MINUTE('1976-15-15');
23
ERROR HY000: Received an invalid datetime value '1976-15-15'.
24
SELECT MINUTE('23:59:70');
25
ERROR HY000: Received an invalid datetime value '23:59:70'.
26
SELECT MINUTE('23:70:59');
27
ERROR HY000: Received an invalid datetime value '23:70:59'.
28
SELECT MINUTE('26:00:00');
29
ERROR HY000: Received an invalid datetime value '26:00:00'.
30
SELECT MINUTE("2009-01-12");
31
MINUTE("2009-01-12")
32
0
33
SELECT MINUTE("70-12-31");
34
MINUTE("70-12-31")
35
0
36
SELECT MINUTE('07/31/2009');
37
MINUTE('07/31/2009')
38
0
39
SELECT MINUTE("2008-11-30 03:30:15");
40
MINUTE("2008-11-30 03:30:15")
41
30
42
SELECT MINUTE("2008-11-30T03:30:15");
43
MINUTE("2008-11-30T03:30:15")
44
30
45
SELECT MINUTE("20081130033015");
46
MINUTE("20081130033015")
47
30
48
SELECT MINUTE(20081130033015);
49
MINUTE(20081130033015)
50
30
813.1.19 by Jay Pipes
To remain in compatibility with MySQL, added ability to interpret
51
SELECT MINUTE(20081130033015.01);
52
MINUTE(20081130033015.01)
53
30
813.1.16 by Jay Pipes
Fixes MINUTE() to use new Temporal system and throw appropriate errors on bad datetimes. Adds new minute.test case.
54
SELECT MINUTE(231115);
55
MINUTE(231115)
56
11
57
SELECT MINUTE("231115");
58
MINUTE("231115")
59
11
60
SELECT MINUTE("23:59:59");
61
MINUTE("23:59:59")
62
59
63
USE test;
64
DROP TABLE IF EXISTS t1;
65
CREATE TABLE t1 (
66
int_fld INT NOT NULL
67
, date_fld DATE NOT NULL
68
, datetime_fld DATETIME NOT NULL
69
, timestamp_fld TIMESTAMP NOT NULL
70
, char_fld CHAR(22) NOT NULL
71
, varchar_fld VARCHAR(22) NOT NULL
72
, text_fld TEXT NOT NULL
73
, blob_fld BLOB NOT NULL
74
);
75
INSERT INTO t1 VALUES (
76
20071130
77
, "2007-11-30"
78
, "2007-11-30 16:30:19"
79
, "2007-11-30T16:30:19"
80
, "2007-11-30 16:30:19"
81
, "2007-11-30 16:30:19"
82
, "2007-11-30T16:30:19"
83
, "2007-11-30T16:30:19"
84
);
85
SELECT MINUTE(int_fld) FROM t1;
86
MINUTE(int_fld)
87
0
88
SELECT MINUTE(date_fld) FROM t1;
89
MINUTE(date_fld)
90
0
91
SELECT MINUTE(datetime_fld) FROM t1;
92
MINUTE(datetime_fld)
93
30
94
SELECT MINUTE(timestamp_fld) FROM t1;
95
MINUTE(timestamp_fld)
96
30
97
SELECT MINUTE(char_fld) FROM t1;
98
MINUTE(char_fld)
99
30
100
SELECT MINUTE(varchar_fld) FROM t1;
101
MINUTE(varchar_fld)
102
30
103
SELECT MINUTE(text_fld) FROM t1;
104
MINUTE(text_fld)
105
30
106
SELECT MINUTE(blob_fld) FROM t1;
107
MINUTE(blob_fld)
108
30
109
DROP TABLE t1;