~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_sapdb.test

  • Committer: Patrick Galbraith
  • Date: 2008-07-24 16:57:40 UTC
  • mto: (202.2.4 rename-mysql-to-drizzle)
  • mto: This revision was merged to the branch mainline in revision 212.
  • Revision ID: patg@ishvara-20080724165740-x58yw6zs6d9o17lf
Most everything working with client rename
mysqlslap test still fails... can't connect to the server

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--disable_warnings
2
 
drop table if exists t1, test;
3
 
--enable_warnings
4
 
 
5
 
 
6
 
#
7
 
# time functions
8
 
#
9
 
select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
10
 
select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
11
 
select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
12
 
select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
13
 
select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
14
 
select date_format("1997-12-31 23:59:59.000002", "%f");
15
 
 
16
 
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
17
 
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
18
 
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
19
 
select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
20
 
select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
21
 
 
22
 
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
23
 
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
24
 
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
25
 
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
26
 
select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
27
 
 
28
 
#Date functions
29
 
select adddate("1997-12-31 23:59:59.000001", 10);
30
 
select subdate("1997-12-31 23:59:59.000001", 10);
31
 
 
32
 
select datediff("1997-12-31 23:59:59.000001","1997-12-30");
33
 
select datediff("1997-11-30 23:59:59.000001","1997-12-31");
34
 
 
35
 
# This will give a warning
36
 
select datediff("1997-11-31 23:59:59.000001","1997-12-31");
37
 
select datediff("1997-11-30 23:59:59.000001",null);
38
 
 
39
 
select weekofyear("1997-11-30 23:59:59.000001");
40
 
 
41
 
select makedate(03,1);
42
 
select makedate('0003',1);
43
 
select makedate(1997,1);
44
 
select makedate(1997,0);
45
 
select makedate(9999,365);
46
 
select makedate(9999,366);
47
 
select makedate(100,1);
48
 
 
49
 
#Time functions
50
 
 
51
 
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
52
 
select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
53
 
select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
54
 
select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
55
 
select subtime("01:00:00.999999", "02:00:00.999998");
56
 
select subtime("02:01:01.999999", "01:01:01.999999");
57
 
 
58
 
# PS doesn't support fractional seconds
59
 
--disable_ps_protocol
60
 
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
61
 
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
62
 
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
63
 
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
64
 
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
65
 
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
66
 
--enable_ps_protocol
67
 
 
68
 
select maketime(10,11,12);
69
 
select maketime(25,11,12);
70
 
select maketime(-25,11,12);
71
 
 
72
 
# Extraction functions
73
 
 
74
 
# PS doesn't support fractional seconds
75
 
--disable_ps_protocol
76
 
select timestamp("2001-12-01", "01:01:01.999999");
77
 
select timestamp("2001-13-01", "01:01:01.000001");
78
 
select timestamp("2001-12-01", "25:01:01");
79
 
select timestamp("2001-12-01 01:01:01.000100");
80
 
select timestamp("2001-12-01");
81
 
select day("1997-12-31 23:59:59.000001");
82
 
select date("1997-12-31 23:59:59.000001");
83
 
select date("1997-13-31 23:59:59.000001");
84
 
select time("1997-12-31 23:59:59.000001");
85
 
select time("1997-12-31 25:59:59.000001");
86
 
select microsecond("1997-12-31 23:59:59.000001");
87
 
--enable_ps_protocol
88
 
 
89
 
create table t1 
90
 
select makedate(1997,1) as f1,
91
 
   addtime(cast("1997-12-31 23:59:59.000001" as datetime), "1 1:1:1.000002") as f2,
92
 
   addtime(cast("23:59:59.999999" as time) , "1 1:1:1.000002") as f3,
93
 
   timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
94
 
   timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
95
 
   maketime(10,11,12) as f6,
96
 
   timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
97
 
   date("1997-12-31 23:59:59.000001") as f8,
98
 
   time("1997-12-31 23:59:59.000001") as f9;
99
 
describe t1;
100
 
# PS doesn't support fractional seconds
101
 
--disable_ps_protocol
102
 
select * from t1;
103
 
--enable_ps_protocol
104
 
 
105
 
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
106
 
insert into test values 
107
 
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
108
 
('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
109
 
('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
110
 
('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
111
 
('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'),
112
 
('2001-01-01 01:01:01', null, '-1 01:01:01', null),
113
 
(null, null, null, null),
114
 
('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
115
 
 
116
 
SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
117
 
# PS doesn't support fractional seconds
118
 
--disable_ps_protocol
119
 
SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq,
120
 
       TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test;
121
 
--enable_ps_protocol
122
 
 
123
 
drop table t1, test;
124
 
 
125
 
select addtime("-01:01:01.01", "-23:59:59.1") as a;
126
 
select microsecond("1997-12-31 23:59:59.01") as a;
127
 
select microsecond(19971231235959.01) as a;
128
 
select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
129
 
# PS doesn't support fractional seconds
130
 
--disable_ps_protocol
131
 
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
132
 
--enable_ps_protocol
133
 
 
134
 
# End of 4.1 tests