~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
SELECT DAYOFMONTH(NULL);
DAYOFMONTH(NULL)
NULL
SELECT DAYOFMONTH();
ERROR 42000: Incorrect parameter count in the call to native function 'DAYOFMONTH'
SELECT DAYOFMONTH(1, 0);
ERROR 42000: Incorrect parameter count in the call to native function 'DAYOFMONTH'
SELECT DAYOFMONTH("xxx");
ERROR HY000: Received an invalid datetime value 'xxx'.
SELECT DAYOFMONTH("0000-00-00");
ERROR HY000: Received an invalid datetime value '0000-00-00'.
SELECT DAYOFMONTH("0000-01-01");
ERROR HY000: Received an invalid datetime value '0000-01-01'.
SELECT DAYOFMONTH("0001-00-01");
ERROR HY000: Received an invalid datetime value '0001-00-01'.
SELECT DAYOFMONTH("0001-01-00");
ERROR HY000: Received an invalid datetime value '0001-01-00'.
SELECT DAYOFMONTH("2000-02-30");
ERROR HY000: Received an invalid datetime value '2000-02-30'.
SELECT DAYOFMONTH("1900-02-29");
ERROR HY000: Received an invalid datetime value '1900-02-29'.
SELECT DAYOFMONTH('1976-15-15');
ERROR HY000: Received an invalid datetime value '1976-15-15'.
SELECT DAYOFMONTH("2009-01-12");
DAYOFMONTH("2009-01-12")
12
SELECT DAYOFMONTH("70-12-31");
DAYOFMONTH("70-12-31")
31
SELECT DAYOFMONTH("00-02-29");
DAYOFMONTH("00-02-29")
29
SELECT DAYOFMONTH("0001-12-31");
DAYOFMONTH("0001-12-31")
31
SELECT DAYOFMONTH('07/31/2009');
DAYOFMONTH('07/31/2009')
31
SELECT DAYOFMONTH('20090916');
DAYOFMONTH('20090916')
16
SELECT DAYOFMONTH('20090916091528');
DAYOFMONTH('20090916091528')
16
SELECT DAYOFMONTH("20090916091528.000000");
DAYOFMONTH("20090916091528.000000")
16
SELECT DAYOFMONTH('09-09-16');
DAYOFMONTH('09-09-16')
16
SELECT DAYOFMONTH('09.09.16');
DAYOFMONTH('09.09.16')
16
SELECT DAYOFMONTH('09/09/16');
DAYOFMONTH('09/09/16')
16
SELECT DAYOFMONTH('09-09-16');
DAYOFMONTH('09-09-16')
16
SELECT DAYOFMONTH('09-9-2');
DAYOFMONTH('09-9-2')
2
SELECT DAYOFMONTH(20090916);
DAYOFMONTH(20090916)
16
SELECT DAYOFMONTH(20090916091528);
DAYOFMONTH(20090916091528)
16
SELECT DAYOFMONTH(20090916091528.000001);
DAYOFMONTH(20090916091528.000001)
16
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
int_fld INT NOT NULL
, date_fld DATE NOT NULL
, datetime_fld DATETIME NOT NULL
, timestamp_fld TIMESTAMP NOT NULL
, char_fld CHAR(22) NOT NULL
, varchar_fld VARCHAR(22) NOT NULL
, text_fld TEXT NOT NULL
, blob_fld BLOB NOT NULL
);
INSERT INTO t1 VALUES (
20071130
, "2007-11-30"
, "2007-11-30 16:30:19"
, "2007-11-30T16:30:19"
, "2007-11-30 16:30:19"
, "2007-11-30 16:30:19"
, "2007-11-30T16:30:19"
, "2007-11-30T16:30:19"
);
SELECT DAYOFMONTH(int_fld) FROM t1;
DAYOFMONTH(int_fld)
30
SELECT DAYOFMONTH(date_fld) FROM t1;
DAYOFMONTH(date_fld)
30
SELECT DAYOFMONTH(datetime_fld) FROM t1;
DAYOFMONTH(datetime_fld)
30
SELECT DAYOFMONTH(timestamp_fld) FROM t1;
DAYOFMONTH(timestamp_fld)
30
SELECT DAYOFMONTH(char_fld) FROM t1;
DAYOFMONTH(char_fld)
30
SELECT DAYOFMONTH(varchar_fld) FROM t1;
DAYOFMONTH(varchar_fld)
30
SELECT DAYOFMONTH(text_fld) FROM t1;
DAYOFMONTH(text_fld)
30
SELECT DAYOFMONTH(blob_fld) FROM t1;
DAYOFMONTH(blob_fld)
30
DROP TABLE t1;