Commit 2fbebfec authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/bug11589/my50-bug11589

into  neptunus.(none):/home/msvensson/mysql/bug11589/my50-test_latest


libmysql/libmysql.c:
  Auto merged
mysql-test/r/type_float.result:
  Auto merged
mysql-test/t/type_float.test:
  Auto merged
parents 2dd1dc62 f3c9a475
...@@ -3827,7 +3827,15 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, ...@@ -3827,7 +3827,15 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
sprintf(buff, "%.*f", (int) field->decimals, value); sprintf(buff, "%.*f", (int) field->decimals, value);
end= strend(buff); end= strend(buff);
} }
fetch_string_with_conversion(param, buff, (uint) (end - buff)); uint length= (uint) (end-buff);
if (field->flags & ZEROFILL_FLAG && length < field->length &&
field->length < MAX_DOUBLE_STRING_REP_LENGTH-1)
{
bmove_upp((char*) buff+field->length,buff+length, length);
bfill((char*) buff, field->length - length,'0');
length= field->length;
}
fetch_string_with_conversion(param, buff, length);
break; break;
} }
} }
......
...@@ -266,3 +266,19 @@ create table t1 (s1 float(0,2)); ...@@ -266,3 +266,19 @@ create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1'). ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2)); create table t1 (s1 float(1,2));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1'). ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
CREATE TABLE t1 (
f1 real zerofill,
f2 double zerofill,
f3 float zerofill);
INSERT INTO t1 VALUES ( 0.314152e+1, 0.314152e+1, 0.314152e+1);
PREPARE stmt1 FROM 'select f1, f2, f3 FROM t1';
select f1, f2, f3 FROM t1;
f1 f2 f3
0000000000000003.14152 0000000000000003.14152 000003.14152
select f1, f2, f3 FROM t1;
f1 f2 f3
0000000000000003.14152 0000000000000003.14152 000003.14152
EXECUTE stmt1;
f1 f2 f3
0000000000000003.14152 0000000000000003.14152 000003.14152
DROP TABLE t1;
...@@ -188,3 +188,21 @@ drop table t1,t2,t3; ...@@ -188,3 +188,21 @@ drop table t1,t2,t3;
create table t1 (s1 float(0,2)); create table t1 (s1 float(0,2));
--error 1427 --error 1427
create table t1 (s1 float(1,2)); create table t1 (s1 float(1,2));
#
# MySQL Bugs: #11589: mysqltest --ps-protocol, strange output, float/double/real with zerofill
#
CREATE TABLE t1 (
f1 real zerofill,
f2 double zerofill,
f3 float zerofill);
INSERT INTO t1 VALUES ( 0.314152e+1, 0.314152e+1, 0.314152e+1);
let $my_stmt= select f1, f2, f3 FROM t1;
eval PREPARE stmt1 FROM '$my_stmt';
select f1, f2, f3 FROM t1;
eval $my_stmt;
EXECUTE stmt1;
DROP TABLE t1;
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