~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/user_var.result

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:38:21 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130043821-4d7jg2ftabefamxb
Fixes for the QUARTER() function to use new Temporal system and throw
errors on bad datetime values.

Added test case for QUARTER() function and modified func_time.test existing
test to correctly throw errors and report NULL, not 0 on NULL input.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
hello again     hello   hello again     3       hello again     hello again
136
136
hello again     hello   hello again     3       hello again     hello again
137
137
drop table t1;
138
 
set @a=_latin2'test';
139
 
select charset(@a),collation(@a),coercibility(@a);
140
 
charset(@a)     collation(@a)   coercibility(@a)
141
 
latin2  latin2_general_ci       2
142
 
select @a=_latin2'TEST';
143
 
@a=_latin2'TEST'
144
 
1
145
 
select @a=_latin2'TEST' collate latin2_bin;
146
 
@a=_latin2'TEST' collate latin2_bin
147
 
0
148
 
set @a=_latin2'test' collate latin2_general_ci;
149
 
select charset(@a),collation(@a),coercibility(@a);
150
 
charset(@a)     collation(@a)   coercibility(@a)
151
 
latin2  latin2_general_ci       2
152
 
select @a=_latin2'TEST';
153
 
@a=_latin2'TEST'
154
 
1
155
 
select @a=_latin2'TEST' collate latin2_bin;
156
 
@a=_latin2'TEST' collate latin2_bin
157
 
0
158
 
select charset(@a:=_latin2'test');
159
 
charset(@a:=_latin2'test')
160
 
latin2
161
 
select collation(@a:=_latin2'test');
162
 
collation(@a:=_latin2'test')
163
 
latin2_general_ci
164
 
select coercibility(@a:=_latin2'test');
165
 
coercibility(@a:=_latin2'test')
166
 
2
167
 
select collation(@a:=_latin2'test' collate latin2_bin);
168
 
collation(@a:=_latin2'test' collate latin2_bin)
169
 
latin2_bin
170
 
select coercibility(@a:=_latin2'test' collate latin2_bin);
171
 
coercibility(@a:=_latin2'test' collate latin2_bin)
172
 
2
173
 
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
174
 
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
175
 
0
176
 
select charset(@a),collation(@a),coercibility(@a);
177
 
charset(@a)     collation(@a)   coercibility(@a)
178
 
latin2  latin2_bin      2
179
 
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
180
 
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci
 
138
set @a='test';
 
139
select collation(@a),coercibility(@a);
 
140
collation(@a)   coercibility(@a)
 
141
utf8_general_ci 2
 
142
select @a='TEST';
 
143
@a='TEST'
 
144
1
 
145
select @a='TEST' collate utf8_bin;
 
146
@a='TEST' collate utf8_bin
 
147
0
 
148
set @a='test' collate utf8_general_ci;
 
149
select collation(@a),coercibility(@a);
 
150
collation(@a)   coercibility(@a)
 
151
utf8_general_ci 2
 
152
select @a='TEST';
 
153
@a='TEST'
 
154
1
 
155
select @a='TEST' collate utf8_bin;
 
156
@a='TEST' collate utf8_bin
 
157
0
 
158
select collation(@a:='test');
 
159
collation(@a:='test')
 
160
utf8_general_ci
 
161
select coercibility(@a:='test');
 
162
coercibility(@a:='test')
 
163
2
 
164
select collation(@a:='test' collate utf8_bin);
 
165
collation(@a:='test' collate utf8_bin)
 
166
utf8_bin
 
167
select coercibility(@a:='test' collate utf8_bin);
 
168
coercibility(@a:='test' collate utf8_bin)
 
169
2
 
170
select (@a:='test' collate utf8_bin) = 'TEST';
 
171
(@a:='test' collate utf8_bin) = 'TEST'
 
172
0
 
173
select collation(@a),coercibility(@a);
 
174
collation(@a)   coercibility(@a)
 
175
utf8_bin        2
 
176
select (@a:='test' collate utf8_bin) = 'TEST' collate utf8_general_ci;
 
177
(@a:='test' collate utf8_bin) = 'TEST' collate utf8_general_ci
181
178
1
182
179
set @var= NULL ;
183
180
select FIELD( @var,'1it','Hit') as my_column;
191
188
coercibility(@v1)       coercibility(@v2)       coercibility(@v3)       coercibility(@v4)
192
189
2       2       2       2
193
190
set session @honk=99;
194
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@honk=99' at line 1
195
 
set one_shot @honk=99;
196
 
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
 
191
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 '@honk=99' at line 1
197
192
select @@local.max_allowed_packet;
198
193
@@local.max_allowed_packet
199
194
#
221
216
show create table t1;
222
217
Table   Create Table
223
218
t1      CREATE TABLE `t1` (
224
 
  `@first_var` longblob
225
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
226
 
drop table t1;
227
 
set @first_var= cast(NULL as signed integer);
228
 
create table t1 select @first_var;
229
 
show create table t1;
230
 
Table   Create Table
231
 
t1      CREATE TABLE `t1` (
232
 
  `@first_var` bigint(20) DEFAULT NULL
233
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
234
 
drop table t1;
 
219
  `@first_var` blob
 
220
) ENGINE=InnoDB
 
221
drop table t1;
 
222
set @first_var= cast(NULL as integer);
 
223
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 'integer)' at line 1
235
224
set @first_var= NULL;
236
225
create table t1 select @first_var;
237
226
show create table t1;
238
227
Table   Create Table
239
228
t1      CREATE TABLE `t1` (
240
 
  `@first_var` bigint(20) DEFAULT NULL
241
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
229
  `@first_var` blob
 
230
) ENGINE=InnoDB
242
231
drop table t1;
243
232
set @first_var= concat(NULL);
244
233
create table t1 select @first_var;
245
234
show create table t1;
246
235
Table   Create Table
247
236
t1      CREATE TABLE `t1` (
248
 
  `@first_var` longblob
249
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
237
  `@first_var` blob
 
238
) ENGINE=InnoDB
250
239
drop table t1;
251
240
set @first_var=1;
252
241
set @first_var= cast(NULL as CHAR);
254
243
show create table t1;
255
244
Table   Create Table
256
245
t1      CREATE TABLE `t1` (
257
 
  `@first_var` longtext
258
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
246
  `@first_var` text
 
247
) ENGINE=InnoDB
259
248
drop table t1;
260
249
set @a=18446744071710965857;
261
250
select @a;
262
251
@a
263
252
18446744071710965857
264
253
CREATE TABLE `bigfailure` (
265
 
`afield` BIGINT UNSIGNED NOT NULL
 
254
`afield` BIGINT NOT NULL
266
255
);
267
256
INSERT INTO `bigfailure` VALUES (18446744071710965857);
268
257
SELECT * FROM bigfailure;
269
258
afield
270
 
18446744071710965857
 
259
-1998585759
271
260
select * from (SELECT afield FROM bigfailure) as b;
272
261
afield
273
 
18446744071710965857
 
262
-1998585759
274
263
select * from bigfailure where afield = (SELECT afield FROM bigfailure);
275
264
afield
276
 
18446744071710965857
 
265
-1998585759
277
266
select * from bigfailure where afield = 18446744071710965857;
278
267
afield
279
 
18446744071710965857
 
268
-1998585759
 
269
select * from bigfailure where afield = '18446744071710965857';
 
270
afield
280
271
select * from bigfailure where afield = 18446744071710965856+1;
281
272
afield
282
 
18446744071710965857
 
273
-1998585759
283
274
SET @a := (SELECT afield FROM bigfailure);
284
275
SELECT @a;
285
276
@a
286
 
18446744071710965857
 
277
-1998585759
287
278
SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
288
279
SELECT @a;
289
280
@a
290
 
18446744071710965857
 
281
-1998585759
291
282
SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
292
283
SELECT @a;
293
284
@a
294
 
18446744071710965857
 
285
-1998585759
295
286
drop table bigfailure;
296
287
create table t1(f1 int, f2 int);
297
288
insert into t1 values (1,2),(2,3),(3,1);
298
289
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
299
 
@var:=f2
300
 
3
301
 
select @var;
302
 
@var
303
 
3
304
 
create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
305
 
select * from t2;
306
 
@var:=f2
307
 
3
308
 
select @var;
309
 
@var
310
 
3
311
 
drop table t1,t2;
 
290
@var:=f2 
 
291
3
 
292
select @var;
 
293
@var
 
294
3
 
295
drop table t1;
312
296
insert into city 'blah';
313
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''blah'' at line 1
 
297
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 ''blah'' at line 1
314
298
SHOW COUNT(*) WARNINGS;
315
299
@@session.warning_count
316
300
1