diff options
author | unknown <msvensson@neptunus.(none)> | 2006-02-21 14:55:54 +0100 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-02-21 14:55:54 +0100 |
commit | f3c9a47517147dd447f7e668fd1d97c22e2d737a (patch) | |
tree | 8bc1e6fcf04a84f6677fb8f4ded5aa099820d477 /libmysql | |
parent | f220f892124878c8ef202b847f292f7f05d83d2e (diff) | |
download | mariadb-git-f3c9a47517147dd447f7e668fd1d97c22e2d737a.tar.gz |
Bug#11589 mysqltest, --ps-protocol, strange output, float/double/real with zerofill
- Add zerofill in client if real/float/double is bound to string and fetched using binary protocol.
libmysql/libmysql.c:
Add zerofill before value if column is created with zerofill
mysql-test/r/type_float.result:
Update test for zerofill
mysql-test/t/type_float.test:
Add test for zerofill and prepared statments
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 11ee7284cbf..59a28d0a1f1 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3850,7 +3850,15 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, sprintf(buff, "%.*f", (int) field->decimals, value); 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; } } |