summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 6469581b482..608ec553da0 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -759,6 +759,10 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
Send_field field;
item->make_field(thd, &field);
+ /* limit number of decimals for float and double */
+ if (field.type == MYSQL_TYPE_FLOAT || field.type == MYSQL_TYPE_DOUBLE)
+ set_if_smaller(field.decimals, FLOATING_POINT_DECIMALS);
+
/* Keep things compatible for old clients */
if (field.type == MYSQL_TYPE_VARCHAR)
field.type= MYSQL_TYPE_VAR_STRING;