~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/cast.result

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
2
2
cast("A" as binary) = "a"       cast(BINARY "a" as CHAR) = "A"
3
 
0       0
 
3
0       1
4
4
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
5
5
cast("2001-1-1" as DATE)        cast("2001-1-1" as DATETIME)
6
6
2001-01-01      2001-01-01 00:00:00
 
7
select cast("1:2:3" as TIME);
 
8
cast("1:2:3" as TIME)
 
9
01:02:03
7
10
select CONVERT("2004-01-22 21:45:33",DATE);
8
11
CONVERT("2004-01-22 21:45:33",DATE)
9
12
2004-01-22
72
75
cast('a  ' AS char(2)) as c4,
73
76
cast('a'   AS char(2)) as c5;
74
77
ERROR 22007: Truncated incorrect CHAR(2) value: 'abc'
 
78
select
 
79
cast('��'  AS char)    as c1,
 
80
cast('� '  AS char)    as c2,
 
81
cast('���' AS char(2)) as c3,
 
82
cast('�  ' AS char(2)) as c4,
 
83
cast('�'   AS char(2)) as c5;
 
84
c1      c2      c3      c4      c5
 
85
��      �       ��      �       �
 
86
Warnings:
 
87
Warning 1292    Truncated incorrect CHAR(2) value: '���'
 
88
Warning 1292    Truncated incorrect CHAR(2) value: '�  '
75
89
select cast("2001-1-1" as date) = "2001-01-01";
76
90
cast("2001-1-1" as date) = "2001-01-01"
77
91
1
78
92
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
79
93
cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
80
94
1
 
95
select cast("1:2:3" as TIME) = "1:02:03";
 
96
cast("1:2:3" as TIME) = "1:02:03"
 
97
0
81
98
select cast(NULL as DATE);
82
99
cast(NULL as DATE)
83
100
NULL
108
125
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
109
126
date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
110
127
2004-12-30 00:00:00
 
128
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
 
129
timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
 
130
00:00:00
 
131
select timediff(cast('1 12:00:00' as time), '12:00:00');
 
132
timediff(cast('1 12:00:00' as time), '12:00:00')
 
133
24:00:00
111
134
select isnull(date(NULL)), isnull(cast(NULL as DATE));
112
135
isnull(date(NULL))      isnull(cast(NULL as DATE))
113
136
1       1
124
147
select cast(-1e18 as decimal(22,2));
125
148
cast(-1e18 as decimal(22,2))
126
149
-1000000000000000000.00
 
150
create table t1(s1 time);
 
151
insert into t1 values ('11:11:11');
 
152
select cast(s1 as decimal(7,2)) from t1;
 
153
cast(s1 as decimal(7,2))
 
154
99999.99
 
155
Warnings:
 
156
Error   1264    Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
 
157
drop table t1;
127
158
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
128
159
mt mediumtext, lt longtext);
129
160
INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
135
166
select cast(NULL as decimal(6)) as t1;
136
167
t1
137
168
NULL
 
169
select hex(cast('a' as char(2) binary));
 
170
hex(cast('a' as char(2) binary))
 
171
61
138
172
select hex(cast('a' as binary(2)));
139
173
hex(cast('a' as binary(2)))
140
174
6100
 
175
select hex(cast('a' as char(2) binary));
 
176
hex(cast('a' as char(2) binary))
 
177
6100
141
178
CREATE TABLE t1 (f1 DATE);
142
179
INSERT INTO t1 VALUES ('2007-07-19'), (NULL);
143
180
SELECT HOUR(f1),