~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_if.result

  • Committer: Brian Aker
  • Date: 2008-10-13 20:24:22 UTC
  • Revision ID: brian@tangent.org-20081013202422-hjbv31zsnov5arq4
Adding back more test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1;
2
 
select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 ;
3
 
IF(0,"ERROR","this")    IF(1,"is","ERROR")      IF(NULL,"ERROR","a")    IF(1,2,3)|0     IF(1,2.0,3.0)+0
4
 
this    is      a       2       2.0
5
 
CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) ENGINE=MyISAM;
 
2
select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2.0,3.0)+0 ;
 
3
IF(0,"ERROR","this")    IF(1,"is","ERROR")      IF(NULL,"ERROR","a")    IF(1,2.0,3.0)+0
 
4
this    is      a       2.0
 
5
CREATE TABLE t1 (st varchar(255) NOT NULL, u int NOT NULL) ENGINE=MyISAM;
6
6
INSERT INTO t1 VALUES ('a',1),('A',1),('aa',1),('AA',1),('a',1),('aaa',0),('BBB',0);
7
7
select if(1,st,st) s from t1 order by s;
8
8
s
43
43
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
44
44
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    7       100.00  Using where; Using filesort
45
45
Warnings:
46
 
Note    1003    select if(("test"."t1"."u" = 1),"test"."t1"."st",cast("test"."t1"."st" as char charset binary)) AS "s" from "test"."t1" where ("test"."t1"."st" like '%a%') order by if(("test"."t1"."u" = 1),"test"."t1"."st",cast("test"."t1"."st" as char charset binary))
 
46
Note    1003    select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like '%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
47
47
select nullif(u, 1) from t1;
48
48
nullif(u, 1)
49
49
NULL
57
57
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
58
58
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    7       100.00  
59
59
Warnings:
60
 
Note    1003    select nullif("test"."t1"."u",1) AS "nullif(u, 1)" from "test"."t1"
 
60
Note    1003    select nullif(`test`.`t1`.`u`,1) AS `nullif(u, 1)` from `test`.`t1`
61
61
drop table t1;
62
62
select nullif(1,'test');
63
63
nullif(1,'test')
92
92
NULLIF(5,5) IS NULL     NULLIF(5,5) IS NOT NULL
93
93
1       0
94
94
CREATE TABLE `t1` (
95
 
`id` int(11) NOT NULL ,
96
 
`date` int(10) default NULL,
 
95
`id` int NOT NULL ,
 
96
`date` int default NULL,
97
97
`text` varchar(32) NOT NULL
98
98
);
99
99
INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');