Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
785fca11
Commit
785fca11
authored
Jun 13, 2005
by
igor@igor-inspiron.creware.com
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge
parents
df93c278
754e6c05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
16 deletions
+24
-16
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+13
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+10
-13
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-3
No files found.
mysql-test/r/func_if.result
View file @
785fca11
...
...
@@ -108,3 +108,16 @@ id date_ord text
2 16-03-2005 Day 2
1 05-03-2005 Day 1
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
SELECT a, NULLIF(a,'') FROM t1;
a NULLIF(a,'')
aaa aaa
NULL NULL
NULL
bbb bbb
SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
a NULLIF(a,'')
NULL NULL
NULL
DROP TABLE t1;
mysql-test/t/func_if.test
View file @
785fca11
...
...
@@ -25,10 +25,9 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
#
# NULLIF test
#
select
nullif
(
u
,
1
)
from
t1
;
explain
extended
select
nullif
(
u
,
1
)
from
t1
;
select
nullif
(
u
=
0
,
'test'
)
from
t1
;
explain
extended
select
nullif
(
u
=
0
,
'test'
)
from
t1
;
drop
table
t1
;
select
nullif
(
1
,
'test'
);
#
# Bug 2629
...
...
@@ -63,15 +62,13 @@ drop table t1;
SELECT
NULLIF
(
5
,
5
)
IS
NULL
,
NULLIF
(
5
,
5
)
IS
NOT
NULL
;
#
#
Bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
#
Test for bug #11142: evaluation of NULLIF when the first argument is NULL
#
CREATE
TABLE
`t1`
(
`id`
int
(
11
)
NOT
NULL
,
`date`
int
(
10
)
default
NULL
,
`text`
varchar
(
32
)
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
1
,
1110000000
,
'Day 1'
),(
2
,
1111000000
,
'Day 2'
),(
3
,
1112000000
,
'Day 3'
);
SELECT
id
,
IF
(
date
IS
NULL
,
'-'
,
FROM_UNIXTIME
(
date
,
'%d-%m-%Y'
))
AS
date_ord
,
text
FROM
t1
ORDER
BY
date_ord
ASC
;
SELECT
id
,
IF
(
date
IS
NULL
,
'-'
,
FROM_UNIXTIME
(
date
,
'%d-%m-%Y'
))
AS
date_ord
,
text
FROM
t1
ORDER
BY
date_ord
DESC
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
CHAR
(
10
));
INSERT
INTO
t1
VALUES
(
'aaa'
),
(
NULL
),
(
''
),
(
'bbb'
);
SELECT
a
,
NULLIF
(
a
,
''
)
FROM
t1
;
SELECT
a
,
NULLIF
(
a
,
''
)
FROM
t1
WHERE
NULLIF
(
a
,
''
)
IS
NULL
;
DROP
TABLE
t1
;
sql/item_cmpfunc.cc
View file @
785fca11
...
...
@@ -1406,9 +1406,7 @@ Item_func_nullif::val_decimal(my_decimal * decimal_value)
bool
Item_func_nullif
::
is_null
()
{
if
(
!
cmp
.
compare
())
return
(
null_value
=
1
);
return
0
;
return
(
null_value
=
(
!
cmp
.
compare
()
?
1
:
args
[
0
]
->
null_value
));
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment