summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-08-07 10:48:42 +0400
committerAlexander Barkov <bar@mariadb.com>2018-08-07 10:48:42 +0400
commitcb7b5fbf1cf7c5bcd0509e428a53a8b8d6fbba0f (patch)
tree97a2de6b50c55fdecbaacbde75775196ff347421 /sql/protocol.cc
parent01e4426a6352740973ff275eac60ddacc90da119 (diff)
downloadmariadb-git-cb7b5fbf1cf7c5bcd0509e428a53a8b8d6fbba0f.tar.gz
MDEV-16910 Add class VDec
Adding classes VDec and VDec2_lazy, according to the task description. This patch removes around 250 duplicate code lines.
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index d29d2fe853d..29004fe24e4 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1195,9 +1195,8 @@ bool Protocol_text::store_decimal(const my_decimal *d)
field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL);
field_pos++;
#endif
- char buff[DECIMAL_MAX_STR_LENGTH];
- String str(buff, sizeof(buff), &my_charset_bin);
- (void) my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
+ StringBuffer<DECIMAL_MAX_STR_LENGTH> str;
+ (void) d->to_string(&str);
return net_store_data((uchar*) str.ptr(), str.length());
}
@@ -1446,9 +1445,8 @@ bool Protocol_binary::store_decimal(const my_decimal *d)
field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL);
field_pos++;
#endif
- char buff[DECIMAL_MAX_STR_LENGTH];
- String str(buff, sizeof(buff), &my_charset_bin);
- (void) my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
+ StringBuffer<DECIMAL_MAX_STR_LENGTH> str;
+ (void) d->to_string(&str);
return store(str.ptr(), str.length(), str.charset());
}