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
56da64ce
Commit
56da64ce
authored
Jul 12, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bkroot/mysql-5.0
into mysql.com:/home/bk/mysql-5.0
parents
aa0b07a9
8115f6df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
8 deletions
+47
-8
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+23
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+17
-0
strings/decimal.c
strings/decimal.c
+7
-8
No files found.
mysql-test/r/type_newdecimal.result
View file @
56da64ce
...
...
@@ -955,3 +955,26 @@ t1 CREATE TABLE `t1` (
`sl` decimal(5,5) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
f1 decimal unsigned not null default 17.49,
f2 decimal unsigned not null default 17.68,
f3 decimal unsigned not null default 99.2,
f4 decimal unsigned not null default 99.7,
f5 decimal unsigned not null default 104.49,
f6 decimal unsigned not null default 199.91,
f7 decimal unsigned not null default 999.9,
f8 decimal unsigned not null default 9999.99);
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
Note 1265 Data truncated for column 'f2' at row 1
Note 1265 Data truncated for column 'f3' at row 1
Note 1265 Data truncated for column 'f4' at row 1
Note 1265 Data truncated for column 'f5' at row 1
Note 1265 Data truncated for column 'f6' at row 1
Note 1265 Data truncated for column 'f7' at row 1
Note 1265 Data truncated for column 'f8' at row 1
insert into t1 (f1) values (1);
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8
1 18 99 100 104 200 1000 10000
drop table t1;
mysql-test/t/type_newdecimal.test
View file @
56da64ce
...
...
@@ -998,3 +998,20 @@ create table t1 (sl decimal(0,30));
create
table
t1
(
sl
decimal
(
5
,
5
));
show
create
table
t1
;
drop
table
t1
;
#
# Bug 11557 (DEFAULT values rounded improperly
#
create
table
t1
(
f1
decimal
unsigned
not
null
default
17.49
,
f2
decimal
unsigned
not
null
default
17.68
,
f3
decimal
unsigned
not
null
default
99.2
,
f4
decimal
unsigned
not
null
default
99.7
,
f5
decimal
unsigned
not
null
default
104.49
,
f6
decimal
unsigned
not
null
default
199.91
,
f7
decimal
unsigned
not
null
default
999.9
,
f8
decimal
unsigned
not
null
default
9999.99
);
insert
into
t1
(
f1
)
values
(
1
);
select
*
from
t1
;
drop
table
t1
;
strings/decimal.c
View file @
56da64ce
...
...
@@ -1443,6 +1443,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
intg1
=
ROUND_UP
(
from
->
intg
+
(((
intg0
+
frac0
)
>
0
)
&&
(
from
->
buf
[
0
]
==
DIG_MAX
)));
dec1
*
buf0
=
from
->
buf
,
*
buf1
=
to
->
buf
,
x
,
y
,
carry
=
0
;
int
first_dig
;
sanity
(
to
);
...
...
@@ -1578,14 +1579,6 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
*
buf1
=
1
;
to
->
intg
++
;
}
else
{
/* Here we check 999.9 -> 1000 case when we need to increase intg */
int
first_dig
=
to
->
intg
%
DIG_PER_DEC1
;
/* first_dig==0 should be handled above in the 'if' */
if
(
first_dig
&&
(
*
buf1
>=
powers10
[
first_dig
]))
to
->
intg
++
;
}
}
else
{
...
...
@@ -1606,6 +1599,12 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
}
}
}
/* Here we check 999.9 -> 1000 case when we need to increase intg */
first_dig
=
to
->
intg
%
DIG_PER_DEC1
;
if
(
first_dig
&&
(
*
buf1
>=
powers10
[
first_dig
]))
to
->
intg
++
;
if
(
scale
<
0
)
scale
=
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