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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c7fd7a3c
Commit
c7fd7a3c
authored
May 19, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0.b6961
parents
c09975eb
4630afa4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
32 deletions
+47
-32
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+6
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+7
-0
sql/item_func.cc
sql/item_func.cc
+34
-32
No files found.
mysql-test/r/type_newdecimal.result
View file @
c7fd7a3c
...
...
@@ -885,3 +885,9 @@ SELECT GRADE FROM t1 WHERE GRADE= 151;
GRADE
151
DROP TABLE t1;
select abs(10/0);
abs(10/0)
NULL
select abs(NULL);
abs(NULL)
NULL
mysql-test/t/type_newdecimal.test
View file @
c7fd7a3c
...
...
@@ -916,3 +916,10 @@ INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
SELECT
GRADE
FROM
t1
WHERE
GRADE
>
160
AND
GRADE
<
300
;
SELECT
GRADE
FROM
t1
WHERE
GRADE
=
151
;
DROP
TABLE
t1
;
#
# Bug #10599: problem with NULL
#
select
abs
(
10
/
0
);
select
abs
(
NULL
);
sql/item_func.cc
View file @
c7fd7a3c
...
...
@@ -1063,11 +1063,11 @@ my_decimal *Item_func_plus::decimal_op(my_decimal *decimal_value)
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
val2
=
args
[
1
]
->
val_decimal
(
&
value2
);
if
((
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_add
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_add
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
decimal_value
;
return
0
;
}
/*
...
...
@@ -1136,11 +1136,11 @@ my_decimal *Item_func_minus::decimal_op(my_decimal *decimal_value)
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
val2
=
args
[
1
]
->
val_decimal
(
&
value2
);
if
((
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_sub
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_sub
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
decimal_value
;
return
0
;
}
...
...
@@ -1174,11 +1174,11 @@ my_decimal *Item_func_mul::decimal_op(my_decimal *decimal_value)
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
val2
=
args
[
1
]
->
val_decimal
(
&
value2
);
if
((
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_mul
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
1
]
->
null_value
||
my_decimal_mul
(
E_DEC_FATAL_ERROR
,
decimal_value
,
val1
,
val2
)
>
1
)))
return
decimal_value
;
return
0
;
}
...
...
@@ -1396,8 +1396,9 @@ my_decimal *Item_func_neg::decimal_op(my_decimal *decimal_value)
{
my_decimal2decimal
(
value
,
decimal_value
);
my_decimal_neg
(
decimal_value
);
return
decimal_value
;
}
return
decimal_value
;
return
0
;
}
...
...
@@ -1460,8 +1461,9 @@ my_decimal *Item_func_abs::decimal_op(my_decimal *decimal_value)
my_decimal2decimal
(
value
,
decimal_value
);
if
(
decimal_value
->
sign
())
my_decimal_neg
(
decimal_value
);
return
decimal_value
;
}
return
decimal_value
;
return
0
;
}
...
...
@@ -1761,11 +1763,11 @@ double Item_func_ceiling::real_op()
my_decimal
*
Item_func_ceiling
::
decimal_op
(
my_decimal
*
decimal_value
)
{
my_decimal
val
,
*
value
=
args
[
0
]
->
val_decimal
(
&
val
);
if
((
null_value
=
(
args
[
0
]
->
null_value
||
my_decimal_ceiling
(
E_DEC_FATAL_ERROR
,
value
,
decimal_value
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
0
]
->
null_value
||
my_decimal_ceiling
(
E_DEC_FATAL_ERROR
,
value
,
decimal_value
)
>
1
)))
return
decimal_value
;
return
0
;
}
...
...
@@ -1808,11 +1810,11 @@ double Item_func_floor::real_op()
my_decimal
*
Item_func_floor
::
decimal_op
(
my_decimal
*
decimal_value
)
{
my_decimal
val
,
*
value
=
args
[
0
]
->
val_decimal
(
&
val
);
if
((
null_value
=
(
args
[
0
]
->
null_value
||
my_decimal_floor
(
E_DEC_FATAL_ERROR
,
value
,
decimal_value
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
0
]
->
null_value
||
my_decimal_floor
(
E_DEC_FATAL_ERROR
,
value
,
decimal_value
)
>
1
)))
return
decimal_value
;
return
0
;
}
...
...
@@ -1955,11 +1957,11 @@ my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
{
decimals
=
min
(
dec
,
DECIMAL_MAX_SCALE
);
// to get correct output
}
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
my_decimal_round
(
E_DEC_FATAL_ERROR
,
value
,
dec
,
truncate
,
decimal_value
)
>
1
)))
return
0
;
return
decimal_value
;
if
(
!
(
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
my_decimal_round
(
E_DEC_FATAL_ERROR
,
value
,
dec
,
truncate
,
decimal_value
)
>
1
)))
return
decimal_value
;
return
0
;
}
...
...
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