Commit 56e603a3 authored by Magne Mahre's avatar Magne Mahre

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)

client/sql_string.h:
  moved NOT_FIXED_DEC to the correct header
include/mysql_com.h:
  moved NOT_FIXED_DEC to the correct header
libmysql/libmysql.c:
  moved NOT_FIXED_DEC to the correct header
sql/field.h:
  moved NOT_FIXED_DEC to the correct header
sql/sql_string.h:
  moved NOT_FIXED_DEC to the correct header
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
  moved NOT_FIXED_DEC to the correct header
parents a176b249 1d20b6ff
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <mysql_com.h>
#ifdef HAVE_FCONVERT #ifdef HAVE_FCONVERT
#include <floatingpoint.h> #include <floatingpoint.h>
#endif #endif
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#ifndef NOT_FIXED_DEC
#define NOT_FIXED_DEC 31
#endif
class String; class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
......
...@@ -524,4 +524,5 @@ uchar *net_store_length(uchar *pkg, ulonglong length); ...@@ -524,4 +524,5 @@ uchar *net_store_length(uchar *pkg, ulonglong length);
#define MYSQL_STMT_HEADER 4 #define MYSQL_STMT_HEADER 4
#define MYSQL_LONG_DATA_HEADER 6 #define MYSQL_LONG_DATA_HEADER 6
#define NOT_FIXED_DEC 31
#endif #endif
...@@ -3464,10 +3464,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, ...@@ -3464,10 +3464,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
*/ */
char buff[MAX_DOUBLE_STRING_REP_LENGTH]; char buff[MAX_DOUBLE_STRING_REP_LENGTH];
char *end; char *end;
/* TODO: move this to a header shared between client and server. */
#define NOT_FIXED_DEC 31
if (field->decimals >= NOT_FIXED_DEC) if (field->decimals >= NOT_FIXED_DEC)
#undef NOT_FIXED_DEC
{ {
/* /*
DBL_DIG below is to ensure that the server and client has the same DBL_DIG below is to ensure that the server and client has the same
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#define NOT_FIXED_DEC 31
#define DATETIME_DEC 6 #define DATETIME_DEC 6
const uint32 max_field_size= (uint32) 4294967295U; const uint32 max_field_size= (uint32) 4294967295U;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <mysql_com.h>
#ifdef HAVE_FCONVERT #ifdef HAVE_FCONVERT
#include <floatingpoint.h> #include <floatingpoint.h>
#endif #endif
......
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#ifndef NOT_FIXED_DEC
#define NOT_FIXED_DEC 31
#endif
class String; class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
......
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
#define DECIMAL_MAX_LENGTH ((8 * 9) - 8) #define DECIMAL_MAX_LENGTH ((8 * 9) - 8)
#ifndef NOT_FIXED_DEC
#define NOT_FIXED_DEC 31
#endif
C_MODE_START C_MODE_START
extern int decimal_bin_size(int, int); extern int decimal_bin_size(int, int);
C_MODE_END C_MODE_END
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment