1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix for bug #12938 (decimal arithmetic in the loop fails)

mysql-test/r/type_newdecimal.result:
  test result fixed
mysql-test/t/type_newdecimal.test:
  test case added
strings/decimal.c:
  code to cut heading zeroes off the result of the multiplication added
This commit is contained in:
unknown
2005-09-04 21:00:00 +05:00
parent d6b70bf4ae
commit d96cf23c9a
3 changed files with 69 additions and 1 deletions

View File

@ -984,3 +984,35 @@ t1 CREATE TABLE `t1` (
`f1` decimal(10,0) unsigned zerofill NOT NULL default '0000000000'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop procedure if exists wg2;
Warnings:
Note 1305 PROCEDURE wg2 does not exist
create procedure wg2()
begin
declare v int default 1;
declare tdec decimal(5) default 0;
while v <= 9 do set tdec =tdec * 10;
select v, tdec;
set v = v + 1;
end while;
end//
call wg2()//
v tdec
1 0
v tdec
2 0
v tdec
3 0
v tdec
4 0
v tdec
5 0
v tdec
6 0
v tdec
7 0
v tdec
8 0
v tdec
9 0
drop procedure wg2;

View File

@ -1015,3 +1015,25 @@ create table t1 (
f1 decimal (0,0) zerofill not null default 0);
show create table t1;
drop table t1;
#
# Bug 12938 (arithmetic loop's zero)
#
--disable-warnings
drop procedure if exists wg2;
--enable-warnings
delimiter //;
create procedure wg2()
begin
declare v int default 1;
declare tdec decimal(5) default 0;
while v <= 9 do set tdec =tdec * 10;
select v, tdec;
set v = v + 1;
end while;
end//
call wg2()//
delimiter ;//
drop procedure wg2;