~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/date_formats.result

  • Committer: Jay Pipes
  • Date: 2009-02-11 02:30:38 UTC
  • mto: (873.2.13 devel)
  • mto: This revision was merged to the branch mainline in revision 877.
  • Revision ID: jpipes@serialcoder-20090211023038-203wrshtyrufboko
Fixes the Field_date class to not allow any invalid input at
any time.  This, quite expectedly, broken about 20 test cases, so
this patches up those cases as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
14
457
457
14
458
458
drop table t1;
459
 
select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
460
 
a
461
 
2003-01-02 10:11:12.001200
462
 
create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
463
 
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
464
 
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
465
 
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
466
 
describe t1;
467
 
Field   Type    Null    Key     Default Extra
468
 
f1      datetime        YES             NULL    
469
 
f2      time    YES             NULL    
470
 
f3      date    YES             NULL    
471
 
f4      date    YES             NULL    
472
 
f5      time    YES             NULL    
473
 
select * from t1;
474
 
f1      f2      f3      f4      f5
475
 
2003-01-02 10:11:12     10:11:12        2003-01-02      0000-00-02      58:00:00
476
 
drop table t1;
477
 
create table t1 select "02 10" as a, "%d %H" as b;
478
 
select str_to_date(a,b) from t1;
479
 
str_to_date(a,b)
480
 
0000-00-02 10:00:00
481
 
create table t2 select str_to_date(a,b) from t1;
482
 
describe t2;
483
 
Field   Type    Null    Key     Default Extra
484
 
str_to_date(a,b)        datetime        YES             NULL    
485
 
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
486
 
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
487
 
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
488
 
str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
489
 
str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
490
 
str_to_date("02 10", "%d %f") as f6;
491
 
f1      f2      f3      f4      f5      f6
492
 
2003-01-02 10:11:12.001200      2003-01-02 10:11:12     2003-01-02      58:11:12        58:11:12        48:00:00.100000
493
 
Warnings:
494
 
Warning 1292    Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
495
 
drop table t1, t2;
496
 
select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
497
 
addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
498
 
microsecond("1997-12-31 23:59:59.01XXXX") as f3;
499
 
ERROR HY000: Received an invalid datetime value '1997-12-31 23:59:59.01XXXX'.
500
 
select str_to_date("2003-04-05  g", "%Y-%m-%d") as f1,
501
 
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
502
 
f1      f2
503
 
2003-04-05      2003-04-05 10:11:12.101010
504
 
Warnings:
505
 
Warning 1292    Truncated incorrect date value: '2003-04-05  g'
506
 
Warning 1292    Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
507
459
create table t1 (f1 datetime);
508
460
insert into t1 (f1) values ("2005-01-01");
509
461
insert into t1 (f1) values ("2005-02-01");