summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-01-29 23:40:34 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-01-29 23:40:34 +0100
commit26b00be33256f7679d31219903d4a511643c94a8 (patch)
tree38095f602a8e97d091d1b75a910a8a3cfc5216bf /storage
parenta9d06e106629bebff98a2cc1b4f8a274aa15e5f5 (diff)
downloadmariadb-git-26b00be33256f7679d31219903d4a511643c94a8.tar.gz
Fix problems with ODBC raised by Adding the type TYPE_BIGINT (longlong).
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/CMakeLists.txt4
-rw-r--r--storage/connect/valblk.cpp4
-rw-r--r--storage/connect/valblk.h2
-rw-r--r--storage/connect/value.cpp76
-rw-r--r--storage/connect/value.h8
5 files changed, 53 insertions, 41 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 86026388d58..28c5bb2d45a 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -130,9 +130,9 @@ OPTION(CONNECT_WITH_MYSQL
IF(CONNECT_WITH_MYSQL)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} myconn.cpp tabmysql.cpp)
# For static linking
- SET(MYSQL_LIBRARY mysqlclient)
+ #SET(MYSQL_LIBRARY mysqlclient)
# For dynamic linking
- #SET(MYSQL_LIBRARY libmysql)
+ SET(MYSQL_LIBRARY libmysql)
add_definitions(-DMYSQL_SUPPORT)
IF(!UNIX)
#
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 09c2a747b5d..55141ff36c0 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -1,7 +1,7 @@
/************ Valblk C++ Functions Source Code File (.CPP) *************/
-/* Name: VALBLK.CPP Version 1.4 */
+/* Name: VALBLK.CPP Version 1.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
/* */
/* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */
diff --git a/storage/connect/valblk.h b/storage/connect/valblk.h
index 7c4f3452f17..4d1260abda2 100644
--- a/storage/connect/valblk.h
+++ b/storage/connect/valblk.h
@@ -274,7 +274,7 @@ class DATBLK : public LNGBLK {
}; // end of class DATBLK
/***********************************************************************/
-/* Class LNGBLK: represents a block of int integer values. */
+/* Class BIGBLK: represents a block of big integer values. */
/***********************************************************************/
class BIGBLK : public VALBLK {
public:
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index f4fdc31e8c9..38c558c7e68 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -19,8 +19,8 @@
/* to avoid too complicated classes and unuseful duplication of many */
/* functions used on one family only. The drawback is that for new */
/* types of objects, we shall have more classes to update. */
-/* Currently the only implemented types are STRING, int, DOUBLE and */
-/* DATE. Shortly we should add at least int VARCHAR and LONGLONG. */
+/* Currently the only implemented types are STRING, INT, DOUBLE, DATE */
+/* and LONGLONG. Shortly we should add at least TINY and VARCHAR. */
/***********************************************************************/
#ifndef __VALUE_H
@@ -195,7 +195,6 @@ int GetDBType(int type)
return tp;
} // end of GetPLGType
-
/***********************************************************************/
/* GetFormatType: returns the FORMAT character(s) according to type. */
/***********************************************************************/
@@ -293,7 +292,7 @@ int ConvertType(int target, int type, CONV kind, bool match)
: (target == TYPE_INT || type == TYPE_INT) ? TYPE_INT
: TYPE_SHORT;
default:
- if (!target || target == type)
+ if (target == TYPE_ERROR || target == type)
return type;
if (match && ((IsTypeChar(target) && !IsTypeChar(type)) ||
@@ -711,11 +710,11 @@ char *STRING::GetIntString(char *p, int n)
} // end of GetIntString
/***********************************************************************/
-/* STRING GetIntString: get big int representation of a char value. */
+/* STRING GetBigintString: get big int representation of a char value.*/
/***********************************************************************/
char *STRING::GetBigintString(char *p, int n)
{
- sprintf(p, "%*lld", n, atol(Strp));
+ sprintf(p, "%*lld", n, atoll(Strp));
return p;
} // end of GetBigintString
@@ -1237,7 +1236,7 @@ void STRING::SetMax(PVAL vp)
} // end of SetMax
/***********************************************************************/
-/* SetMin: used by QUERY for the aggregate function MIN. */
+/* SetMax: used by QUERY for the aggregate function MAX. */
/***********************************************************************/
void STRING::SetMax(PVBLK vbp, int i)
{
@@ -1246,10 +1245,10 @@ void STRING::SetMax(PVBLK vbp, int i)
if (((Ci) ? stricmp(val, Strp) : strcmp(val, Strp)) > 0)
strcpy(Strp, val);
- } // end of SetMin
+ } // end of SetMax
/***********************************************************************/
-/* SetMin: used by QUERY for the aggregate function MIN. */
+/* SetMax: used by QUERY for the aggregate function MAX. */
/***********************************************************************/
void STRING::SetMax(PVBLK vbp, int j, int k)
{
@@ -1263,10 +1262,10 @@ void STRING::SetMax(PVBLK vbp, int j, int k)
} // endfor i
- } // end of SetMin
+ } // end of SetMax
/***********************************************************************/
-/* SetMin: used by QUERY for the aggregate function MIN. */
+/* SetMax: used by QUERY for the aggregate function MAX. */
/***********************************************************************/
void STRING::SetMax(PVBLK vbp, int *x, int j, int k)
{
@@ -1280,7 +1279,7 @@ void STRING::SetMax(PVBLK vbp, int *x, int j, int k)
} // endfor i
- } // end of SetMin
+ } // end of SetMax
/***********************************************************************/
/* STRING SetFormat function (used to set SELECT output format). */
@@ -1757,12 +1756,13 @@ bool SHVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
return true;
} // endswitch op
- if (trace)
- if (np = 1)
- htrc(" result=%hd val=%hd op=%d\n", Sval, val[0], op);
- else
- htrc(" result=%hd val=%hd,%hd op=%d\n",
- Sval, val[0], val[1], op);
+ if (trace) {
+ if (np = 1)
+ htrc(" result=%hd val=%hd op=%d\n", Sval, val[0], op);
+ else
+ htrc(" result=%hd val=%hd,%hd op=%d\n",
+ Sval, val[0], val[1], op);
+ } // endif trace
} // endif op
@@ -2257,7 +2257,7 @@ char *INTVAL::GetFloatString(char *p, int n, int prec)
} // end of GetFloatString
/***********************************************************************/
-/* INTVAL compare value with another Value. */
+/* INTVAL compare value with another Value. */
/***********************************************************************/
bool INTVAL::IsEqual(PVAL vp, bool chktype)
{
@@ -2272,7 +2272,7 @@ bool INTVAL::IsEqual(PVAL vp, bool chktype)
/***********************************************************************/
/* Compare values and returns 1, 0 or -1 according to comparison. */
-/* This function is used for evaluation of int integer filters. */
+/* This function is used for evaluation of int integer filters. */
/***********************************************************************/
int INTVAL::CompareValue(PVAL vp)
{
@@ -2506,12 +2506,13 @@ bool INTVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
return true;
} // endswitch op
- if (trace)
- if (np = 1)
- htrc(" result=%d val=%d op=%d\n", Ival, val[0], op);
- else
- htrc(" result=%d val=%d,%d op=%d\n",
- Ival, val[0], val[1], op);
+ if (trace) {
+ if (np = 1)
+ htrc(" result=%d val=%d op=%d\n", Ival, val[0], op);
+ else
+ htrc(" result=%d val=%d,%d op=%d\n",
+ Ival, val[0], val[1], op);
+ } // endif trace
} // endif op
@@ -2783,7 +2784,7 @@ bool INTVAL::SetConstFormat(PGLOBAL g, FORMAT& fmt)
} // end of SetConstFormat
/***********************************************************************/
-/* Make file output of a int object. */
+/* Make file output of a int object. */
/***********************************************************************/
void INTVAL::Print(PGLOBAL g, FILE *f, uint n)
{
@@ -2796,7 +2797,7 @@ void INTVAL::Print(PGLOBAL g, FILE *f, uint n)
} /* end of Print */
/***********************************************************************/
-/* Make string output of a int object. */
+/* Make string output of a int object. */
/***********************************************************************/
void INTVAL::Print(PGLOBAL g, char *ps, uint z)
{
@@ -4162,7 +4163,7 @@ DFVAL::DFVAL(PSZ s, int prec) : VALUE(TYPE_FLOAT)
} // end of DFVAL constructor
/***********************************************************************/
-/* DFVAL public constructor from short. */
+/* DFVAL public constructor from short. */
/***********************************************************************/
DFVAL::DFVAL(short n, int prec) : VALUE(TYPE_FLOAT)
{
@@ -4172,7 +4173,7 @@ DFVAL::DFVAL(short n, int prec) : VALUE(TYPE_FLOAT)
} // end of DFVAL constructor
/***********************************************************************/
-/* DFVAL public constructor from int. */
+/* DFVAL public constructor from int. */
/***********************************************************************/
DFVAL::DFVAL(int n, int prec) : VALUE(TYPE_FLOAT)
{
@@ -4182,6 +4183,16 @@ DFVAL::DFVAL(int n, int prec) : VALUE(TYPE_FLOAT)
} // end of DFVAL constructor
/***********************************************************************/
+/* DFVAL public constructor from big int. */
+/***********************************************************************/
+DFVAL::DFVAL(longlong n, int prec) : VALUE(TYPE_FLOAT)
+ {
+ Fval = (double)n;
+ Prec = prec;
+ Clen = sizeof(double);
+ } // end of DFVAL constructor
+
+/***********************************************************************/
/* DFVAL public constructor from double. */
/***********************************************************************/
DFVAL::DFVAL(double f, int prec) : VALUE(TYPE_FLOAT)
@@ -4513,12 +4524,13 @@ bool DFVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
return true;
} // endswitch op
- if (trace)
+ if (trace) {
if (np == 1)
htrc("Compute result=%lf val=%lf op=%d\n", Fval, val[0], op);
else
htrc("Compute result=%lf val=%lf,%lf op=%d\n",
- Fval, val[0], val[1], op);
+ Fval, val[0], val[1], op);
+ } // endif trace
return false;
} // end of Compute
diff --git a/storage/connect/value.h b/storage/connect/value.h
index 32f5d5664b7..5e170c40c1b 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -169,7 +169,7 @@ class STRING : public VALUE {
virtual PSZ GetCharValue(void) {return Strp;}
virtual short GetShortValue(void) {return (short)atoi(Strp);}
virtual int GetIntValue(void) {return atol(Strp);}
- virtual longlong GetBigintValue(void) {return strtoll(Strp, NULL, 10);}
+ virtual longlong GetBigintValue(void) {return atoll(Strp);}
virtual double GetFloatValue(void) {return atof(Strp);}
virtual void *GetTo_Val(void) {return Strp;}
@@ -449,8 +449,8 @@ class DllExport BIGVAL : public VALUE {
// Implementation
virtual bool IsTypeNum(void) {return true;}
- virtual bool IsZero(void) {return Lval == 0;}
- virtual void Reset(void) {Lval = 0;}
+ virtual bool IsZero(void) {return Lval == 0LL;}
+ virtual void Reset(void) {Lval = 0LL;}
virtual int GetValLen(void);
virtual int GetValPrec() {return 0;}
virtual int GetSize(void) {return sizeof(longlong);}
@@ -465,7 +465,7 @@ class DllExport BIGVAL : public VALUE {
virtual bool SetValue_pval(PVAL valp, bool chktype);
virtual void SetValue_char(char *p, int n);
virtual void SetValue_psz(PSZ s);
- virtual void SetValue_bool(bool b) {Lval = (b) ? 1 : 0;}
+ virtual void SetValue_bool(bool b) {Lval = (b) ? 1LL : 0LL;}
virtual void SetValue(short i) {Lval = (longlong)i;}
virtual void SetValue(int n) {Lval = (longlong)n;}
virtual void SetValue(longlong n) {Lval = n;}