~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_time.test

merge latest dev work

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
#
215
215
select @a:=FROM_UNIXTIME(1);
216
216
select unix_timestamp(@a);
217
 
select unix_timestamp('1970-01-01 00:00:01');
 
217
select unix_timestamp('1969-12-01 19:00:01');
218
218
 
219
219
#
220
220
# Tests for bug #6439 "unix_timestamp() function returns wrong datetime 
243
243
# check for invalid dates
244
244
 
245
245
# bad year
246
 
--error 1685 # Bad timestamp
247
246
select unix_timestamp('2039-01-20 01:00:00');
248
 
--error 1685 # Bad timestamp
249
247
select unix_timestamp('1968-01-20 01:00:00');
250
248
# bad month
251
 
--error 1685 # Bad timestamp
252
249
select unix_timestamp('2038-02-10 01:00:00');
253
 
--error 1685 # Bad timestamp
254
250
select unix_timestamp('1969-11-20 01:00:00');
255
251
# bad day
256
 
--error 1685 # Bad timestamp
257
252
select unix_timestamp('2038-01-20 01:00:00');
258
 
--error 1685 # Bad timestamp
259
253
select unix_timestamp('1969-12-30 01:00:00');
260
254
 
261
255
#
263
257
# conversion).
264
258
select unix_timestamp('2038-01-17 12:00:00');
265
259
 
 
260
#
 
261
# Check positive shift. (it happens only on
 
262
# platfroms with time_t, such as QNX)
 
263
#
 
264
select unix_timestamp('1970-01-01 03:00:01');
 
265
 
266
266
# check bad date, close to the boundary (we cut them off in the very end)
267
 
select unix_timestamp('2038-01-19 03:14:07');
 
267
select unix_timestamp('2038-01-19 07:14:07');
268
268
 
269
269
 
270
270
#
381
381
# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
382
382
# TZ variable set to GMT-3
383
383
 
384
 
select strcmp(date_sub(localtimestamp(), interval 0 hour), utc_timestamp())=0;
385
 
select strcmp(date_format(date_sub(localtimestamp(), interval 0 hour),"%Y-%m-%d"), utc_date())=0;
 
384
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
 
385
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
386
386
select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
387
387
 
388
388
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);