2013-02-07 10:34:27 +01:00
|
|
|
/*************** Valblk H Declares Source Code File (.H) ***************/
|
2014-02-03 16:14:13 +01:00
|
|
|
/* Name: VALBLK.H Version 2.1 */
|
2013-02-07 10:34:27 +01:00
|
|
|
/* */
|
2014-02-03 16:14:13 +01:00
|
|
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
|
2013-02-07 10:34:27 +01:00
|
|
|
/* */
|
|
|
|
/* This file contains the VALBLK and derived classes declares. */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Include required application header files */
|
|
|
|
/* assert.h is header required when using the assert function. */
|
|
|
|
/* block.h is header containing Block global declarations. */
|
|
|
|
/***********************************************************************/
|
|
|
|
#ifndef __VALBLK__H__
|
|
|
|
#define __VALBLK__H__
|
|
|
|
#include "value.h"
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Utility used to allocate value blocks. */
|
|
|
|
/***********************************************************************/
|
2014-04-19 11:11:30 +02:00
|
|
|
DllExport PVBLK AllocValBlock(PGLOBAL, void*, int, int, int, int,
|
2013-11-26 11:47:48 +01:00
|
|
|
bool, bool, bool);
|
|
|
|
const char *GetFmt(int type, bool un = false);
|
2013-02-07 10:34:27 +01:00
|
|
|
|
2014-05-02 15:55:45 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/* DB static external variables. */
|
|
|
|
/***********************************************************************/
|
|
|
|
extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Class MBVALS is a utility class for (re)allocating VALBLK's. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class MBVALS : public BLOCK {
|
|
|
|
//friend class LSTBLK;
|
|
|
|
friend class ARRAY;
|
|
|
|
public:
|
|
|
|
// Constructors
|
|
|
|
MBVALS(void) {Vblk = NULL; Mblk = Nmblk;}
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void *GetMemp(void) {return Mblk.Memp;}
|
|
|
|
PVBLK Allocate(PGLOBAL g, int type, int len, int prec,
|
|
|
|
int n, bool sub = FALSE);
|
|
|
|
bool ReAllocate(PGLOBAL g, int n);
|
|
|
|
void Free(void);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Members
|
|
|
|
PVBLK Vblk; // Pointer to VALBLK
|
|
|
|
MBLOCK Mblk; // The memory block
|
|
|
|
}; // end of class MBVALS
|
|
|
|
|
|
|
|
typedef class MBVALS *PMBV;
|
|
|
|
|
2013-02-07 10:34:27 +01:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Class VALBLK represent a base class for variable blocks. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class VALBLK : public BLOCK {
|
|
|
|
public:
|
|
|
|
// Constructors
|
2013-11-26 11:47:48 +01:00
|
|
|
VALBLK(void *mp, int type, int nval, bool un = false);
|
2013-02-07 10:34:27 +01:00
|
|
|
|
|
|
|
// Implementation
|
|
|
|
int GetNval(void) {return Nval;}
|
|
|
|
void SetNval(int n) {Nval = n;}
|
|
|
|
void *GetValPointer(void) {return Blkp;}
|
|
|
|
void SetValPointer(void *mp) {Blkp = mp;}
|
|
|
|
int GetType(void) {return Type;}
|
2013-05-28 17:22:38 +02:00
|
|
|
int GetPrec(void) {return Prec;}
|
2013-02-07 10:34:27 +01:00
|
|
|
void SetCheck(bool b) {Check = b;}
|
2013-02-24 01:23:18 +01:00
|
|
|
void MoveNull(int i, int j)
|
|
|
|
{if (To_Nulls) To_Nulls[j] = To_Nulls[j];}
|
|
|
|
virtual void SetNull(int n, bool b)
|
|
|
|
{if (To_Nulls) {To_Nulls[n] = (b) ? '*' : 0;}}
|
|
|
|
virtual bool IsNull(int n) {return To_Nulls && To_Nulls[n];}
|
2016-02-15 23:41:59 +01:00
|
|
|
virtual bool IsNullable(void) {return Nullable;}
|
|
|
|
virtual void SetNullable(bool b);
|
2013-12-03 22:59:40 +01:00
|
|
|
virtual bool IsUnsigned(void) {return Unsigned;}
|
2014-04-05 19:26:32 +02:00
|
|
|
virtual bool Init(PGLOBAL g, bool check) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual int GetVlen(void) = 0;
|
|
|
|
virtual PSZ GetCharValue(int n);
|
2013-12-03 22:59:40 +01:00
|
|
|
virtual char GetTinyValue(int n) = 0;
|
|
|
|
virtual uchar GetUTinyValue(int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual short GetShortValue(int n) = 0;
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ushort GetUShortValue(int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual int GetIntValue(int n) = 0;
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual uint GetUIntValue(int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual longlong GetBigintValue(int n) = 0;
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ulonglong GetUBigintValue(int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual double GetFloatValue(int n) = 0;
|
2014-02-03 16:14:13 +01:00
|
|
|
virtual char *GetCharString(char *p, int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;}
|
|
|
|
virtual void Reset(int n) = 0;
|
|
|
|
virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
|
|
|
|
virtual void SetPrec(int p) {}
|
|
|
|
virtual bool IsCi(void) {return false;}
|
|
|
|
|
|
|
|
// Methods
|
2015-05-09 17:30:20 +02:00
|
|
|
virtual void SetValue(short, int) {assert(false);}
|
|
|
|
virtual void SetValue(ushort, int) {assert(false);}
|
|
|
|
virtual void SetValue(int, int) {assert(false);}
|
|
|
|
virtual void SetValue(uint, int) {assert(false);}
|
|
|
|
virtual void SetValue(longlong, int) {assert(false);}
|
|
|
|
virtual void SetValue(ulonglong, int) {assert(false);}
|
|
|
|
virtual void SetValue(double, int) {assert(false);}
|
|
|
|
virtual void SetValue(char, int) {assert(false);}
|
|
|
|
virtual void SetValue(uchar, int) {assert(false);}
|
|
|
|
virtual void SetValue(PSZ, int) {assert(false);}
|
|
|
|
virtual void SetValue(char *, uint, int) {assert(false);}
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void SetValue(PVAL valp, int n) = 0;
|
2013-02-24 01:23:18 +01:00
|
|
|
virtual void SetValue(PVBLK pv, int n1, int n2) = 0;
|
2014-04-19 11:11:30 +02:00
|
|
|
virtual void SetMin(PVAL valp, int n) = 0;
|
|
|
|
virtual void SetMax(PVAL valp, int n) = 0;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void Move(int i, int j) = 0;
|
|
|
|
virtual int CompVal(PVAL vp, int n) = 0;
|
|
|
|
virtual int CompVal(int i1, int i2) = 0;
|
|
|
|
virtual void *GetValPtr(int n) = 0;
|
|
|
|
virtual void *GetValPtrEx(int n) = 0;
|
|
|
|
virtual int Find(PVAL vp) = 0;
|
|
|
|
virtual int GetMaxLength(void) = 0;
|
|
|
|
bool Locate(PVAL vp, int& i);
|
|
|
|
|
|
|
|
protected:
|
2014-04-05 19:26:32 +02:00
|
|
|
bool AllocBuff(PGLOBAL g, size_t size);
|
2013-02-07 10:34:27 +01:00
|
|
|
void ChkIndx(int n);
|
|
|
|
void ChkTyp(PVAL v);
|
|
|
|
void ChkTyp(PVBLK vb);
|
|
|
|
|
|
|
|
// Members
|
|
|
|
PGLOBAL Global; // Used for messages and allocation
|
2014-04-05 19:26:32 +02:00
|
|
|
MBLOCK Mblk; // Used to allocate buffer
|
2013-02-24 01:23:18 +01:00
|
|
|
char *To_Nulls; // Null values array
|
2013-02-07 10:34:27 +01:00
|
|
|
void *Blkp; // To value block
|
|
|
|
bool Check; // If true SetValue types must match
|
2013-02-24 01:23:18 +01:00
|
|
|
bool Nullable; // True if values can be null
|
2013-11-26 11:47:48 +01:00
|
|
|
bool Unsigned; // True if values are unsigned
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
int Type; // Type of individual values
|
|
|
|
int Nval; // Max number of values in block
|
|
|
|
int Prec; // Precision of float values
|
2013-02-07 10:34:27 +01:00
|
|
|
}; // end of class VALBLK
|
|
|
|
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Class TYPBLK: represents a block of typed values. */
|
|
|
|
/***********************************************************************/
|
|
|
|
template <class TYPE>
|
|
|
|
class TYPBLK : public VALBLK {
|
|
|
|
public:
|
|
|
|
// Constructors
|
2013-11-26 11:47:48 +01:00
|
|
|
TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false);
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
|
|
|
|
// Implementation
|
2014-04-05 19:26:32 +02:00
|
|
|
virtual bool Init(PGLOBAL g, bool check);
|
2013-05-28 17:22:38 +02:00
|
|
|
virtual int GetVlen(void) {return sizeof(TYPE);}
|
2013-12-03 22:59:40 +01:00
|
|
|
virtual char GetTinyValue(int n) {return (char)Typp[n];}
|
|
|
|
virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual short GetShortValue(int n) {return (short)Typp[n];}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual int GetIntValue(int n) {return (int)Typp[n];}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual uint GetUIntValue(int n) {return (uint)Typp[n];}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual double GetFloatValue(int n) {return (double)Typp[n];}
|
2014-02-03 16:14:13 +01:00
|
|
|
virtual char *GetCharString(char *p, int n);
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void Reset(int n) {Typp[n] = 0;}
|
|
|
|
|
|
|
|
// Methods
|
2015-01-27 19:18:51 +01:00
|
|
|
using VALBLK::SetValue;
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(PSZ sp, int n);
|
2013-04-29 13:50:20 +02:00
|
|
|
virtual void SetValue(char *sp, uint len, int n);
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(short sval, int n)
|
|
|
|
{Typp[n] = (TYPE)sval; SetNull(n, false);}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual void SetValue(ushort sval, int n)
|
|
|
|
{Typp[n] = (TYPE)sval; SetNull(n, false);}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(int lval, int n)
|
|
|
|
{Typp[n] = (TYPE)lval; SetNull(n, false);}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual void SetValue(uint lval, int n)
|
|
|
|
{Typp[n] = (TYPE)lval; SetNull(n, false);}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(longlong lval, int n)
|
|
|
|
{Typp[n] = (TYPE)lval; SetNull(n, false);}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual void SetValue(ulonglong lval, int n)
|
|
|
|
{Typp[n] = (TYPE)lval; SetNull(n, false);}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(double fval, int n)
|
|
|
|
{Typp[n] = (TYPE)fval; SetNull(n, false);}
|
2013-03-11 16:52:59 +01:00
|
|
|
virtual void SetValue(char cval, int n)
|
|
|
|
{Typp[n] = (TYPE)cval; SetNull(n, false);}
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual void SetValue(uchar cval, int n)
|
|
|
|
{Typp[n] = (TYPE)cval; SetNull(n, false);}
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
virtual void SetValue(PVAL valp, int n);
|
|
|
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
2014-04-19 11:11:30 +02:00
|
|
|
virtual void SetMin(PVAL valp, int n);
|
|
|
|
virtual void SetMax(PVAL valp, int n);
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
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:
|
|
|
|
// Specialized functions
|
2013-12-03 22:59:40 +01:00
|
|
|
static ulonglong MaxVal(void);
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
TYPE GetTypedValue(PVAL vp);
|
|
|
|
TYPE GetTypedValue(PVBLK blk, int n);
|
|
|
|
|
|
|
|
// Members
|
|
|
|
TYPE* const &Typp;
|
|
|
|
const char *Fmt;
|
|
|
|
}; // end of class TYPBLK
|
|
|
|
|
2013-02-07 10:34:27 +01:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Class CHRBLK: represent a block of fixed length strings. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class CHRBLK : public VALBLK {
|
|
|
|
public:
|
|
|
|
// Constructors
|
|
|
|
CHRBLK(void *mp, int size, int len, int prec, bool b);
|
|
|
|
|
|
|
|
// Implementation
|
2014-04-05 19:26:32 +02:00
|
|
|
virtual bool Init(PGLOBAL g, bool check);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual int GetVlen(void) {return Long;}
|
|
|
|
virtual PSZ GetCharValue(int n);
|
2013-12-03 22:59:40 +01:00
|
|
|
virtual char GetTinyValue(int n);
|
|
|
|
virtual uchar GetUTinyValue(int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual short GetShortValue(int n);
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ushort GetUShortValue(int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual int GetIntValue(int n);
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual uint GetUIntValue(int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual longlong GetBigintValue(int n);
|
2013-11-26 11:47:48 +01:00
|
|
|
virtual ulonglong GetUBigintValue(int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual double GetFloatValue(int n);
|
2014-02-03 16:14:13 +01:00
|
|
|
virtual char *GetCharString(char *p, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void Reset(int n);
|
|
|
|
virtual void SetPrec(int p) {Ci = (p != 0);}
|
|
|
|
virtual bool IsCi(void) {return Ci;}
|
|
|
|
|
|
|
|
// Methods
|
2015-01-27 19:18:51 +01:00
|
|
|
using VALBLK::SetValue;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void SetValue(PSZ sp, int n);
|
2013-04-29 13:50:20 +02:00
|
|
|
virtual void SetValue(char *sp, uint len, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void SetValue(PVAL valp, int n);
|
2013-02-24 01:23:18 +01:00
|
|
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
2014-04-19 11:11:30 +02:00
|
|
|
virtual void SetMin(PVAL valp, int n);
|
|
|
|
virtual void SetMax(PVAL valp, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
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
|
2014-04-19 11:11:30 +02:00
|
|
|
char* const &Chrp; // Pointer to char buffer
|
|
|
|
PSZ Valp; // Used to make a zero ended value
|
|
|
|
bool Blanks; // True for right filling with blanks
|
|
|
|
bool Ci; // True if case insensitive
|
|
|
|
int Long; // Length of each string
|
2013-02-07 10:34:27 +01:00
|
|
|
}; // end of class CHRBLK
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Class STRBLK: represent a block of string pointers. */
|
|
|
|
/* Currently this class is used only by the DECODE scalar function */
|
|
|
|
/* and by the MyColumn function to store date formats. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class STRBLK : public VALBLK {
|
|
|
|
public:
|
|
|
|
// Constructors
|
|
|
|
STRBLK(PGLOBAL g, void *mp, int size);
|
|
|
|
|
|
|
|
// Implementation
|
2013-02-24 01:23:18 +01:00
|
|
|
virtual void SetNull(int n, bool b) {if (b) {Strp[n] = NULL;}}
|
|
|
|
virtual bool IsNull(int n) {return Strp[n] == NULL;}
|
2015-05-09 17:30:20 +02:00
|
|
|
virtual void SetNullable(bool) {} // Always nullable
|
2014-04-05 19:26:32 +02:00
|
|
|
virtual bool Init(PGLOBAL g, bool check);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual int GetVlen(void) {return sizeof(PSZ);}
|
|
|
|
virtual PSZ GetCharValue(int n) {return Strp[n];}
|
2013-12-03 22:59:40 +01:00
|
|
|
virtual char GetTinyValue(int n);
|
|
|
|
virtual uchar GetUTinyValue(int n);
|
|
|
|
virtual short GetShortValue(int n);
|
|
|
|
virtual ushort GetUShortValue(int n);
|
|
|
|
virtual int GetIntValue(int n);
|
|
|
|
virtual uint GetUIntValue(int n);
|
|
|
|
virtual longlong GetBigintValue(int n);
|
|
|
|
virtual ulonglong GetUBigintValue(int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual double GetFloatValue(int n) {return atof(Strp[n]);}
|
2015-05-09 17:30:20 +02:00
|
|
|
virtual char *GetCharString(char *, int n) {return Strp[n];}
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void Reset(int n) {Strp[n] = NULL;}
|
|
|
|
|
|
|
|
// Methods
|
2015-01-27 19:18:51 +01:00
|
|
|
using VALBLK::SetValue;
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void SetValue(PSZ sp, int n);
|
2013-04-29 13:50:20 +02:00
|
|
|
virtual void SetValue(char *sp, uint len, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
virtual void SetValue(PVAL valp, int n);
|
2013-02-24 01:23:18 +01:00
|
|
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
2014-04-19 11:11:30 +02:00
|
|
|
virtual void SetMin(PVAL valp, int n);
|
|
|
|
virtual void SetMax(PVAL valp, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
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);
|
|
|
|
|
2013-12-16 01:32:47 +01:00
|
|
|
// Specific
|
|
|
|
void SetSorted(bool b) {Sorted = b;}
|
|
|
|
|
2013-02-07 10:34:27 +01:00
|
|
|
protected:
|
|
|
|
// Members
|
|
|
|
PSZ* const &Strp; // Pointer to PSZ buffer
|
2013-12-16 01:32:47 +01:00
|
|
|
bool Sorted; // Values are (semi?) sorted
|
2013-02-07 10:34:27 +01:00
|
|
|
}; // end of class STRBLK
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Class DATBLK: represents a block of time stamp values. */
|
|
|
|
/***********************************************************************/
|
- Rewrite some VALBLK classes as templates
- Correct typo initializing datm in DTVAL::MakeDate as {0,0,0,2,0,70,0,0,0}
instead of {0,0,0,1,0,70,0,0,0}
modified:
storage/connect/valblk.cpp
storage/connect/valblk.h
storage/connect/value.cpp
storage/connect/value.h
2013-03-01 22:23:40 +01:00
|
|
|
class DATBLK : public TYPBLK<int> {
|
2013-02-07 10:34:27 +01:00
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
DATBLK(void *mp, int size);
|
|
|
|
|
|
|
|
// Implementation
|
2014-02-03 16:14:13 +01:00
|
|
|
virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
|
|
|
|
virtual char *GetCharString(char *p, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
|
|
|
|
// Methods
|
2015-01-27 19:18:51 +01:00
|
|
|
using TYPBLK<int>::SetValue;
|
2014-02-03 16:14:13 +01:00
|
|
|
virtual void SetValue(PSZ sp, int n);
|
2013-02-07 10:34:27 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Members
|
|
|
|
PVAL Dvalp; // Date value used to convert string
|
|
|
|
}; // end of class DATBLK
|
|
|
|
|
2014-08-07 17:59:21 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/* Class PTRBLK: represent a block of char pointers. */
|
|
|
|
/* Currently this class is used only by the ARRAY class to make and */
|
|
|
|
/* sort a list of char pointers. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class PTRBLK : public STRBLK {
|
|
|
|
friend class ARRAY;
|
|
|
|
friend PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
|
|
|
|
bool, bool, bool);
|
|
|
|
protected:
|
|
|
|
// Constructors
|
|
|
|
PTRBLK(PGLOBAL g, void *mp, int size) : STRBLK(g, mp, size) {}
|
|
|
|
|
|
|
|
// Implementation
|
|
|
|
|
|
|
|
// Methods
|
2015-01-27 19:18:51 +01:00
|
|
|
using STRBLK::SetValue;
|
|
|
|
using STRBLK::CompVal;
|
2014-08-07 17:59:21 +02:00
|
|
|
virtual void SetValue(PSZ p, int n) {Strp[n] = p;}
|
|
|
|
virtual int CompVal(int i1, int i2);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Members
|
|
|
|
}; // end of class PTRBLK
|
|
|
|
|
2013-02-07 10:34:27 +01:00
|
|
|
#endif // __VALBLK__H__
|
|
|
|
|