mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Added to CONNECT the missing type TYPE_BIGINT (longlong).
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
#define TYPE_STRING 1
|
||||
#define TYPE_FLOAT 2
|
||||
#define TYPE_SHORT 3
|
||||
#define TYPE_BIGINT 5
|
||||
#define TYPE_LIST 6
|
||||
#define TYPE_INT 7
|
||||
|
||||
|
@@ -1075,6 +1075,9 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf)
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
pcf->Type= TYPE_DATE;
|
||||
break;
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
pcf->Type= TYPE_BIGINT;
|
||||
break;
|
||||
default:
|
||||
pcf->Type=TYPE_ERROR;
|
||||
} // endswitch type
|
||||
@@ -3509,6 +3512,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
||||
case MYSQL_TYPE_YEAR:
|
||||
case MYSQL_TYPE_NEWDATE:
|
||||
case MYSQL_TYPE_VARCHAR:
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
break; // Ok
|
||||
case MYSQL_TYPE_VAR_STRING:
|
||||
case MYSQL_TYPE_STRING:
|
||||
@@ -3518,7 +3522,6 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
||||
break; // To be checked
|
||||
case MYSQL_TYPE_TINY:
|
||||
case MYSQL_TYPE_BIT:
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
case MYSQL_TYPE_NULL:
|
||||
case MYSQL_TYPE_ENUM:
|
||||
case MYSQL_TYPE_SET:
|
||||
|
@@ -98,9 +98,12 @@ int MYSQLtoPLG(int mytype)
|
||||
break;
|
||||
case MYSQL_TYPE_LONG:
|
||||
case MYSQL_TYPE_INT24:
|
||||
case MYSQL_TYPE_ENUM: // ???
|
||||
type = TYPE_INT;
|
||||
break;
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
type = TYPE_BIGINT;
|
||||
break;
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
#if !defined(ALPHA)
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
|
@@ -113,6 +113,9 @@ PVBLK AllocValBlock(PGLOBAL g, void *mp, int type, int nval, int len,
|
||||
case TYPE_DATE: // ?????
|
||||
blkp = new(g) DATBLK(mp, nval);
|
||||
break;
|
||||
case TYPE_BIGINT:
|
||||
blkp = new(g) BIGBLK(mp, nval);
|
||||
break;
|
||||
case TYPE_FLOAT:
|
||||
blkp = new(g) DBLBLK(mp, nval, prec);
|
||||
break;
|
||||
@@ -233,6 +236,14 @@ int CHRBLK::GetIntValue(int n)
|
||||
return atol((char *)GetValPtrEx(n));
|
||||
} // end of GetIntValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* Return the value of the nth element converted to big int. */
|
||||
/***********************************************************************/
|
||||
longlong CHRBLK::GetBigintValue(int n)
|
||||
{
|
||||
return atoll((char *)GetValPtrEx(n));
|
||||
} // end of GetIntValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* Return the value of the nth element converted to double. */
|
||||
/***********************************************************************/
|
||||
@@ -1027,6 +1038,196 @@ void DATBLK::SetValue(PSZ p, int n)
|
||||
} // end of SetValue
|
||||
|
||||
|
||||
/* -------------------------- Class BIGBLK --------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
/* Constructor. */
|
||||
/***********************************************************************/
|
||||
BIGBLK::BIGBLK(void *mp, int nval)
|
||||
: VALBLK(mp, TYPE_BIGINT, nval), Lngp((longlong*&)Blkp)
|
||||
{
|
||||
} // end of BIGBLK constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* Initialization routine. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::Init(PGLOBAL g, bool check)
|
||||
{
|
||||
if (!Blkp)
|
||||
Blkp = PlugSubAlloc(g, NULL, Nval * sizeof(longlong));
|
||||
|
||||
Check = check;
|
||||
Global = g;
|
||||
} // end of Init
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set one value in a block. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetValue(PVAL valp, int n)
|
||||
{
|
||||
CheckParms(valp, n)
|
||||
Lngp[n] = valp->GetBigintValue();
|
||||
} // end of SetValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set one value in a block. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetValue(PSZ p, int n)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBTRACE)
|
||||
if (Check) {
|
||||
PGLOBAL& g = Global;
|
||||
strcpy(g->Message, MSG(BAD_SET_STRING));
|
||||
longjmp(g->jumper[g->jump_level], Type);
|
||||
} // endif Check
|
||||
#endif
|
||||
|
||||
Lngp[n] = atoll(p);
|
||||
} // end of SetValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set one value in a block if val is less than the current value. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetMin(PVAL valp, int n)
|
||||
{
|
||||
CheckParms(valp, n)
|
||||
longlong lval = valp->GetIntValue();
|
||||
longlong& lmin = Lngp[n];
|
||||
|
||||
if (lval < lmin)
|
||||
lmin = lval;
|
||||
|
||||
} // end of SetMin
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set one value in a block if val is greater than the current value. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetMax(PVAL valp, int n)
|
||||
{
|
||||
CheckParms(valp, n)
|
||||
longlong lval = valp->GetIntValue();
|
||||
longlong& lmax = Lngp[n];
|
||||
|
||||
if (lval > lmax)
|
||||
lmax = lval;
|
||||
|
||||
} // end of SetMax
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set one value in a block from a value in another block. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetValue(PVBLK pv, int n1, int n2)
|
||||
{
|
||||
CheckType(pv)
|
||||
|
||||
Lngp[n1] = ((BIGBLK*)pv)->Lngp[n2];
|
||||
} // end of SetValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* Set many values in a block from values in another block. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::SetValues(PVBLK pv, int k, int n)
|
||||
{
|
||||
CheckType(pv)
|
||||
longlong *lp = ((BIGBLK*)pv)->Lngp;
|
||||
|
||||
for (register int i = k; i < n; i++)
|
||||
Lngp[i] = lp[i];
|
||||
|
||||
} // end of SetValues
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function is used by class RESCOL when calculating COUNT. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::AddMinus1(PVBLK pv, int n1, int n2)
|
||||
{
|
||||
assert(Type == pv->GetType());
|
||||
Lngp[n1] += (((BIGBLK*)pv)->Lngp[n2] - 1);
|
||||
} // end of AddMinus1
|
||||
|
||||
/***********************************************************************/
|
||||
/* Move one value from i to j. */
|
||||
/***********************************************************************/
|
||||
void BIGBLK::Move(int i, int j)
|
||||
{
|
||||
Lngp[j] = Lngp[i];
|
||||
} // end of Move
|
||||
|
||||
/***********************************************************************/
|
||||
/* Compare a Value object with the nth value of the block. */
|
||||
/***********************************************************************/
|
||||
int BIGBLK::CompVal(PVAL vp, int n)
|
||||
{
|
||||
CheckParms(vp, n)
|
||||
longlong mlv = Lngp[n];
|
||||
longlong vlv = vp->GetBigintValue();
|
||||
|
||||
return (vlv > mlv) ? 1 : (vlv < mlv) ? (-1) : 0;
|
||||
} // end of CompVal
|
||||
|
||||
/***********************************************************************/
|
||||
/* Compare two values of the block. */
|
||||
/***********************************************************************/
|
||||
int BIGBLK::CompVal(int i1, int i2)
|
||||
{
|
||||
longlong lv1 = Lngp[i1];
|
||||
longlong lv2 = Lngp[i2];
|
||||
|
||||
return (lv1 > lv2) ? 1 : (lv1 < lv2) ? (-1) : 0;
|
||||
} // end of CompVal
|
||||
|
||||
/***********************************************************************/
|
||||
/* Get a pointer on the nth value of the block. */
|
||||
/***********************************************************************/
|
||||
void *BIGBLK::GetValPtr(int n)
|
||||
{
|
||||
CheckIndex(n)
|
||||
return Lngp + n;
|
||||
} // end of GetValPtr
|
||||
|
||||
/***********************************************************************/
|
||||
/* Get a pointer on the nth value of the block. */
|
||||
/***********************************************************************/
|
||||
void *BIGBLK::GetValPtrEx(int n)
|
||||
{
|
||||
CheckIndex(n)
|
||||
return Lngp + n;
|
||||
} // end of GetValPtrEx
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns index of matching value in block or -1. */
|
||||
/***********************************************************************/
|
||||
int BIGBLK::Find(PVAL vp)
|
||||
{
|
||||
CheckType(vp)
|
||||
int i;
|
||||
longlong n = vp->GetBigintValue();
|
||||
|
||||
for (i = 0; i < Nval; i++)
|
||||
if (n == Lngp[i])
|
||||
break;
|
||||
|
||||
return (i < Nval) ? i : (-1);
|
||||
} // end of Find
|
||||
|
||||
/***********************************************************************/
|
||||
/* Returns the length of the longest string in the block. */
|
||||
/***********************************************************************/
|
||||
int BIGBLK::GetMaxLength(void)
|
||||
{
|
||||
char buf[24];
|
||||
int i, n;
|
||||
|
||||
for (i = n = 0; i < Nval; i++) {
|
||||
sprintf(buf, "%lld", Lngp[i]);
|
||||
|
||||
n = max(n, (signed)strlen(buf));
|
||||
} // endfor i
|
||||
|
||||
return n;
|
||||
} // end of GetMaxLength
|
||||
|
||||
|
||||
/* -------------------------- Class DBLBLK --------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*************** Valblk H Declares Source Code File (.H) ***************/
|
||||
/* Name: VALBLK.H Version 1.6 */
|
||||
/* Name: VALBLK.H Version 1.7 */
|
||||
/* */
|
||||
/* (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 declares. */
|
||||
/***********************************************************************/
|
||||
@@ -42,6 +42,7 @@ class VALBLK : public BLOCK {
|
||||
virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n) = 0;
|
||||
virtual int GetIntValue(int n) = 0;
|
||||
virtual longlong GetBigintValue(int n) = 0;
|
||||
virtual double GetFloatValue(int n) = 0;
|
||||
virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;}
|
||||
virtual void Reset(int n) = 0;
|
||||
@@ -52,6 +53,7 @@ class VALBLK : public BLOCK {
|
||||
// Methods
|
||||
virtual void SetValue(short sval, int n) {assert(false);}
|
||||
virtual void SetValue(int lval, int n) {assert(false);}
|
||||
virtual void SetValue(longlong lval, int n) {assert(false);}
|
||||
virtual void SetValue(PSZ sp, int n) {assert(false);}
|
||||
virtual void SetValue(PVAL valp, int n) = 0;
|
||||
virtual void SetMin(PVAL valp, int n) = 0;
|
||||
@@ -98,6 +100,7 @@ class CHRBLK : public VALBLK {
|
||||
virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n);
|
||||
virtual int GetIntValue(int n);
|
||||
virtual longlong GetBigintValue(int n);
|
||||
virtual double GetFloatValue(int n);
|
||||
virtual void Reset(int n);
|
||||
virtual void SetPrec(int p) {Ci = (p != 0);}
|
||||
@@ -143,6 +146,7 @@ class STRBLK : public VALBLK {
|
||||
virtual PSZ GetCharValue(int n) {return Strp[n];}
|
||||
virtual short GetShortValue(int n) {return (short)atoi(Strp[n]);}
|
||||
virtual int GetIntValue(int n) {return atol(Strp[n]);}
|
||||
virtual longlong GetBigintValue(int n) {return atoll(Strp[n]);}
|
||||
virtual double GetFloatValue(int n) {return atof(Strp[n]);}
|
||||
virtual void Reset(int n) {Strp[n] = NULL;}
|
||||
|
||||
@@ -180,6 +184,7 @@ class SHRBLK : public VALBLK {
|
||||
//virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n) {return Shrp[n];}
|
||||
virtual int GetIntValue(int n) {return (int)Shrp[n];}
|
||||
virtual longlong GetBigintValue(int n) {return (longlong)Shrp[n];}
|
||||
virtual double GetFloatValue(int n) {return (double)Shrp[n];}
|
||||
virtual void Reset(int n) {Shrp[n] = 0;}
|
||||
|
||||
@@ -187,6 +192,7 @@ class SHRBLK : public VALBLK {
|
||||
virtual void SetValue(PSZ sp, int n);
|
||||
virtual void SetValue(short sval, int n) {Shrp[n] = sval;}
|
||||
virtual void SetValue(int lval, int n) {Shrp[n] = (short)lval;}
|
||||
virtual void SetValue(longlong lval, int n) {Shrp[n] = (short)lval;}
|
||||
virtual void SetValue(PVAL valp, int n);
|
||||
virtual void SetMin(PVAL valp, int n);
|
||||
virtual void SetMax(PVAL valp, int n);
|
||||
@@ -220,6 +226,7 @@ class LNGBLK : public VALBLK {
|
||||
//virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n) {return (short)Lngp[n];}
|
||||
virtual int GetIntValue(int n) {return Lngp[n];}
|
||||
virtual longlong GetBigintValue(int n) {return (longlong)Lngp[n];}
|
||||
virtual double GetFloatValue(int n) {return (double)Lngp[n];}
|
||||
virtual void Reset(int n) {Lngp[n] = 0;}
|
||||
|
||||
@@ -227,6 +234,7 @@ class LNGBLK : public VALBLK {
|
||||
virtual void SetValue(PSZ sp, int n);
|
||||
virtual void SetValue(short sval, int n) {Lngp[n] = (int)sval;}
|
||||
virtual void SetValue(int lval, int n) {Lngp[n] = lval;}
|
||||
virtual void SetValue(longlong lval, int n) {Lngp[n] = (int)lval;}
|
||||
virtual void SetValue(PVAL valp, int n);
|
||||
virtual void SetMin(PVAL valp, int n);
|
||||
virtual void SetMax(PVAL valp, int n);
|
||||
@@ -265,6 +273,48 @@ class DATBLK : public LNGBLK {
|
||||
PVAL Dvalp; // Date value used to convert string
|
||||
}; // end of class DATBLK
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class LNGBLK: represents a block of int integer values. */
|
||||
/***********************************************************************/
|
||||
class BIGBLK : public VALBLK {
|
||||
public:
|
||||
// Constructors
|
||||
BIGBLK(void *mp, int size);
|
||||
|
||||
// Implementation
|
||||
virtual void Init(PGLOBAL g, bool check);
|
||||
virtual int GetVlen(void) {return sizeof(longlong);}
|
||||
//virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n) {return (short)Lngp[n];}
|
||||
virtual int GetIntValue(int n) {return (int)Lngp[n];}
|
||||
virtual longlong GetBigintValue(int n) {return Lngp[n];}
|
||||
virtual double GetFloatValue(int n) {return (double)Lngp[n];}
|
||||
virtual void Reset(int n) {Lngp[n] = 0LL;}
|
||||
|
||||
// Methods
|
||||
virtual void SetValue(PSZ sp, int n);
|
||||
virtual void SetValue(short sval, int n) {Lngp[n] = (longlong)sval;}
|
||||
virtual void SetValue(int lval, int n) {Lngp[n] = (longlong)lval;}
|
||||
virtual void SetValue(longlong lval, int n) {Lngp[n] = lval;}
|
||||
virtual void SetValue(PVAL valp, int n);
|
||||
virtual void SetMin(PVAL valp, int n);
|
||||
virtual void SetMax(PVAL valp, int n);
|
||||
virtual void SetValue(PVBLK pv, int n1, int n2);
|
||||
virtual void SetValues(PVBLK pv, int k, int n);
|
||||
virtual void AddMinus1(PVBLK pv, int n1, int n2);
|
||||
virtual void Move(int i, int j);
|
||||
virtual int CompVal(PVAL vp, int n);
|
||||
virtual int CompVal(int i1, int i2);
|
||||
virtual void *GetValPtr(int n);
|
||||
virtual void *GetValPtrEx(int n);
|
||||
virtual int Find(PVAL vp);
|
||||
virtual int GetMaxLength(void);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
longlong* const &Lngp;
|
||||
}; // end of class BIGBLK
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class DBLBLK: represents a block of double float values. */
|
||||
/***********************************************************************/
|
||||
@@ -279,6 +329,7 @@ class DBLBLK : public VALBLK {
|
||||
//virtual PSZ GetCharValue(int n);
|
||||
virtual short GetShortValue(int n) {return (short)Dblp[n];}
|
||||
virtual int GetIntValue(int n) {return (int)Dblp[n];}
|
||||
virtual longlong GetBigintValue(int n) {return (longlong)Dblp[n];}
|
||||
virtual double GetFloatValue(int n) {return Dblp[n];}
|
||||
virtual void Reset(int n) {Dblp[n] = 0.0;}
|
||||
virtual void SetPrec(int p) {Prec = p;}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/**************** Value H Declares Source Code File (.H) ***************/
|
||||
/* Name: VALUE.H Version 1.6 */
|
||||
/* Name: VALUE.H Version 1.7 */
|
||||
/* */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2012 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2013 */
|
||||
/* */
|
||||
/* This file contains the VALUE and derived classes declares. */
|
||||
/***********************************************************************/
|
||||
@@ -16,6 +16,11 @@
|
||||
#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. */
|
||||
/***********************************************************************/
|
||||
@@ -72,6 +77,7 @@ class DllExport VALUE : public BLOCK {
|
||||
virtual PSZ GetCharValue(void) {assert(false); return NULL;}
|
||||
virtual short GetShortValue(void) {assert(false); return 0;}
|
||||
virtual int GetIntValue(void) = 0;
|
||||
virtual longlong GetBigintValue(void) = 0;
|
||||
virtual double GetFloatValue(void) = 0;
|
||||
virtual void *GetTo_Val(void) = 0;
|
||||
int GetType(void) {return Type;}
|
||||
@@ -85,6 +91,7 @@ class DllExport VALUE : public BLOCK {
|
||||
virtual void SetValue_bool(bool b) {assert(false);}
|
||||
virtual void SetValue(short i) {assert(false);}
|
||||
virtual void SetValue(int n) {assert(false);}
|
||||
virtual void SetValue(longlong n) {assert(false);}
|
||||
virtual void SetValue(double f) {assert(false);}
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n) = 0;
|
||||
virtual void SetBinValue(void *p) = 0;
|
||||
@@ -116,6 +123,7 @@ class DllExport VALUE : public BLOCK {
|
||||
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 bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) = 0;
|
||||
virtual int GetTime(PGLOBAL g, PVAL *vp, int np) = 0;
|
||||
@@ -145,6 +153,7 @@ class STRING : public VALUE {
|
||||
STRING(PGLOBAL g, PSZ s, int n, int c = 0);
|
||||
STRING(PGLOBAL g, short i);
|
||||
STRING(PGLOBAL g, int n);
|
||||
STRING(PGLOBAL g, longlong n);
|
||||
STRING(PGLOBAL g, double f);
|
||||
|
||||
// Implementation
|
||||
@@ -159,6 +168,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 double GetFloatValue(void) {return atof(Strp);}
|
||||
virtual void *GetTo_Val(void) {return Strp;}
|
||||
|
||||
@@ -169,6 +179,7 @@ class STRING : public VALUE {
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n);
|
||||
virtual void SetValue(short i);
|
||||
virtual void SetValue(int n);
|
||||
virtual void SetValue(longlong n);
|
||||
virtual void SetValue(double f);
|
||||
virtual void SetBinValue(void *p);
|
||||
virtual bool GetBinValue(void *buf, int buflen, bool go);
|
||||
@@ -177,6 +188,7 @@ class STRING : public VALUE {
|
||||
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 bool IsEqual(PVAL vp, bool chktype);
|
||||
virtual int CompareValue(PVAL vp);
|
||||
@@ -215,6 +227,7 @@ class SHVAL : public VALUE {
|
||||
SHVAL(PSZ s);
|
||||
SHVAL(short n);
|
||||
SHVAL(int n);
|
||||
SHVAL(longlong n);
|
||||
SHVAL(double f);
|
||||
|
||||
// Implementation
|
||||
@@ -227,6 +240,7 @@ class SHVAL : public VALUE {
|
||||
//virtual PSZ GetCharValue(void) {}
|
||||
virtual short GetShortValue(void) {return Sval;}
|
||||
virtual int GetIntValue(void) {return (int)Sval;}
|
||||
virtual longlong GetBigintValue(void) {return (longlong)Sval;}
|
||||
virtual double GetFloatValue(void) {return (double)Sval;}
|
||||
virtual void *GetTo_Val(void) {return &Sval;}
|
||||
|
||||
@@ -237,6 +251,7 @@ class SHVAL : public VALUE {
|
||||
virtual void SetValue_bool(bool b) {Sval = (b) ? 1 : 0;}
|
||||
virtual void SetValue(short i) {Sval = i;}
|
||||
virtual void SetValue(int n) {Sval = (short)n;}
|
||||
virtual void SetValue(longlong n) {Sval = (short)n;}
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n);
|
||||
virtual void SetBinValue(void *p);
|
||||
virtual bool GetBinValue(void *buf, int buflen, bool go);
|
||||
@@ -245,6 +260,7 @@ class SHVAL : public VALUE {
|
||||
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 bool IsEqual(PVAL vp, bool chktype);
|
||||
virtual int CompareValue(PVAL vp);
|
||||
@@ -293,6 +309,7 @@ class DllExport INTVAL : public VALUE {
|
||||
INTVAL(PSZ s);
|
||||
INTVAL(short i);
|
||||
INTVAL(int n);
|
||||
INTVAL(longlong n);
|
||||
INTVAL(double f);
|
||||
|
||||
// Implementation
|
||||
@@ -305,6 +322,7 @@ class DllExport INTVAL : public VALUE {
|
||||
//virtual PSZ GetCharValue(void) {}
|
||||
virtual short GetShortValue(void) {return (short)Ival;}
|
||||
virtual int GetIntValue(void) {return Ival;}
|
||||
virtual longlong GetBigintValue(void) {return (longlong)Ival;}
|
||||
virtual double GetFloatValue(void) {return (double)Ival;}
|
||||
virtual void *GetTo_Val(void) {return &Ival;}
|
||||
|
||||
@@ -315,6 +333,7 @@ class DllExport INTVAL : public VALUE {
|
||||
virtual void SetValue_bool(bool b) {Ival = (b) ? 1 : 0;}
|
||||
virtual void SetValue(short i) {Ival = (int)i;}
|
||||
virtual void SetValue(int n) {Ival = n;}
|
||||
virtual void SetValue(longlong n) {Ival = (int)n;}
|
||||
virtual void SetValue(double f) {Ival = (int)f;}
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n);
|
||||
virtual void SetBinValue(void *p);
|
||||
@@ -324,6 +343,7 @@ class DllExport INTVAL : public VALUE {
|
||||
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 bool IsEqual(PVAL vp, bool chktype);
|
||||
virtual int CompareValue(PVAL vp);
|
||||
@@ -373,6 +393,7 @@ class DllExport DTVAL : public INTVAL {
|
||||
DTVAL(PGLOBAL g, PSZ s, int n);
|
||||
DTVAL(PGLOBAL g, short i);
|
||||
DTVAL(PGLOBAL g, int n);
|
||||
DTVAL(PGLOBAL g, longlong n);
|
||||
DTVAL(PGLOBAL g, double f);
|
||||
|
||||
// Implementation
|
||||
@@ -413,6 +434,89 @@ class DllExport DTVAL : public INTVAL {
|
||||
int Len; // Used by CHAR scalar function
|
||||
}; // end of class DTVAL
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class BIGVAL: represents bigint integer values. */
|
||||
/***********************************************************************/
|
||||
class DllExport BIGVAL : public VALUE {
|
||||
public:
|
||||
// Constructors
|
||||
BIGVAL(PSZ s);
|
||||
BIGVAL(short i);
|
||||
BIGVAL(int n);
|
||||
BIGVAL(longlong n);
|
||||
BIGVAL(double f);
|
||||
|
||||
// Implementation
|
||||
virtual bool IsTypeNum(void) {return true;}
|
||||
virtual bool IsZero(void) {return Lval == 0;}
|
||||
virtual void Reset(void) {Lval = 0;}
|
||||
virtual int GetValLen(void);
|
||||
virtual int GetValPrec() {return 0;}
|
||||
virtual int GetSize(void) {return sizeof(longlong);}
|
||||
//virtual PSZ GetCharValue(void) {}
|
||||
virtual short GetShortValue(void) {return (short)Lval;}
|
||||
virtual int GetIntValue(void) {return (int)Lval;}
|
||||
virtual longlong GetBigintValue(void) {return Lval;}
|
||||
virtual double GetFloatValue(void) {return (double)Lval;}
|
||||
virtual void *GetTo_Val(void) {return &Lval;}
|
||||
|
||||
// Methods
|
||||
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(short i) {Lval = (longlong)i;}
|
||||
virtual void SetValue(int n) {Lval = (longlong)n;}
|
||||
virtual void SetValue(longlong n) {Lval = n;}
|
||||
virtual void SetValue(double f) {Lval = (longlong)f;}
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n);
|
||||
virtual void SetBinValue(void *p);
|
||||
virtual bool GetBinValue(void *buf, int buflen, bool go);
|
||||
virtual void GetBinValue(void *buf, int len);
|
||||
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 bool IsEqual(PVAL vp, bool chktype);
|
||||
virtual int CompareValue(PVAL vp);
|
||||
virtual void Divide(int cnt);
|
||||
virtual void StdVar(PVAL vp, int cnt, bool b);
|
||||
virtual void Add(int lv) {Lval += (longlong)lv;}
|
||||
virtual void Add(PVAL vp);
|
||||
virtual void Add(PVBLK vbp, int i);
|
||||
virtual void Add(PVBLK vbp, int j, int k);
|
||||
virtual void Add(PVBLK vbp, int *x, int j, int k);
|
||||
virtual void AddSquare(PVAL vp);
|
||||
virtual void AddSquare(PVBLK vbp, int i);
|
||||
virtual void AddSquare(PVBLK vbp, int j, int k);
|
||||
virtual void Times(PVAL vp);
|
||||
virtual void SetMin(PVAL vp);
|
||||
virtual void SetMin(PVBLK vbp, int i);
|
||||
virtual void SetMin(PVBLK vbp, int j, int k);
|
||||
virtual void SetMin(PVBLK vbp, int *x, int j, int k);
|
||||
virtual void SetMax(PVAL vp);
|
||||
virtual void SetMax(PVBLK vbp, int i);
|
||||
virtual void SetMax(PVBLK vbp, int j, int k);
|
||||
virtual void SetMax(PVBLK vbp, int *x, int j, int k);
|
||||
virtual bool SetConstFormat(PGLOBAL, FORMAT&);
|
||||
virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
|
||||
virtual int GetTime(PGLOBAL g, PVAL *vp, int np) {return 0;}
|
||||
virtual bool FormatValue(PVAL vp, char *fmt);
|
||||
virtual void Print(PGLOBAL g, FILE *, uint);
|
||||
virtual void Print(PGLOBAL g, char *, uint);
|
||||
|
||||
protected:
|
||||
longlong SafeAdd(longlong n1, longlong n2);
|
||||
longlong SafeMult(longlong n1, longlong n2);
|
||||
// Default constructor not to be used
|
||||
BIGVAL(void) : VALUE(TYPE_ERROR) {}
|
||||
|
||||
// Members
|
||||
longlong Lval;
|
||||
}; // end of class BIGVAL
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class DFVAL: represents double float values. */
|
||||
/***********************************************************************/
|
||||
@@ -422,6 +526,7 @@ class DFVAL : public VALUE {
|
||||
DFVAL(PSZ s, int prec = 2);
|
||||
DFVAL(short i, int prec = 2);
|
||||
DFVAL(int n, int prec = 2);
|
||||
DFVAL(longlong n, int prec = 2);
|
||||
DFVAL(double f, int prec = 2);
|
||||
|
||||
// Implementation
|
||||
@@ -434,6 +539,7 @@ class DFVAL : public VALUE {
|
||||
//virtual PSZ GetCharValue(void) {}
|
||||
virtual short GetShortValue(void) {return (short)Fval;}
|
||||
virtual int GetIntValue(void) {return (int)Fval;}
|
||||
virtual longlong GetBigintValue(void) {return (longlong)Fval;}
|
||||
virtual double GetFloatValue(void) {return Fval;}
|
||||
virtual void *GetTo_Val(void) {return &Fval;}
|
||||
void SetPrec(int prec) {Prec = prec;}
|
||||
@@ -444,6 +550,7 @@ class DFVAL : public VALUE {
|
||||
virtual void SetValue_psz(PSZ s);
|
||||
virtual void SetValue(short i) {Fval = (double)i;}
|
||||
virtual void SetValue(int n) {Fval = (double)n;}
|
||||
virtual void SetValue(longlong n) {Fval = (double)n;}
|
||||
virtual void SetValue(double f) {Fval = f;}
|
||||
virtual void SetValue_pvblk(PVBLK blk, int n);
|
||||
virtual void SetBinValue(void *p);
|
||||
@@ -453,6 +560,7 @@ class DFVAL : public VALUE {
|
||||
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 bool IsEqual(PVAL vp, bool chktype);
|
||||
virtual int CompareValue(PVAL vp);
|
||||
|
Reference in New Issue
Block a user