diff options
author | Michael Widenius <monty@askmonty.org> | 2011-12-11 11:34:44 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-12-11 11:34:44 +0200 |
commit | 6d4224a31c9d32c8f8067a4f7d16daa29bcdee6b (patch) | |
tree | 79e3143528495069ad232f673532573b30afe425 /sql/my_decimal.cc | |
parent | 3e2cb35e11cb5ee6668d538a62a3b32e017944a5 (diff) | |
parent | 701c0f822abe4ee9eeafd244fa30dc2fcf067b81 (diff) | |
download | mariadb-git-6d4224a31c9d32c8f8067a4f7d16daa29bcdee6b.tar.gz |
Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
Diffstat (limited to 'sql/my_decimal.cc')
-rw-r--r-- | sql/my_decimal.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 93e1d2431af..44207b9319b 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2005-2006 MySQL AB +/* + Copyright (c) 2005, 2010, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "mysql_priv.h" #include <time.h> @@ -97,10 +99,11 @@ int my_decimal2string(uint mask, const my_decimal *d, UNSIGNED. Hence the buffer for a ZEROFILLed value is the length the user requested, plus one for a possible decimal point, plus one if the user only wanted decimal places, but we force a leading - zero on them. Because the type is implicitly UNSIGNED, we do not - need to reserve a character for the sign. For all other cases, - fixed_prec will be 0, and my_decimal_string_length() will be called - instead to calculate the required size of the buffer. + zero on them, plus one for the '\0' terminator. Because the type + is implicitly UNSIGNED, we do not need to reserve a character for + the sign. For all other cases, fixed_prec will be 0, and + my_decimal_string_length() will be called instead to calculate the + required size of the buffer. */ int length= (fixed_prec ? (fixed_prec + ((fixed_prec == fixed_dec) ? 1 : 0) + 1) @@ -352,7 +355,7 @@ print_decimal_buff(const my_decimal *dec, const uchar* ptr, int length) const char *dbug_decimal_as_string(char *buff, const my_decimal *val) { - int length= DECIMAL_MAX_STR_LENGTH; + int length= DECIMAL_MAX_STR_LENGTH + 1; /* minimum size for buff */ if (!val) return "NULL"; (void)decimal2string((decimal_t*) val, buff, &length, 0,0,0); |