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
a80d185e
Commit
a80d185e
authored
Aug 09, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A change in IF behaviour that several users asked for ...
parent
edf3929c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
Docs/manual.texi
Docs/manual.texi
+8
-0
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+2
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+4
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+6
-0
No files found.
Docs/manual.texi
View file @
a80d185e
...
@@ -46924,6 +46924,14 @@ not yet 100% confident in this code.
...
@@ -46924,6 +46924,14 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0
* News-3.23.0:: Changes in release 3.23.0
@end menu
@end menu
@node News-3.23.53, News-3.23.52, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
Changed behaviour that IF(condition,column,NULL) returns column type
@end itemize
@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.52
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
@itemize @bullet
mysql-test/r/func_if.result
View file @
a80d185e
...
@@ -33,3 +33,5 @@ aa
...
@@ -33,3 +33,5 @@ aa
aaa
aaa
sum(if(num is null,0.00,num))
sum(if(num is null,0.00,num))
144.54
144.54
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
6 56
mysql-test/t/func_if.test
View file @
a80d185e
...
@@ -28,3 +28,7 @@ create table t1 (num double(12,2));
...
@@ -28,3 +28,7 @@ create table t1 (num double(12,2));
insert
into
t1
values
(
144.54
);
insert
into
t1
values
(
144.54
);
select
sum
(
if
(
num
is
null
,
0.00
,
num
))
from
t1
;
select
sum
(
if
(
num
is
null
,
0.00
,
num
))
from
t1
;
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
x
int
,
y
int
);
insert
into
t1
values
(
0
,
6
),(
10
,
16
),(
20
,
26
),(
30
,
10
),(
40
,
46
),(
50
,
56
);
select
min
(
if
(
y
-
x
>
5
,
y
,
NULL
)),
max
(
if
(
y
-
x
>
5
,
y
,
NULL
))
from
t1
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
a80d185e
...
@@ -494,6 +494,12 @@ Item_func_if::fix_length_and_dec()
...
@@ -494,6 +494,12 @@ Item_func_if::fix_length_and_dec()
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
bool
null1
=
args
[
1
]
->
null_value
;
bool
null2
=
args
[
2
]
->
null_value
;
if
(
null1
&&
!
null2
)
arg1_type
=
arg2_type
;
else
if
(
!
null1
&&
null2
)
arg2_type
=
arg1_type
;
binary
=
1
;
binary
=
1
;
if
(
arg1_type
==
STRING_RESULT
||
arg2_type
==
STRING_RESULT
)
if
(
arg1_type
==
STRING_RESULT
||
arg2_type
==
STRING_RESULT
)
{
{
...
...
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