summaryrefslogtreecommitdiff
path: root/storage/connect/value.h
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-12-03 22:59:40 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-12-03 22:59:40 +0100
commitee2f04450b45515c507e4511c26e48e2b846aa73 (patch)
tree2c1d9bec56e1268c8c41629ae1dd4f1d8253f471 /storage/connect/value.h
parentd240a0418cf6d59fba711f0677f164d9ee881b7e (diff)
downloadmariadb-git-ee2f04450b45515c507e4511c26e48e2b846aa73.tar.gz
- Add support for unsigned numeric types
added: storage/connect/mysql-test/connect/r/unsigned.result storage/connect/mysql-test/connect/t/unsigned.test modified: storage/connect/colblk.cpp storage/connect/colblk.h storage/connect/connect.cc storage/connect/ha_connect.cc storage/connect/myconn.cpp storage/connect/mysql-test/connect/r/mysql_discovery.result storage/connect/mysql-test/connect/r/xml.result storage/connect/myutil.cpp storage/connect/myutil.h storage/connect/plgdbsem.h storage/connect/tabdos.cpp storage/connect/tabfix.cpp storage/connect/tabmysql.cpp storage/connect/tabutil.cpp storage/connect/valblk.cpp storage/connect/valblk.h storage/connect/value.cpp storage/connect/value.h storage/connect/xobject.cpp storage/connect/xobject.h
Diffstat (limited to 'storage/connect/value.h')
-rw-r--r--storage/connect/value.h67
1 files changed, 21 insertions, 46 deletions
diff --git a/storage/connect/value.h b/storage/connect/value.h
index 5dc4ef98d51..185234b42b9 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -16,11 +16,6 @@
#include "assert.h"
#include "block.h"
-#if defined(WIN32)
-#define strtoll _strtoi64
-#define atoll(S) strtoll(S, NULL, 10)
-#endif // WIN32
-
/***********************************************************************/
/* Types used in some class definitions. */
/***********************************************************************/
@@ -55,6 +50,8 @@ DllExport bool IsTypeNum(int type);
DllExport PVAL AllocateValue(PGLOBAL, PVAL, int = TYPE_VOID, int = 0);
DllExport PVAL AllocateValue(PGLOBAL, int, int len = 0, int prec = 0,
PSZ fmt = NULL);
+DllExport ulonglong CharToNumber(char *, int, ulonglong, bool,
+ bool *minus = NULL, bool *rc = NULL);
/***********************************************************************/
/* Class VALUE represents a constant or variable of any valid type. */
@@ -96,7 +93,7 @@ class DllExport VALUE : public BLOCK {
// Methods
virtual bool SetValue_pval(PVAL valp, bool chktype = false) = 0;
- virtual void SetValue_char(char *p, int n) = 0;
+ virtual bool SetValue_char(char *p, int n) = 0;
virtual void SetValue_psz(PSZ s) = 0;
virtual void SetValue(char c) {assert(false);}
virtual void SetValue(uchar c) {assert(false);}
@@ -112,11 +109,6 @@ class DllExport VALUE : public BLOCK {
virtual bool GetBinValue(void *buf, int buflen, bool go) = 0;
virtual char *ShowValue(char *buf, int len = 0) = 0;
virtual char *GetCharString(char *p) = 0;
-//virtual char *GetShortString(char *p, int n) {return "#####";}
-//virtual char *GetIntString(char *p, int n) = 0;
-//virtual char *GetBigintString(char *p, int n) = 0;
-//virtual char *GetFloatString(char *p, int n, int prec) = 0;
-//virtual char *GetTinyString(char *p, int n) {return "?";}
virtual bool IsEqual(PVAL vp, bool chktype) = 0;
virtual bool FormatValue(PVAL vp, char *fmt) = 0;
@@ -169,7 +161,7 @@ class DllExport TYPVAL : public VALUE {
// Methods
virtual bool SetValue_pval(PVAL valp, bool chktype);
- virtual void SetValue_char(char *p, int n);
+ virtual bool SetValue_char(char *p, int n);
virtual void SetValue_psz(PSZ s);
virtual void SetValue(char c) {Tval = (TYPE)c; Null = false;}
virtual void SetValue(uchar c) {Tval = (TYPE)c; Null = false;}
@@ -185,11 +177,6 @@ class DllExport TYPVAL : public VALUE {
virtual bool GetBinValue(void *buf, int buflen, bool go);
virtual char *ShowValue(char *buf, int);
virtual char *GetCharString(char *p);
-//virtual char *GetShortString(char *p, int n);
-//virtual char *GetIntString(char *p, int n);
-//virtual char *GetBigintString(char *p, int n);
-//virtual char *GetFloatString(char *p, int n, int prec = -1);
-//virtual char *GetTinyString(char *p, int n);
virtual bool IsEqual(PVAL vp, bool chktype);
virtual bool SetConstFormat(PGLOBAL, FORMAT&);
virtual bool FormatValue(PVAL vp, char *fmt);
@@ -201,9 +188,10 @@ class DllExport TYPVAL : public VALUE {
TYPVAL(void) : VALUE(TYPE_ERROR) {}
// Specialized functions
- TYPE GetTypedValue(PVAL vp);
- TYPE GetTypedValue(PVBLK blk, int n);
- TYPE GetTypedValue(PSZ s);
+ static ulonglong MaxVal(void);
+ TYPE GetTypedValue(PVAL vp);
+ TYPE GetTypedValue(PVBLK blk, int n);
+// TYPE GetTypedValue(PSZ s);
// Members
TYPE Tval;
@@ -227,21 +215,21 @@ class DllExport TYPVAL<PSZ>: public VALUE {
virtual int GetValPrec() {return (Ci) ? 1 : 0;}
virtual int GetSize(void) {return (Strp) ? strlen(Strp) : 0;}
virtual PSZ GetCharValue(void) {return Strp;}
- virtual char GetTinyValue(void) {return (char)atoi(Strp);}
- virtual uchar GetUTinyValue(void) {return (uchar)atoi(Strp);}
- virtual short GetShortValue(void) {return (short)atoi(Strp);}
- virtual ushort GetUShortValue(void) {return (ushort)atoi(Strp);}
- virtual int GetIntValue(void) {return atol(Strp);}
- virtual uint GetUIntValue(void) {return (uint)atol(Strp);}
- virtual longlong GetBigintValue(void) {return atoll(Strp);}
- virtual ulonglong GetUBigintValue(void) {return (ulonglong)atoll(Strp);}
+ virtual char GetTinyValue(void);
+ virtual uchar GetUTinyValue(void);
+ virtual short GetShortValue(void);
+ virtual ushort GetUShortValue(void);
+ virtual int GetIntValue(void);
+ virtual uint GetUIntValue(void);
+ virtual longlong GetBigintValue(void);
+ virtual ulonglong GetUBigintValue(void);
virtual double GetFloatValue(void) {return atof(Strp);}
virtual void *GetTo_Val(void) {return Strp;}
virtual void SetPrec(int prec) {Ci = prec != 0;}
// Methods
virtual bool SetValue_pval(PVAL valp, bool chktype);
- virtual void SetValue_char(char *p, int n);
+ virtual bool SetValue_char(char *p, int n);
virtual void SetValue_psz(PSZ s);
virtual void SetValue_pvblk(PVBLK blk, int n);
virtual void SetValue(char c);
@@ -257,23 +245,10 @@ class DllExport TYPVAL<PSZ>: public VALUE {
virtual bool GetBinValue(void *buf, int buflen, bool go);
virtual char *ShowValue(char *buf, int);
virtual char *GetCharString(char *p);
-//virtual char *GetShortString(char *p, int n);
-//virtual char *GetIntString(char *p, int n);
-//virtual char *GetBigintString(char *p, int n);
-//virtual char *GetFloatString(char *p, int n, int prec = -1);
-//virtual char *GetTinyString(char *p, int n);
virtual bool IsEqual(PVAL vp, bool chktype);
virtual bool FormatValue(PVAL vp, char *fmt);
virtual bool SetConstFormat(PGLOBAL, FORMAT&);
- // Specialized functions
-//template <class T>
-//T GetValue_as(T type) {return Strp;}
-//int GetValue_as(int type) {return atol(Strp);}
-//short GetValue_as(short type) {return (short)atoi(Strp);}
-//longlong GetValue_as(longlong type) {return atoll(Strp);}
-//double GetValue_as(double type) {return atof(Strp);}
-
// Members
PSZ Strp;
bool Ci; // true if case insensitive
@@ -295,7 +270,7 @@ class DllExport DTVAL : public TYPVAL<int> {
// Implementation
virtual bool SetValue_pval(PVAL valp, bool chktype);
- virtual void SetValue_char(char *p, int n);
+ virtual bool SetValue_char(char *p, int n);
virtual void SetValue_psz(PSZ s);
virtual void SetValue_pvblk(PVBLK blk, int n);
virtual char *GetCharString(char *p);
@@ -304,15 +279,15 @@ class DllExport DTVAL : public TYPVAL<int> {
bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
bool SetFormat(PGLOBAL g, PVAL valp);
bool IsFormatted(void) {return Pdtp != NULL;}
- bool GetTmMember(OPVAL op, int& mval);
- bool DateDiff(DTVAL *dtp, OPVAL op, int& tdif);
+// bool GetTmMember(OPVAL op, int& mval);
+// bool DateDiff(DTVAL *dtp, OPVAL op, int& tdif);
bool MakeTime(struct tm *ptm);
static void SetTimeShift(void);
static int GetShift(void) {return Shift;}
// Methods
bool MakeDate(PGLOBAL g, int *val, int nval);
- bool WeekNum(PGLOBAL g, int& nval);
+// bool WeekNum(PGLOBAL g, int& nval);
struct tm *GetGmTime(struct tm *);