From 218e00ac681c300ddfb59889d8b6dd7faa0e71f6 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Sat, 19 Feb 2005 18:58:27 +0200 Subject: Fixed BUILD script to use --with-berkeley-db instead of --with-bdb Lots of small fixes to multi-precision-math path Give Note for '123.4e' Added helper functions type 'val_string_from_real() Don't give warnings for end space for string2decimal() Changed storage of values for SP so that we can detect length of argument without strlen() Changed interface for str2dec() so that we must supple the pointer to the last character in the buffer --- sql/protocol.cc | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'sql/protocol.cc') diff --git a/sql/protocol.cc b/sql/protocol.cc index 7c56bb3fc7a..657341b8bdc 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -822,15 +822,9 @@ bool Protocol_simple::store_decimal(const my_decimal *d) field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL); field_pos++; #endif - int buf_size= my_decimal_string_length(d); - char *buff= (char *)my_alloca(buf_size); - String str(buff, buf_size, &my_charset_bin); - if (my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str)) - { - my_afree(buff); - return TRUE; - } - my_afree(buff); + 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); return net_store_data(str.ptr(), str.length()); } @@ -1056,15 +1050,9 @@ bool Protocol_prep::store_decimal(const my_decimal *d) field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL); field_pos++; #endif - int buf_size= my_decimal_string_length(d); - char *buff= (char *)my_alloca(buf_size); - String str(buff, buf_size, &my_charset_bin); - if (my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str)) - { - my_afree(buff); - return TRUE; - } - my_afree(buff); + 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); return store(str.ptr(), str.length(), str.charset()); } -- cgit v1.2.1