Commit e8edf40f authored by unknown's avatar unknown

Merge WL#2984


mysql-test/r/sp-vars.result:
  Merge
mysql-test/r/sp.result:
  Merge
mysql-test/r/type_newdecimal-big.result:
  Merge
mysql-test/t/type_newdecimal-big.test:
  Merge
sql/sp_head.cc:
  Merge
sql/sql_select.cc:
  Merge
parent 16bca982
This diff is collapsed.
...@@ -3537,7 +3537,7 @@ tm1 CREATE TEMPORARY TABLE `tm1` ( ...@@ -3537,7 +3537,7 @@ tm1 CREATE TEMPORARY TABLE `tm1` (
`spv1` decimal(3,3) default NULL `spv1` decimal(3,3) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings: Warnings:
Warning 1264 Out of range value adjusted for column 'spv1' at row 1 Warning 1264 Out of range value for column 'spv1' at row 1
Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1 Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1
call bug12589_2()| call bug12589_2()|
Table Create Table Table Create Table
......
drop procedure if exists sp1; drop procedure if exists sp1;
create procedure sp1 () begin CREATE PROCEDURE sp1()
declare v1, v2, v3, v4 decimal(16,12); declare v5 int; BEGIN
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; DECLARE v1, v2, v3, v4 DECIMAL(28,12);
while v5 < 100000 do DECLARE v3_2, v4_2 DECIMAL(28, 12);
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; DECLARE counter INT;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;// SET v1 = 1;
SET v2 = 2;
SET v3 = 1000000000000;
SET v4 = 2000000000000;
SET counter = 0;
WHILE counter < 100000 DO
SET v1 = v1 + 0.000000000001;
SET v2 = v2 - 0.000000000001;
SET v3 = v3 + 1;
SET v4 = v4 - 1;
SET counter = counter + 1;
END WHILE;
SET v3_2 = v3 * 0.000000000001;
SET v4_2 = v4 * 0.000000000001;
SELECT v1, v2, v3, v3_2, v4, v4_2;
END//
call sp1()// call sp1()//
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001 v1 v2 v3 v3_2 v4 v4_2
1.000000100000 1.999999900000 1.000000100000 1.999999900000 1.000000100000 1.999999900000 1000000100000.000000000000 1.000000100000 1999999900000.000000000000 1.999999900000
drop procedure sp1; drop procedure sp1;
...@@ -12,12 +12,31 @@ drop procedure if exists sp1; ...@@ -12,12 +12,31 @@ drop procedure if exists sp1;
delimiter //; delimiter //;
# #
create procedure sp1 () begin CREATE PROCEDURE sp1()
declare v1, v2, v3, v4 decimal(16,12); declare v5 int; BEGIN
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0; DECLARE v1, v2, v3, v4 DECIMAL(28,12);
while v5 < 100000 do DECLARE v3_2, v4_2 DECIMAL(28, 12);
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1; DECLARE counter INT;
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
SET v1 = 1;
SET v2 = 2;
SET v3 = 1000000000000;
SET v4 = 2000000000000;
SET counter = 0;
WHILE counter < 100000 DO
SET v1 = v1 + 0.000000000001;
SET v2 = v2 - 0.000000000001;
SET v3 = v3 + 1;
SET v4 = v4 - 1;
SET counter = counter + 1;
END WHILE;
SET v3_2 = v3 * 0.000000000001;
SET v4_2 = v4 * 0.000000000001;
SELECT v1, v2, v3, v3_2, v4, v4_2;
END//
# #
call sp1()// call sp1()//
#-- should return #-- should return
......
...@@ -680,6 +680,9 @@ sp_head::create_result_field(uint field_max_length, const char *field_name, ...@@ -680,6 +680,9 @@ sp_head::create_result_field(uint field_max_length, const char *field_name,
m_return_field_def.interval, m_return_field_def.interval,
field_name ? field_name : (const char *) m_name.str); field_name ? field_name : (const char *) m_name.str);
if (field)
field->init(table);
DBUG_RETURN(field); DBUG_RETURN(field);
} }
......
...@@ -8997,8 +8997,8 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) ...@@ -8997,8 +8997,8 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list)
field++; field++;
} }
*field= NULL; /* mark the end of the list */ *field= NULL; /* mark the end of the list */
s->blob_field[blob_count]= 0; /* mark the end of the list */ share->blob_field[blob_count]= 0; /* mark the end of the list */
s->blob_fields= blob_count; share->blob_fields= blob_count;
null_pack_length= (null_count + 7)/8; null_pack_length= (null_count + 7)/8;
share->reclength= record_length + null_pack_length; share->reclength= record_length + null_pack_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment