diff options
author | Magne Mahre <magne.mahre@sun.com> | 2009-11-11 21:19:41 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@sun.com> | 2009-11-11 21:19:41 +0100 |
commit | d88b0008aef1c03c7cf5799970533a5f26d722fb (patch) | |
tree | 0ed4dcde53a4fde2d779524fa20ba363af8846c5 | |
parent | b2d7daeb6d1d7adde3576af1b654aaa450c99a42 (diff) | |
parent | e8fd6cd4a11bf33da8b0bf534be1a0ed5195f1f9 (diff) | |
download | mariadb-git-d88b0008aef1c03c7cf5799970533a5f26d722fb.tar.gz |
Bug #33544 UDF_INIT member decimals initialized wrong with
STRING_RESULT argument
There is a "magic" number for precision : NOT_FIXED_DEC.
This means that the precision is not a fixed number.
But this constant was re-defined in several files and
was not available to the UDF developers.
Moved the NOT_FIXED_DEC definition to the correct header
and removed the redundant definitions.
Backported to 5.6.0 (mysql-next-mr-runtime)
-rw-r--r-- | client/sql_string.cc | 1 | ||||
-rw-r--r-- | client/sql_string.h | 4 | ||||
-rw-r--r-- | include/mysql_com.h | 1 | ||||
-rw-r--r-- | libmysql/libmysql.c | 3 | ||||
-rw-r--r-- | sql/field.h | 1 | ||||
-rw-r--r-- | sql/sql_string.cc | 1 | ||||
-rw-r--r-- | sql/sql_string.h | 4 | ||||
-rw-r--r-- | storage/ndb/include/kernel/signaldata/DictTabInfo.hpp | 4 |
8 files changed, 3 insertions, 16 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc index dc6147b563f..46fd1cb0012 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -23,6 +23,7 @@ #include <my_sys.h> #include <m_string.h> #include <m_ctype.h> +#include <mysql_com.h> #ifdef HAVE_FCONVERT #include <floatingpoint.h> #endif diff --git a/client/sql_string.h b/client/sql_string.h index 0e6d6da4476..1a3ac5d33c5 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -22,10 +22,6 @@ #pragma interface /* gcc class implementation */ #endif -#ifndef NOT_FIXED_DEC -#define NOT_FIXED_DEC 31 -#endif - class String; int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); diff --git a/include/mysql_com.h b/include/mysql_com.h index 345ecd5dd93..93b9ccebda2 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -524,4 +524,5 @@ uchar *net_store_length(uchar *pkg, ulonglong length); #define MYSQL_STMT_HEADER 4 #define MYSQL_LONG_DATA_HEADER 6 +#define NOT_FIXED_DEC 31 #endif diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 56a2e492226..a8239137f98 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3464,10 +3464,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, */ char buff[MAX_DOUBLE_STRING_REP_LENGTH]; char *end; - /* TODO: move this to a header shared between client and server. */ -#define NOT_FIXED_DEC 31 if (field->decimals >= NOT_FIXED_DEC) -#undef NOT_FIXED_DEC { /* DBL_DIG below is to ensure that the server and client has the same diff --git a/sql/field.h b/sql/field.h index 16e1078e178..9604f3fe227 100644 --- a/sql/field.h +++ b/sql/field.h @@ -25,7 +25,6 @@ #pragma interface /* gcc class implementation */ #endif -#define NOT_FIXED_DEC 31 #define DATETIME_DEC 6 const uint32 max_field_size= (uint32) 4294967295U; diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 491e51e8a92..a0ea75a0b0a 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -23,6 +23,7 @@ #include <my_sys.h> #include <m_string.h> #include <m_ctype.h> +#include <mysql_com.h> #ifdef HAVE_FCONVERT #include <floatingpoint.h> #endif diff --git a/sql/sql_string.h b/sql/sql_string.h index 75dc1163eec..38f843e7e8f 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -22,10 +22,6 @@ #pragma interface /* gcc class implementation */ #endif -#ifndef NOT_FIXED_DEC -#define NOT_FIXED_DEC 31 -#endif - class String; int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); diff --git a/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp b/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp index 3923d8e6fbf..43de91b7c22 100644 --- a/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -30,10 +30,6 @@ #define DECIMAL_MAX_LENGTH ((8 * 9) - 8) -#ifndef NOT_FIXED_DEC -#define NOT_FIXED_DEC 31 -#endif - C_MODE_START extern int decimal_bin_size(int, int); C_MODE_END |