mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
- NOTE: an experimental implementation of MRR was done but not kept
in this version. Sure enough, it never caused any improvement in the execution speed and rather caused a small increase of execution time. This is probably because values are sorted by rowid in each range of CONNECT indexes. This could be reconsidered if a customer have a need for processing very big files. - Fix a bug in ha_connect::CheckCond. The negated form of BETWEEN and IS NULL operators was not recognized. modified: storage/connect/ha_connect.cc - Add long jump initialization in CntReadNext. This was causing a server crash when an error occured in a ReadColumn. modified: storage/connect/connect.cc - General cleanup of CONNECT source code eliminating all code not used by CONNECT, including the MRR test code (saved separately). modified: storage/connect/catalog.h storage/connect/colblk.cpp storage/connect/colblk.h storage/connect/connect.cc storage/connect/connect.h storage/connect/domdoc.h storage/connect/filamap.cpp storage/connect/filamap.h storage/connect/filamdbf.h storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/filamtxt.h storage/connect/filamvct.cpp storage/connect/filamvct.h storage/connect/filamzip.cpp storage/connect/filamzip.h storage/connect/global.h storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/myconn.h storage/connect/plgcnx.h storage/connect/plgdbsem.h storage/connect/plugutil.c storage/connect/preparse.h storage/connect/reldef.cpp storage/connect/reldef.h storage/connect/tabcol.h storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabfix.cpp storage/connect/tabfmt.cpp storage/connect/tabfmt.h storage/connect/table.cpp storage/connect/tabmac.h storage/connect/tabmul.h storage/connect/tabmysql.cpp storage/connect/tabmysql.h storage/connect/taboccur.h storage/connect/tabodbc.cpp storage/connect/tabodbc.h storage/connect/tabsys.cpp storage/connect/tabsys.h storage/connect/tabtbl.cpp storage/connect/tabtbl.h storage/connect/tabutil.h storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/tabwmi.cpp storage/connect/tabwmi.h storage/connect/tabxml.cpp storage/connect/tabxml.h storage/connect/user_connect.cc storage/connect/user_connect.h storage/connect/valblk.cpp storage/connect/valblk.h storage/connect/value.cpp storage/connect/value.h storage/connect/xindex.cpp storage/connect/xindex.h storage/connect/xobject.cpp storage/connect/xobject.h storage/connect/xtable.h
This commit is contained in:
@ -43,7 +43,6 @@ typedef struct _colinfo {
|
|||||||
int Key;
|
int Key;
|
||||||
int Precision;
|
int Precision;
|
||||||
int Scale;
|
int Scale;
|
||||||
int Opt;
|
|
||||||
char *Remark;
|
char *Remark;
|
||||||
char *Datefmt;
|
char *Datefmt;
|
||||||
char *Fieldfmt;
|
char *Fieldfmt;
|
||||||
|
@ -36,7 +36,6 @@ COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
|
|||||||
if ((Cdp = cdp)) {
|
if ((Cdp = cdp)) {
|
||||||
Name = cdp->Name;
|
Name = cdp->Name;
|
||||||
Format = cdp->F;
|
Format = cdp->F;
|
||||||
Opt = cdp->Opt;
|
|
||||||
Long = cdp->Long;
|
Long = cdp->Long;
|
||||||
Precision = cdp->Precision;
|
Precision = cdp->Precision;
|
||||||
Buf_Type = cdp->Buf_Type;
|
Buf_Type = cdp->Buf_Type;
|
||||||
@ -46,7 +45,6 @@ COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
|
|||||||
} else {
|
} else {
|
||||||
Name = NULL;
|
Name = NULL;
|
||||||
memset(&Format, 0, sizeof(FORMAT));
|
memset(&Format, 0, sizeof(FORMAT));
|
||||||
Opt = 0;
|
|
||||||
Long = 0;
|
Long = 0;
|
||||||
Precision = 0;
|
Precision = 0;
|
||||||
Buf_Type = TYPE_ERROR;
|
Buf_Type = TYPE_ERROR;
|
||||||
@ -122,14 +120,6 @@ bool COLBLK::SetFormat(PGLOBAL g, FORMAT& fmt)
|
|||||||
return false;
|
return false;
|
||||||
} // end of SetFormat
|
} // end of SetFormat
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* CheckColumn: a column descriptor is found, say it by returning 1. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int COLBLK::CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &p, int &ag)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
} // end of CheckColumn
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Eval: get the column value from the last read record or from a */
|
/* Eval: get the column value from the last read record or from a */
|
||||||
/* matching Index column if there is one. */
|
/* matching Index column if there is one. */
|
||||||
@ -154,15 +144,6 @@ bool COLBLK::Eval(PGLOBAL g)
|
|||||||
return false;
|
return false;
|
||||||
} // end of Eval
|
} // end of Eval
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* CheckSort: */
|
|
||||||
/* Used to check that a table is involved in the sort list items. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool COLBLK::CheckSort(PTDB tdbp)
|
|
||||||
{
|
|
||||||
return (tdbp == To_Tdb);
|
|
||||||
} // end of CheckSort
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* InitValue: prepare a column block for read operation. */
|
/* InitValue: prepare a column block for read operation. */
|
||||||
/* Now we use Format.Length for the len parameter to avoid strings */
|
/* Now we use Format.Length for the len parameter to avoid strings */
|
||||||
|
@ -39,7 +39,6 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
PCOL GetNext(void) {return Next;}
|
PCOL GetNext(void) {return Next;}
|
||||||
PSZ GetName(void) {return Name;}
|
PSZ GetName(void) {return Name;}
|
||||||
int GetIndex(void) {return Index;}
|
int GetIndex(void) {return Index;}
|
||||||
int GetOpt(void) {return Opt;}
|
|
||||||
ushort GetColUse(void) {return ColUse;}
|
ushort GetColUse(void) {return ColUse;}
|
||||||
ushort GetColUse(ushort u) {return (ColUse & u);}
|
ushort GetColUse(ushort u) {return (ColUse & u);}
|
||||||
ushort GetStatus(void) {return Status;}
|
ushort GetStatus(void) {return Status;}
|
||||||
@ -49,9 +48,6 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
void AddColUse(ushort u) {ColUse |= u;}
|
void AddColUse(ushort u) {ColUse |= u;}
|
||||||
void AddStatus(ushort u) {Status |= u;}
|
void AddStatus(ushort u) {Status |= u;}
|
||||||
void SetNext(PCOL cp) {Next = cp;}
|
void SetNext(PCOL cp) {Next = cp;}
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
PXCOL GetKcol(void) {return To_Kcol;}
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
void SetKcol(PXCOL kcp) {To_Kcol = kcp;}
|
void SetKcol(PXCOL kcp) {To_Kcol = kcp;}
|
||||||
PCOLDEF GetCdp(void) {return Cdp;}
|
PCOLDEF GetCdp(void) {return Cdp;}
|
||||||
PSZ GetDomain(void) {return (Cdp) ? Cdp->Decode : NULL;}
|
PSZ GetDomain(void) {return (Cdp) ? Cdp->Decode : NULL;}
|
||||||
@ -65,10 +61,7 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual bool Compare(PXOB xp);
|
virtual bool Compare(PXOB xp);
|
||||||
virtual bool SetFormat(PGLOBAL, FORMAT&);
|
virtual bool SetFormat(PGLOBAL, FORMAT&);
|
||||||
virtual int CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &xp, int &ag);
|
|
||||||
virtual bool IsSpecial(void) {return false;}
|
virtual bool IsSpecial(void) {return false;}
|
||||||
virtual int CheckSpcCol(PTDB tdbp, int n) {return 2;}
|
|
||||||
virtual bool CheckSort(PTDB tdbp);
|
|
||||||
virtual bool Eval(PGLOBAL g);
|
virtual bool Eval(PGLOBAL g);
|
||||||
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
||||||
virtual void SetTo_Val(PVAL valp) {}
|
virtual void SetTo_Val(PVAL valp) {}
|
||||||
@ -76,8 +69,6 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
virtual void Print(PGLOBAL g, FILE *, uint);
|
virtual void Print(PGLOBAL g, FILE *, uint);
|
||||||
virtual void Print(PGLOBAL g, char *, uint);
|
virtual void Print(PGLOBAL g, char *, uint);
|
||||||
virtual bool VarSize(void) {return false;}
|
|
||||||
virtual bool IsColInside(PCOL colp) {return this == colp;}
|
|
||||||
bool InitValue(PGLOBAL g);
|
bool InitValue(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -90,7 +81,6 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
bool Nullable; // True if nullable
|
bool Nullable; // True if nullable
|
||||||
bool Unsigned; // True if unsigned
|
bool Unsigned; // True if unsigned
|
||||||
int Index; // Column number in table
|
int Index; // Column number in table
|
||||||
int Opt; // Cluster/sort information
|
|
||||||
int Buf_Type; // Data type
|
int Buf_Type; // Data type
|
||||||
int Long; // Internal length in table
|
int Long; // Internal length in table
|
||||||
int Precision; // Column length (as for ODBC)
|
int Precision; // Column length (as for ODBC)
|
||||||
@ -153,8 +143,6 @@ class DllExport FIDBLK : public SPCBLK {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void) {} // This is a pseudo constant column
|
virtual void Reset(void) {} // This is a pseudo constant column
|
||||||
virtual int CheckSpcCol(PTDB tdbp, int n)
|
|
||||||
{return (n == 2 && tdbp == To_Tdb) ? 1 : 2;}
|
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -174,8 +162,6 @@ class DllExport TIDBLK : public SPCBLK {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void) {} // This is a pseudo constant column
|
virtual void Reset(void) {} // This is a pseudo constant column
|
||||||
virtual int CheckSpcCol(PTDB tdbp, int n)
|
|
||||||
{return (n == 3 && tdbp == To_Tdb) ? 1 : 2;}
|
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -199,8 +185,6 @@ class DllExport SIDBLK : public SPCBLK {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void) {} // This is a pseudo constant column
|
virtual void Reset(void) {} // This is a pseudo constant column
|
||||||
virtual int CheckSpcCol(PTDB tdbp, int n)
|
|
||||||
{return (n == 3 && tdbp == To_Tdb) ? 1 : 2;}
|
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -415,11 +415,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
|
|||||||
colp->Reset();
|
colp->Reset();
|
||||||
|
|
||||||
// Virtual columns are computed by MariaDB
|
// Virtual columns are computed by MariaDB
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
if (!colp->GetColUse(U_VIRTUAL) && (!mrr || colp->GetKcol()))
|
|
||||||
#else // !MRRBKA_SUPPORT
|
|
||||||
if (!colp->GetColUse(U_VIRTUAL))
|
if (!colp->GetColUse(U_VIRTUAL))
|
||||||
#endif // !MRRBKA_SUPPORT
|
|
||||||
if (colp->Eval(g))
|
if (colp->Eval(g))
|
||||||
rc= RC_FX;
|
rc= RC_FX;
|
||||||
|
|
||||||
@ -433,7 +429,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ReadNext: Read next record sequentially. */
|
/* ReadNext: Read next record sequentially. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
||||||
{
|
{
|
||||||
RCODE rc;
|
RCODE rc;
|
||||||
|
|
||||||
@ -449,8 +445,21 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
|||||||
((PTDBASE)tdbp)->SetKindex(NULL);
|
((PTDBASE)tdbp)->SetKindex(NULL);
|
||||||
} // endif index
|
} // endif index
|
||||||
|
|
||||||
|
// Save stack and allocation environment and prepare error return
|
||||||
|
if (g->jump_level == MAX_JUMP) {
|
||||||
|
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
||||||
|
return RC_FX;
|
||||||
|
} // endif jump_level
|
||||||
|
|
||||||
|
if ((setjmp(g->jumper[++g->jump_level])) != 0) {
|
||||||
|
rc= RC_FX;
|
||||||
|
goto err;
|
||||||
|
} // endif rc
|
||||||
|
|
||||||
while ((rc= (RCODE)tdbp->ReadDB(g)) == RC_NF) ;
|
while ((rc= (RCODE)tdbp->ReadDB(g)) == RC_NF) ;
|
||||||
|
|
||||||
|
err:
|
||||||
|
g->jump_level--;
|
||||||
return (rc != RC_OK) ? rc : EvalColumns(g, tdbp);
|
return (rc != RC_OK) ? rc : EvalColumns(g, tdbp);
|
||||||
} // end of CntReadNext
|
} // end of CntReadNext
|
||||||
|
|
||||||
@ -572,7 +581,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
printf("About to reset opt\n");
|
printf("About to reset indexes\n");
|
||||||
|
|
||||||
// Make all the eventual indexes
|
// Make all the eventual indexes
|
||||||
tbxp= (TDBDOX*)tdbp;
|
tbxp= (TDBDOX*)tdbp;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
/* Name: CONNECT.H Version 2.4 */
|
/* Name: CONNECT.H Version 2.4 */
|
||||||
/* This file contains the some based classes declares. */
|
/* This file contains the some based classes declares. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
//#include "xtable.h" // Base class declares
|
|
||||||
#include "filamtxt.h"
|
#include "filamtxt.h"
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
|
|
||||||
@ -52,8 +51,6 @@ PGLOBAL CntExit(PGLOBAL g);
|
|||||||
/* These classes purpose is chiefly to access protected items! */
|
/* These classes purpose is chiefly to access protected items! */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DOXDEF: public DOSDEF {
|
class DOXDEF: public DOSDEF {
|
||||||
//friend class TDBDOX;
|
|
||||||
//friend int MakeIndex(PGLOBAL, PTDB, PIXDEF);
|
|
||||||
friend int CntIndexInit(PGLOBAL, PTDB, int);
|
friend int CntIndexInit(PGLOBAL, PTDB, int);
|
||||||
}; // end of class DOXDEF
|
}; // end of class DOXDEF
|
||||||
|
|
||||||
@ -74,10 +71,7 @@ class TDBDOX: public TDBDOS {
|
|||||||
class XKPDEF: public KPARTDEF {
|
class XKPDEF: public KPARTDEF {
|
||||||
friend class TDBDOX;
|
friend class TDBDOX;
|
||||||
friend class ha_connect;
|
friend class ha_connect;
|
||||||
//friend int CntMakeIndex(PGLOBAL, const char *, PIXDEF);
|
|
||||||
friend int CntIndexInit(PGLOBAL, PTDB, int);
|
friend int CntIndexInit(PGLOBAL, PTDB, int);
|
||||||
public:
|
public:
|
||||||
XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
|
XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
|
||||||
}; // end of class XKPDEF
|
}; // end of class XKPDEF
|
||||||
|
|
||||||
//RCODE CheckRecord(PGLOBAL g, PTDB tdbp, char *oldbuf, char *newbuf);
|
|
||||||
|
@ -20,7 +20,6 @@ typedef struct _xblock { /* Loaded XML file block */
|
|||||||
short Type; /* TYPE_FB_XML */
|
short Type; /* TYPE_FB_XML */
|
||||||
int Retcode; /* Return code from Load */
|
int Retcode; /* Return code from Load */
|
||||||
MSXML2::IXMLDOMDocumentPtr Docp;/* Document interface pointer */
|
MSXML2::IXMLDOMDocumentPtr Docp;/* Document interface pointer */
|
||||||
//IXMLDOMNodeListPtr Nlist;
|
|
||||||
} XBLOCK, *PXBLOCK;
|
} XBLOCK, *PXBLOCK;
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
@ -123,9 +122,6 @@ class DOMATTR : public XMLATTRIBUTE {
|
|||||||
friend class DOMDOC;
|
friend class DOMDOC;
|
||||||
friend class DOMNODE;
|
friend class DOMNODE;
|
||||||
public:
|
public:
|
||||||
// Properties
|
|
||||||
//virtual char *GetText(void);
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool SetText(PGLOBAL g, char *txtp, int len);
|
virtual bool SetText(PGLOBAL g, char *txtp, int len);
|
||||||
|
|
||||||
|
@ -322,8 +322,8 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Record file position in case of UPDATE or DELETE. */
|
/* Record file position in case of UPDATE or DELETE. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Fpos = Mempos;
|
Fpos = Mempos;
|
||||||
CurBlk = (int)Rows++;
|
CurBlk = (int)Rows++;
|
||||||
} else
|
} else
|
||||||
Placed = false;
|
Placed = false;
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ MBKFAM::MBKFAM(PDOSDEF tdp) : MAPFAM(tdp)
|
|||||||
Block = tdp->GetBlock();
|
Block = tdp->GetBlock();
|
||||||
Last = tdp->GetLast();
|
Last = tdp->GetLast();
|
||||||
Nrec = tdp->GetElemt();
|
Nrec = tdp->GetElemt();
|
||||||
BlkPos = tdp->GetTo_Pos();
|
BlkPos = NULL;
|
||||||
CurNum = Nrec;
|
CurNum = Nrec;
|
||||||
} // end of MBKFAM standard constructor
|
} // end of MBKFAM standard constructor
|
||||||
|
|
||||||
@ -537,37 +537,8 @@ int MBKFAM::GetRowID(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MBKFAM::ReadBuffer(PGLOBAL g)
|
int MBKFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int len;
|
strcpy(g->Message, "This AM cannot be used in this version");
|
||||||
|
return RC_FX;
|
||||||
/*********************************************************************/
|
|
||||||
/* Sequential block reading when Placed is not true. */
|
|
||||||
/*********************************************************************/
|
|
||||||
if (Placed) {
|
|
||||||
Placed = false;
|
|
||||||
} else if (Mempos >= Top) { // Are we at the end of the memory
|
|
||||||
return RC_EF;
|
|
||||||
} else if (++CurNum < Nrec) {
|
|
||||||
Fpos = Mempos;
|
|
||||||
} else {
|
|
||||||
/*******************************************************************/
|
|
||||||
/* New block. */
|
|
||||||
/*******************************************************************/
|
|
||||||
CurNum = 0;
|
|
||||||
|
|
||||||
if (++CurBlk >= Block)
|
|
||||||
return RC_EF;
|
|
||||||
|
|
||||||
Fpos = Mempos = Memory + BlkPos[CurBlk];
|
|
||||||
} // endif's
|
|
||||||
|
|
||||||
// Immediately calculate next position (Used by DeleteDB)
|
|
||||||
while (*Mempos++ != '\n') ; // What about Unix ???
|
|
||||||
|
|
||||||
// Set caller line buffer
|
|
||||||
len = (Mempos - Fpos) - Ending;
|
|
||||||
memcpy(Tdbp->GetLine(), Fpos, len);
|
|
||||||
Tdbp->GetLine()[len] = '\0';
|
|
||||||
return RC_OK;
|
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -657,7 +628,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/* New block. */
|
/* New block. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
|
|
||||||
if (++CurBlk >= Block)
|
if (++CurBlk >= Block)
|
||||||
return RC_EF;
|
return RC_EF;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ class DllExport MAPFAM : public TXTFAM {
|
|||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
|
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
virtual bool SetPos(PGLOBAL g, int recpos);
|
virtual bool SetPos(PGLOBAL g, int recpos);
|
||||||
@ -66,18 +65,16 @@ class DllExport MBKFAM : public MAPFAM {
|
|||||||
MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {}
|
MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {}
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
{return (PTXF)new(g) MBKFAM(this);}
|
{return (PTXF)new(g) MBKFAM(this);}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{return TXTFAM::MaxBlkSize(g, s);}
|
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual int SkipRecord(PGLOBAL g, bool header);
|
virtual int SkipRecord(PGLOBAL g, bool header);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// No additional members
|
// No additional members
|
||||||
@ -99,9 +96,6 @@ class DllExport MPXFAM : public MBKFAM {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
|
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{return TXTFAM::MaxBlkSize(g, s);}
|
|
||||||
//virtual int GetRowID(void);
|
|
||||||
virtual bool SetPos(PGLOBAL g, int recpos);
|
virtual bool SetPos(PGLOBAL g, int recpos);
|
||||||
virtual bool DeferReading(void) {return false;}
|
virtual bool DeferReading(void) {return false;}
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
@ -43,7 +43,6 @@ class DllExport DBFBASE {
|
|||||||
int Nerr; /* Number of bad records */
|
int Nerr; /* Number of bad records */
|
||||||
int Maxerr; /* Maximum number of bad records */
|
int Maxerr; /* Maximum number of bad records */
|
||||||
int ReadMode; /* 1: ALL 2: DEL 0: NOT DEL */
|
int ReadMode; /* 1: ALL 2: DEL 0: NOT DEL */
|
||||||
//PSZ Defpath; /* Default data path */
|
|
||||||
}; // end of class DBFBASE
|
}; // end of class DBFBASE
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -63,22 +62,18 @@ class DllExport DBFFAM : public FIXFAM, public DBFBASE {
|
|||||||
// Methods
|
// Methods
|
||||||
virtual int GetNerr(void) {return Nerr;}
|
virtual int GetNerr(void) {return Nerr;}
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
//virtual int GetRowID(void); // Temporarily suppressed
|
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual void ResetBuffer(PGLOBAL g);
|
virtual void ResetBuffer(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
//virtual int WriteBuffer(PGLOBAL g);
|
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
|
||||||
virtual bool CopyHeader(PGLOBAL g);
|
virtual bool CopyHeader(PGLOBAL g);
|
||||||
|
|
||||||
//int Records; in TXTFAM
|
// Members
|
||||||
//int Headlen; in TXTFAM
|
|
||||||
}; // end of class DBFFAM
|
}; // end of class DBFFAM
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@ -100,17 +95,13 @@ class DllExport DBMFAM : public MPXFAM, public DBFBASE {
|
|||||||
// Methods
|
// Methods
|
||||||
virtual int GetNerr(void) {return Nerr;}
|
virtual int GetNerr(void) {return Nerr;}
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
//virtual int GetRowID(void); // Temporarily suppressed
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
//virtual int WriteBuffer(PGLOBAL g);
|
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
//int Records; in TXTFAM
|
|
||||||
//int Headlen; in TXTFAM
|
|
||||||
}; // end of class DBFFAM
|
}; // end of class DBFFAM
|
||||||
|
|
||||||
#endif // __FILAMDBF_H
|
#endif // __FILAMDBF_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*********** File AM Fix C++ Program Source Code File (.CPP) ***********/
|
/*********** File AM Fix C++ Program Source Code File (.CPP) ***********/
|
||||||
/* PROGRAM NAME: FILAMFIX */
|
/* PROGRAM NAME: FILAMFIX */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.4 */
|
/* Version 1.5 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
|
@ -31,18 +31,16 @@ class DllExport FIXFAM : public BLKFAM {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
|
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s)
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
{return TXTFAM::MaxBlkSize(g, s);}
|
virtual void ResetBuffer(PGLOBAL g);
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual void ResetBuffer(PGLOBAL g);
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool CopyHeader(PGLOBAL g) {return false;}
|
virtual bool CopyHeader(PGLOBAL g) {return false;}
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
|
||||||
|
|
||||||
// No additional members
|
// No additional members
|
||||||
}; // end of class FIXFAM
|
}; // end of class FIXFAM
|
||||||
@ -64,12 +62,11 @@ class BGXFAM : public FIXFAM {
|
|||||||
{return (PTXF)new(g) BGXFAM(this);}
|
{return (PTXF)new(g) BGXFAM(this);}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
//virtual void Reset(void);
|
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
@ -78,13 +75,12 @@ class BGXFAM : public FIXFAM {
|
|||||||
, int org = FILE_BEGIN);
|
, int org = FILE_BEGIN);
|
||||||
int BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
int BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
virtual bool OpenTempFile(PGLOBAL g);
|
virtual bool OpenTempFile(PGLOBAL g);
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
HANDLE Hfile; // Handle(descriptor) to big file
|
HANDLE Hfile; // Handle(descriptor) to big file
|
||||||
HANDLE Tfile; // Handle(descriptor) to big temp file
|
HANDLE Tfile; // Handle(descriptor) to big temp file
|
||||||
//BIGINT Xpos; // Current file position
|
|
||||||
}; // end of class BGXFAM
|
}; // end of class BGXFAM
|
||||||
|
|
||||||
#endif // __FILAMFIX_H
|
#endif // __FILAMFIX_H
|
||||||
|
@ -228,25 +228,6 @@ int TXTFAM::Cardinality(PGLOBAL g)
|
|||||||
|
|
||||||
} // end of Cardinality
|
} // end of Cardinality
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Use BlockTest to reduce the table estimated size. */
|
|
||||||
/* Note: This function is meant only for fixed length files but is */
|
|
||||||
/* placed here to be available to FIXFAM and MPXFAM classes. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int TXTFAM::MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{
|
|
||||||
int savcur = CurBlk, blm1 = Block - 1;
|
|
||||||
int size, last = s - blm1 * Nrec;
|
|
||||||
|
|
||||||
// Roughly estimate the table size as the sum of blocks
|
|
||||||
// that can contain good rows
|
|
||||||
for (size = 0, CurBlk = 0; CurBlk < Block; CurBlk++)
|
|
||||||
size += (CurBlk == blm1) ? last : Nrec;
|
|
||||||
|
|
||||||
CurBlk = savcur;
|
|
||||||
return size;
|
|
||||||
} // end of MaxBlkSize
|
|
||||||
|
|
||||||
/* --------------------------- Class DOSFAM -------------------------- */
|
/* --------------------------- Class DOSFAM -------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -313,15 +294,6 @@ int DOSFAM::Cardinality(PGLOBAL g)
|
|||||||
return (g) ? -1 : 0;
|
return (g) ? -1 : 0;
|
||||||
} // end of Cardinality
|
} // end of Cardinality
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Use BlockTest to reduce the table estimated size. */
|
|
||||||
/* Note: This function is not really implemented yet. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int DOSFAM::MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{
|
|
||||||
return s;
|
|
||||||
} // end of MaxBlkSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* OpenTableFile: Open a DOS/UNIX table file using C standard I/Os. */
|
/* OpenTableFile: Open a DOS/UNIX table file using C standard I/Os. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -993,7 +965,7 @@ BLKFAM::BLKFAM(PDOSDEF tdp) : DOSFAM(tdp)
|
|||||||
Last = tdp->GetLast();
|
Last = tdp->GetLast();
|
||||||
Nrec = tdp->GetElemt();
|
Nrec = tdp->GetElemt();
|
||||||
Closing = false;
|
Closing = false;
|
||||||
BlkPos = tdp->GetTo_Pos();
|
BlkPos = NULL;
|
||||||
CurLine = NULL;
|
CurLine = NULL;
|
||||||
NxtLine = NULL;
|
NxtLine = NULL;
|
||||||
OutBuf = NULL;
|
OutBuf = NULL;
|
||||||
@ -1028,23 +1000,6 @@ int BLKFAM::Cardinality(PGLOBAL g)
|
|||||||
//return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
|
//return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
|
||||||
} // end of Cardinality
|
} // end of Cardinality
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Use BlockTest to reduce the table estimated size. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int BLKFAM::MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{
|
|
||||||
int savcur = CurBlk;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
// Roughly estimate the table size as the sum of blocks
|
|
||||||
// that can contain good rows
|
|
||||||
for (size = 0, CurBlk = 0; CurBlk < Block; CurBlk++)
|
|
||||||
size += (CurBlk == Block - 1) ? Last : Nrec;
|
|
||||||
|
|
||||||
CurBlk = savcur;
|
|
||||||
return size;
|
|
||||||
} // end of MaxBlkSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Allocate the line buffer. For mode Delete or when a temp file is */
|
/* Allocate the line buffer. For mode Delete or when a temp file is */
|
||||||
/* used another big buffer has to be allocated because is it used */
|
/* used another big buffer has to be allocated because is it used */
|
||||||
@ -1150,97 +1105,8 @@ int BLKFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int BLKFAM::ReadBuffer(PGLOBAL g)
|
int BLKFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int i, n, rc = RC_OK;
|
strcpy(g->Message, "This AM cannot be used in this version");
|
||||||
|
return RC_FX;
|
||||||
/*********************************************************************/
|
|
||||||
/* Sequential reading when Placed is not true. */
|
|
||||||
/*********************************************************************/
|
|
||||||
if (Placed) {
|
|
||||||
Placed = false;
|
|
||||||
} else if (++CurNum < Rbuf) {
|
|
||||||
CurLine = NxtLine;
|
|
||||||
|
|
||||||
// Get the position of the next line in the buffer
|
|
||||||
while (*NxtLine++ != '\n') ;
|
|
||||||
|
|
||||||
// Set caller line buffer
|
|
||||||
n = NxtLine - CurLine - Ending;
|
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
|
||||||
Tdbp->GetLine()[n] = '\0';
|
|
||||||
goto fin;
|
|
||||||
} else if (Rbuf < Nrec && CurBlk != -1) {
|
|
||||||
return RC_EF;
|
|
||||||
} else {
|
|
||||||
/*******************************************************************/
|
|
||||||
/* New block. */
|
|
||||||
/*******************************************************************/
|
|
||||||
CurNum = 0;
|
|
||||||
|
|
||||||
if (++CurBlk >= Block)
|
|
||||||
return RC_EF;
|
|
||||||
|
|
||||||
} // endif's
|
|
||||||
|
|
||||||
if (OldBlk == CurBlk)
|
|
||||||
goto ok; // Block is already there
|
|
||||||
|
|
||||||
// fseek is required only in non sequential reading
|
|
||||||
if (CurBlk != OldBlk + 1)
|
|
||||||
if (fseek(Stream, BlkPos[CurBlk], SEEK_SET)) {
|
|
||||||
sprintf(g->Message, MSG(FSETPOS_ERROR), BlkPos[CurBlk]);
|
|
||||||
return RC_FX;
|
|
||||||
} // endif fseek
|
|
||||||
|
|
||||||
// Calculate the length of block to read
|
|
||||||
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
|
|
||||||
|
|
||||||
if (trace)
|
|
||||||
htrc("File position is now %d\n", ftell(Stream));
|
|
||||||
|
|
||||||
// Read the entire next block
|
|
||||||
n = fread(To_Buf, 1, (size_t)BlkLen, Stream);
|
|
||||||
|
|
||||||
if (n == BlkLen) {
|
|
||||||
// ReadBlks++;
|
|
||||||
num_read++;
|
|
||||||
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
|
||||||
|
|
||||||
ok:
|
|
||||||
rc = RC_OK;
|
|
||||||
|
|
||||||
// Get the position of the current line
|
|
||||||
for (i = 0, CurLine = To_Buf; i < CurNum; i++)
|
|
||||||
while (*CurLine++ != '\n') ; // What about Unix ???
|
|
||||||
|
|
||||||
// Now get the position of the next line
|
|
||||||
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
|
|
||||||
|
|
||||||
// Set caller line buffer
|
|
||||||
n = NxtLine - CurLine - Ending;
|
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
|
||||||
Tdbp->GetLine()[n] = '\0';
|
|
||||||
} else if (feof(Stream)) {
|
|
||||||
rc = RC_EF;
|
|
||||||
} else {
|
|
||||||
#if defined(UNIX)
|
|
||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, strerror(errno));
|
|
||||||
#else
|
|
||||||
sprintf(g->Message, MSG(READ_ERROR), To_File, _strerror(NULL));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (trace)
|
|
||||||
htrc("%s\n", g->Message);
|
|
||||||
|
|
||||||
return RC_FX;
|
|
||||||
} // endelse
|
|
||||||
|
|
||||||
OldBlk = CurBlk; // Last block actually read
|
|
||||||
IsRead = true; // Is read indeed
|
|
||||||
|
|
||||||
fin:
|
|
||||||
// Store the current record file position for Delete and Update
|
|
||||||
Fpos = BlkPos[CurBlk] + CurLine - To_Buf;
|
|
||||||
return rc;
|
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@ -39,10 +39,10 @@ class DllExport TXTFAM : public BLOCK {
|
|||||||
virtual int GetNextPos(void) = 0;
|
virtual int GetNextPos(void) = 0;
|
||||||
virtual PTXF Duplicate(PGLOBAL g) = 0;
|
virtual PTXF Duplicate(PGLOBAL g) = 0;
|
||||||
virtual bool GetUseTemp(void) {return false;}
|
virtual bool GetUseTemp(void) {return false;}
|
||||||
virtual int GetDelRows(void) {return DelRows;}
|
virtual int GetDelRows(void) {return DelRows;}
|
||||||
int GetCurBlk(void) {return CurBlk;}
|
int GetCurBlk(void) {return CurBlk;}
|
||||||
void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;}
|
void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;}
|
||||||
int GetBlock(void) {return Block;}
|
int GetBlock(void) {return Block;}
|
||||||
void SetBlkPos(int *bkp) {BlkPos = bkp;}
|
void SetBlkPos(int *bkp) {BlkPos = bkp;}
|
||||||
void SetNrec(int n) {Nrec = n;}
|
void SetNrec(int n) {Nrec = n;}
|
||||||
char *GetBuf(void) {return To_Buf;}
|
char *GetBuf(void) {return To_Buf;}
|
||||||
@ -53,7 +53,6 @@ class DllExport TXTFAM : public BLOCK {
|
|||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g) {return false;}
|
virtual bool AllocateBuffer(PGLOBAL g) {return false;}
|
||||||
virtual void ResetBuffer(PGLOBAL g) {}
|
virtual void ResetBuffer(PGLOBAL g) {}
|
||||||
virtual int GetNerr(void) {return 0;}
|
virtual int GetNerr(void) {return 0;}
|
||||||
@ -71,19 +70,19 @@ class DllExport TXTFAM : public BLOCK {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
PTDBDOS Tdbp; // To table class
|
PTDBDOS Tdbp; // To table class
|
||||||
PSZ To_File; // Points to table file name
|
PSZ To_File; // Points to table file name
|
||||||
PFBLOCK To_Fb; // Pointer to file block
|
PFBLOCK To_Fb; // Pointer to file block
|
||||||
bool Placed; // true if Recpos was externally set
|
bool Placed; // true if Recpos was externally set
|
||||||
bool IsRead; // false for deferred reading
|
bool IsRead; // false for deferred reading
|
||||||
bool Blocked; // true if using blocked I/O
|
bool Blocked; // true if using blocked I/O
|
||||||
char *To_Buf; // Points to I/O buffer
|
char *To_Buf; // Points to I/O buffer
|
||||||
void *DelBuf; // Buffer used to move lines in Delete
|
void *DelBuf; // Buffer used to move lines in Delete
|
||||||
int *BlkPos; // To array of block positions
|
int *BlkPos; // To array of block positions
|
||||||
int BlkLen; // Current block length
|
int BlkLen; // Current block length
|
||||||
int Buflen; // Buffer length
|
int Buflen; // Buffer length
|
||||||
int Dbflen; // Delete buffer length
|
int Dbflen; // Delete buffer length
|
||||||
int Rows; // Number of rows read so far
|
int Rows; // Number of rows read so far
|
||||||
int DelRows; // Number of deleted rows
|
int DelRows; // Number of deleted rows
|
||||||
int Headlen; // Number of bytes in header
|
int Headlen; // Number of bytes in header
|
||||||
int Lrecl; // Logical Record Length
|
int Lrecl; // Logical Record Length
|
||||||
@ -93,14 +92,14 @@ class DllExport TXTFAM : public BLOCK {
|
|||||||
int OldBlk; // Index of last read block
|
int OldBlk; // Index of last read block
|
||||||
int CurBlk; // Index of current block
|
int CurBlk; // Index of current block
|
||||||
int CurNum; // Current buffer line number
|
int CurNum; // Current buffer line number
|
||||||
int ReadBlks; // Number of blocks read (selected)
|
int ReadBlks; // Number of blocks read (selected)
|
||||||
int Rbuf; // Number of lines read in buffer
|
int Rbuf; // Number of lines read in buffer
|
||||||
int Modif; // Number of modified lines in block
|
int Modif; // Number of modified lines in block
|
||||||
int Blksize; // Size of padded blocks
|
int Blksize; // Size of padded blocks
|
||||||
int Ending; // Length of line end
|
int Ending; // Length of line end
|
||||||
bool Padded; // true if fixed size blocks are padded
|
bool Padded; // true if fixed size blocks are padded
|
||||||
bool Eof; // true if an EOF (0xA) character exists
|
bool Eof; // true if an EOF (0xA) character exists
|
||||||
char *CrLf; // End of line character(s)
|
char *CrLf; // End of line character(s)
|
||||||
}; // end of class TXTFAM
|
}; // end of class TXTFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -125,7 +124,6 @@ class DllExport DOSFAM : public TXTFAM {
|
|||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
@ -134,7 +132,7 @@ class DllExport DOSFAM : public TXTFAM {
|
|||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
@ -174,7 +172,6 @@ class DllExport BLKFAM : public DOSFAM {
|
|||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
|
@ -244,23 +244,6 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
|
|||||||
return rc;
|
return rc;
|
||||||
} // end of SetBlockInfo
|
} // end of SetBlockInfo
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Use BlockTest to reduce the table estimated size. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int VCTFAM::MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{
|
|
||||||
int savcur = CurBlk;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
// Roughly estimate the table size as the sum of blocks
|
|
||||||
// that can contain good rows
|
|
||||||
for (size = 0, CurBlk = 0; CurBlk < Block; CurBlk++)
|
|
||||||
size += (CurBlk == Block - 1) ? Last : Nrec;
|
|
||||||
|
|
||||||
CurBlk = savcur;
|
|
||||||
return size;
|
|
||||||
} // end of MaxBlkSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* VCT Cardinality: returns table cardinality in number of rows. */
|
/* VCT Cardinality: returns table cardinality in number of rows. */
|
||||||
/* This function can be called with a null argument to test the */
|
/* This function can be called with a null argument to test the */
|
||||||
|
@ -40,7 +40,6 @@ class DllExport VCTFAM : public FIXFAM {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual bool InitInsert(PGLOBAL g);
|
virtual bool InitInsert(PGLOBAL g);
|
||||||
virtual void ResetBuffer(PGLOBAL g) {}
|
virtual void ResetBuffer(PGLOBAL g) {}
|
||||||
@ -74,11 +73,11 @@ class DllExport VCTFAM : public FIXFAM {
|
|||||||
char *Colfn; // Pattern for column file names (VER)
|
char *Colfn; // Pattern for column file names (VER)
|
||||||
char *Tempat; // Pattern for temp file names (VER)
|
char *Tempat; // Pattern for temp file names (VER)
|
||||||
int *Clens; // Pointer to col size array
|
int *Clens; // Pointer to col size array
|
||||||
int *Deplac; // Pointer to col start position array
|
int *Deplac; // Pointer to col start position array
|
||||||
bool *Isnum; // Pointer to buffer type isnum result
|
bool *Isnum; // Pointer to buffer type isnum result
|
||||||
bool AddBlock; // True when adding new blocks on Insert
|
bool AddBlock; // True when adding new blocks on Insert
|
||||||
bool Split; // true: split column file vector format
|
bool Split; // true: split column file vector format
|
||||||
int Header; // 0: no, 1: separate, 2: in data file
|
int Header; // 0: no, 1: separate, 2: in data file
|
||||||
int MaxBlk; // Max number of blocks (True vector format)
|
int MaxBlk; // Max number of blocks (True vector format)
|
||||||
int Bsize; // Because Nrec can be modified
|
int Bsize; // Because Nrec can be modified
|
||||||
int Ncol; // The number of columns;
|
int Ncol; // The number of columns;
|
||||||
@ -164,7 +163,7 @@ class DllExport VECFAM : public VCTFAM {
|
|||||||
FILE* *T_Streams; // Points to temp file structure array
|
FILE* *T_Streams; // Points to temp file structure array
|
||||||
PFBLOCK *To_Fbs; // Pointer to file block array
|
PFBLOCK *To_Fbs; // Pointer to file block array
|
||||||
PFBLOCK *T_Fbs; // Pointer to temp file block array
|
PFBLOCK *T_Fbs; // Pointer to temp file block array
|
||||||
void* *To_Bufs; // Pointer to col val block array
|
void* *To_Bufs; // Pointer to col val block array
|
||||||
bool InitUpdate; // Used to initialize updating
|
bool InitUpdate; // Used to initialize updating
|
||||||
}; // end of class VECFAM
|
}; // end of class VECFAM
|
||||||
|
|
||||||
@ -189,7 +188,7 @@ class DllExport VMPFAM : public VCMFAM {
|
|||||||
|
|
||||||
// Database routines
|
// Database routines
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -220,7 +219,7 @@ class BGVFAM : public VCTFAM {
|
|||||||
// Database routines
|
// Database routines
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g);
|
virtual void CloseTableFile(PGLOBAL g);
|
||||||
virtual void Rewind(void);
|
virtual void Rewind(void);
|
||||||
|
|
||||||
@ -233,11 +232,11 @@ class BGVFAM : public VCTFAM {
|
|||||||
bool BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
bool BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
virtual bool MakeEmptyFile(PGLOBAL g, char *fn);
|
virtual bool MakeEmptyFile(PGLOBAL g, char *fn);
|
||||||
virtual bool OpenTempFile(PGLOBAL g);
|
virtual bool OpenTempFile(PGLOBAL g);
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
||||||
virtual bool CleanUnusedSpace(PGLOBAL g);
|
virtual bool CleanUnusedSpace(PGLOBAL g);
|
||||||
virtual bool SetBlockInfo(PGLOBAL g);
|
virtual bool SetBlockInfo(PGLOBAL g);
|
||||||
virtual int GetBlockInfo(PGLOBAL g);
|
virtual int GetBlockInfo(PGLOBAL g);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
HANDLE Hfile; // Handle to big file
|
HANDLE Hfile; // Handle to big file
|
||||||
|
@ -403,7 +403,7 @@ ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
|
|||||||
CurLine = NULL;
|
CurLine = NULL;
|
||||||
NxtLine = NULL;
|
NxtLine = NULL;
|
||||||
Closing = false;
|
Closing = false;
|
||||||
BlkPos = tdp->GetTo_Pos();
|
BlkPos = NULL;
|
||||||
} // end of ZBKFAM standard constructor
|
} // end of ZBKFAM standard constructor
|
||||||
|
|
||||||
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
|
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
|
||||||
@ -413,23 +413,6 @@ ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
|
|||||||
Closing = txfp->Closing;
|
Closing = txfp->Closing;
|
||||||
} // end of ZBKFAM copy constructor
|
} // end of ZBKFAM copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Use BlockTest to reduce the table estimated size. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int ZBKFAM::MaxBlkSize(PGLOBAL g, int s)
|
|
||||||
{
|
|
||||||
int savcur = CurBlk;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
// Roughly estimate the table size as the sum of blocks
|
|
||||||
// that can contain good rows
|
|
||||||
for (size = 0, CurBlk = 0; CurBlk < Block; CurBlk++)
|
|
||||||
size += (CurBlk == Block - 1) ? Last : Nrec;
|
|
||||||
|
|
||||||
CurBlk = savcur;
|
|
||||||
return size;
|
|
||||||
} // end of MaxBlkSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ZBK Cardinality: returns table cardinality in number of rows. */
|
/* ZBK Cardinality: returns table cardinality in number of rows. */
|
||||||
/* This function can be called with a null argument to test the */
|
/* This function can be called with a null argument to test the */
|
||||||
@ -509,56 +492,8 @@ int ZBKFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZBKFAM::ReadBuffer(PGLOBAL g)
|
int ZBKFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int n, rc = RC_OK;
|
strcpy(g->Message, "This AM cannot be used in this version");
|
||||||
|
return RC_FX;
|
||||||
/*********************************************************************/
|
|
||||||
/* Sequential reading when Placed is not true. */
|
|
||||||
/*********************************************************************/
|
|
||||||
if (++CurNum < Rbuf) {
|
|
||||||
CurLine = NxtLine;
|
|
||||||
|
|
||||||
// Get the position of the next line in the buffer
|
|
||||||
while (*NxtLine++ != '\n') ;
|
|
||||||
|
|
||||||
// Set caller line buffer
|
|
||||||
n = NxtLine - CurLine - Ending;
|
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
|
||||||
Tdbp->GetLine()[n] = '\0';
|
|
||||||
return RC_OK;
|
|
||||||
} else if (Rbuf < Nrec && CurBlk != -1)
|
|
||||||
return RC_EF;
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
/* New block. */
|
|
||||||
/*********************************************************************/
|
|
||||||
CurNum = 0;
|
|
||||||
|
|
||||||
if (++CurBlk >= Block)
|
|
||||||
return RC_EF;
|
|
||||||
|
|
||||||
BlkLen = BlkPos[CurBlk + 1] - BlkPos[CurBlk];
|
|
||||||
|
|
||||||
if (!(n = gzread(Zfile, To_Buf, BlkLen))) {
|
|
||||||
rc = RC_EF;
|
|
||||||
} else if (n > 0) {
|
|
||||||
// Get the position of the current line
|
|
||||||
CurLine = To_Buf;
|
|
||||||
|
|
||||||
// Now get the position of the next line
|
|
||||||
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
|
|
||||||
|
|
||||||
// Set caller line buffer
|
|
||||||
n = NxtLine - CurLine - Ending;
|
|
||||||
memcpy(Tdbp->GetLine(), CurLine, n);
|
|
||||||
Tdbp->GetLine()[n] = '\0';
|
|
||||||
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
|
|
||||||
IsRead = true;
|
|
||||||
rc = RC_OK;
|
|
||||||
num_read++;
|
|
||||||
} else
|
|
||||||
rc = Zerror(g);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
} // end of ReadBuffer
|
} // end of ReadBuffer
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -770,9 +705,6 @@ int ZIXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
Tdbp->SetLine(To_Buf);
|
Tdbp->SetLine(To_Buf);
|
||||||
|
|
||||||
//if (++CurBlk >= Block)
|
|
||||||
// return RC_EF;
|
|
||||||
|
|
||||||
if (!(n = gzread(Zfile, To_Buf, Buflen))) {
|
if (!(n = gzread(Zfile, To_Buf, Buflen))) {
|
||||||
rc = RC_EF;
|
rc = RC_EF;
|
||||||
} else if (n > 0) {
|
} else if (n > 0) {
|
||||||
|
@ -38,7 +38,6 @@ class DllExport ZIPFAM : public TXTFAM {
|
|||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
@ -78,7 +77,6 @@ class DllExport ZBKFAM : public ZIPFAM {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
virtual int GetRowID(void);
|
virtual int GetRowID(void);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
@ -122,7 +120,7 @@ class DllExport ZIXFAM : public ZBKFAM {
|
|||||||
// No additional Members
|
// No additional Members
|
||||||
}; // end of class ZIXFAM
|
}; // end of class ZIXFAM
|
||||||
|
|
||||||
#ifdef NOT_USED
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
|
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
|
||||||
/* fixed/variable files compressed using the zlib library functions. */
|
/* fixed/variable files compressed using the zlib library functions. */
|
||||||
@ -166,6 +164,6 @@ class DllExport ZLBFAM : public BLKFAM {
|
|||||||
int *Zlenp; // Pointer to block length
|
int *Zlenp; // Pointer to block length
|
||||||
bool Optimized; // true when opt file is available
|
bool Optimized; // true when opt file is available
|
||||||
}; // end of class ZLBFAM
|
}; // end of class ZLBFAM
|
||||||
#endif // NOT_USED
|
#endif // 0
|
||||||
|
|
||||||
#endif // __FILAMZIP_H
|
#endif // __FILAMZIP_H
|
||||||
|
@ -222,9 +222,6 @@ typedef struct _global { /* Global structure */
|
|||||||
int Createas; /* To pass info to created table */
|
int Createas; /* To pass info to created table */
|
||||||
void *Xchk; /* indexes in create/alter */
|
void *Xchk; /* indexes in create/alter */
|
||||||
short Alchecked; /* Checked for ALTER */
|
short Alchecked; /* Checked for ALTER */
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
short Mrr; /* True when doing mrr */
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
short Trace;
|
short Trace;
|
||||||
int jump_level;
|
int jump_level;
|
||||||
jmp_buf jumper[MAX_JUMP + 2];
|
jmp_buf jumper[MAX_JUMP + 2];
|
||||||
|
@ -252,8 +252,6 @@ ha_create_table_option connect_table_option_list[]=
|
|||||||
ha_create_table_option connect_field_option_list[]=
|
ha_create_table_option connect_field_option_list[]=
|
||||||
{
|
{
|
||||||
HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1),
|
HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1),
|
||||||
HA_FOPTION_NUMBER("FREQUENCY", freq, 0, 0, INT_MAX32, 1), // not used
|
|
||||||
HA_FOPTION_NUMBER("OPT_VALUE", opt, 0, 0, 2, 1), // used for indexing
|
|
||||||
HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1),
|
HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1),
|
||||||
HA_FOPTION_STRING("DATE_FORMAT", dateformat),
|
HA_FOPTION_STRING("DATE_FORMAT", dateformat),
|
||||||
HA_FOPTION_STRING("FIELD_FORMAT", fieldformat),
|
HA_FOPTION_STRING("FIELD_FORMAT", fieldformat),
|
||||||
@ -331,11 +329,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
|
|||||||
delete_table method in handler.cc
|
delete_table method in handler.cc
|
||||||
*/
|
*/
|
||||||
static const char *ha_connect_exts[]= {
|
static const char *ha_connect_exts[]= {
|
||||||
".dos", ".fix", ".csv",".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
|
".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
|
||||||
".dnx", ".fnx", ".bnx", ".vnx", ".dbx",
|
".dnx", ".fnx", ".bnx", ".vnx", ".dbx",
|
||||||
NULL
|
NULL};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief
|
@brief
|
||||||
@ -453,7 +449,7 @@ static handler* connect_create_handler(handlerton *hton,
|
|||||||
handler *h= new (mem_root) ha_connect(hton, table);
|
handler *h= new (mem_root) ha_connect(hton, table);
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("New CONNECT %p, table: %s\n",
|
htrc("New CONNECT %p, table: %s\n",
|
||||||
h, table ? table->table_name.str : "<null>");
|
h, table ? table->table_name.str : "<null>");
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
@ -500,7 +496,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
|
|||||||
ha_connect::~ha_connect(void)
|
ha_connect::~ha_connect(void)
|
||||||
{
|
{
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Delete CONNECT %p, table: %s, xp=%p count=%d\n", this,
|
htrc("Delete CONNECT %p, table: %s, xp=%p count=%d\n", this,
|
||||||
table ? table->s->table_name.str : "<null>",
|
table ? table->s->table_name.str : "<null>",
|
||||||
xp, xp ? xp->count : 0);
|
xp, xp ? xp->count : 0);
|
||||||
|
|
||||||
@ -923,7 +919,6 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
|||||||
} // endif special
|
} // endif special
|
||||||
|
|
||||||
pcf->Scale= 0;
|
pcf->Scale= 0;
|
||||||
pcf->Opt= (fop) ? (int)fop->opt : 0;
|
|
||||||
|
|
||||||
if ((pcf->Length= fp->field_length) < 0)
|
if ((pcf->Length= fp->field_length) < 0)
|
||||||
pcf->Length= 256; // BLOB?
|
pcf->Length= 256; // BLOB?
|
||||||
@ -932,12 +927,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
|||||||
|
|
||||||
if (fop) {
|
if (fop) {
|
||||||
pcf->Offset= (int)fop->offset;
|
pcf->Offset= (int)fop->offset;
|
||||||
// pcf->Freq= fop->freq;
|
|
||||||
pcf->Datefmt= (char*)fop->dateformat;
|
pcf->Datefmt= (char*)fop->dateformat;
|
||||||
pcf->Fieldfmt= (char*)fop->fieldformat;
|
pcf->Fieldfmt= (char*)fop->fieldformat;
|
||||||
} else {
|
} else {
|
||||||
pcf->Offset= -1;
|
pcf->Offset= -1;
|
||||||
// pcf->Freq= 0;
|
|
||||||
pcf->Datefmt= NULL;
|
pcf->Datefmt= NULL;
|
||||||
pcf->Fieldfmt= NULL;
|
pcf->Fieldfmt= NULL;
|
||||||
} // endif fop
|
} // endif fop
|
||||||
@ -961,7 +954,6 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
|
|||||||
// Find if collation name ends by _ci
|
// Find if collation name ends by _ci
|
||||||
if (!strcmp(cp + strlen(cp) - 3, "_ci")) {
|
if (!strcmp(cp + strlen(cp) - 3, "_ci")) {
|
||||||
pcf->Scale= 1; // Case insensitive
|
pcf->Scale= 1; // Case insensitive
|
||||||
pcf->Opt= 0; // Prevent index opt until it is safe
|
|
||||||
} // endif ci
|
} // endif ci
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1046,7 +1038,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
|
|||||||
|
|
||||||
for (int n= 0; (unsigned)n < s->keynames.count; n++) {
|
for (int n= 0; (unsigned)n < s->keynames.count; n++) {
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Getting created index %d info\n", n + 1);
|
htrc("Getting created index %d info\n", n + 1);
|
||||||
|
|
||||||
// Find the index to describe
|
// Find the index to describe
|
||||||
kp= s->key_info[n];
|
kp= s->key_info[n];
|
||||||
@ -1182,7 +1174,7 @@ PTDB ha_connect::GetTDB(PGLOBAL g)
|
|||||||
valid_query_id= xp->last_query_id;
|
valid_query_id= xp->last_query_id;
|
||||||
tp->SetMode(xmod);
|
tp->SetMode(xmod);
|
||||||
} else
|
} else
|
||||||
printf("GetTDB: %s\n", g->Message);
|
htrc("GetTDB: %s\n", g->Message);
|
||||||
|
|
||||||
return tp;
|
return tp;
|
||||||
} // end of GetTDB
|
} // end of GetTDB
|
||||||
@ -1197,7 +1189,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
|
|||||||
|
|
||||||
// Double test to be on the safe side
|
// Double test to be on the safe side
|
||||||
if (!g || !table) {
|
if (!g || !table) {
|
||||||
printf("OpenTable logical error; g=%p table=%p\n", g, table);
|
htrc("OpenTable logical error; g=%p table=%p\n", g, table);
|
||||||
return HA_ERR_INITIALIZATION;
|
return HA_ERR_INITIALIZATION;
|
||||||
} // endif g
|
} // endif g
|
||||||
|
|
||||||
@ -1278,9 +1270,8 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
|
|||||||
PIXDEF oldpix= GetIndexInfo();
|
PIXDEF oldpix= GetIndexInfo();
|
||||||
} // endif xmod
|
} // endif xmod
|
||||||
|
|
||||||
// tdbp->SetOrig((PTBX)table); // used by CheckCond
|
|
||||||
} else
|
} else
|
||||||
printf("OpenTable: %s\n", g->Message);
|
htrc("OpenTable: %s\n", g->Message);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
tdbp= NULL;
|
tdbp= NULL;
|
||||||
@ -1334,7 +1325,7 @@ int ha_connect::MakeRecord(char *buf)
|
|||||||
DBUG_ENTER("ha_connect::MakeRecord");
|
DBUG_ENTER("ha_connect::MakeRecord");
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
printf("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
|
htrc("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
|
||||||
*table->read_set->bitmap, *table->write_set->bitmap,
|
*table->read_set->bitmap, *table->write_set->bitmap,
|
||||||
*table->vcol_set->bitmap,
|
*table->vcol_set->bitmap,
|
||||||
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
|
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
|
||||||
@ -1358,21 +1349,11 @@ int ha_connect::MakeRecord(char *buf)
|
|||||||
if (bitmap_is_set(map, fp->field_index) || alter) {
|
if (bitmap_is_set(map, fp->field_index) || alter) {
|
||||||
// This is a used field, fill the buffer with value
|
// This is a used field, fill the buffer with value
|
||||||
for (colp= tdbp->GetColumns(); colp; colp= colp->GetNext())
|
for (colp= tdbp->GetColumns(); colp; colp= colp->GetNext())
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
if ((!mrr || colp->GetKcol()) &&
|
|
||||||
!stricmp(colp->GetName(), (char*)fp->field_name))
|
|
||||||
break;
|
|
||||||
#else // !MRRBKA_SUPPORT
|
|
||||||
if (!stricmp(colp->GetName(), (char*)fp->field_name))
|
if (!stricmp(colp->GetName(), (char*)fp->field_name))
|
||||||
break;
|
break;
|
||||||
#endif // !MRRBKA_SUPPORT
|
|
||||||
|
|
||||||
if (!colp) {
|
if (!colp) {
|
||||||
#if defined(MRRBKA_SUPPORT)
|
htrc("Column %s not found\n", fp->field_name);
|
||||||
if (mrr)
|
|
||||||
continue;
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
printf("Column %s not found\n", fp->field_name);
|
|
||||||
dbug_tmp_restore_column_map(table->write_set, org_bitmap);
|
dbug_tmp_restore_column_map(table->write_set, org_bitmap);
|
||||||
DBUG_RETURN(HA_ERR_WRONG_IN_RECORD);
|
DBUG_RETURN(HA_ERR_WRONG_IN_RECORD);
|
||||||
} // endif colp
|
} // endif colp
|
||||||
@ -1487,7 +1468,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (!colp) {
|
if (!colp) {
|
||||||
printf("Column %s not found\n", fp->field_name);
|
htrc("Column %s not found\n", fp->field_name);
|
||||||
rc= HA_ERR_WRONG_IN_RECORD;
|
rc= HA_ERR_WRONG_IN_RECORD;
|
||||||
goto err;
|
goto err;
|
||||||
} else
|
} else
|
||||||
@ -1612,16 +1593,16 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg)
|
|||||||
val= (neg) ? " NOT IN (" : " IN (";
|
val= (neg) ? " NOT IN (" : " IN (";
|
||||||
break;
|
break;
|
||||||
case OP_NULL:
|
case OP_NULL:
|
||||||
val= " IS NULL";
|
val= (neg) ? " IS NOT NULL" : " IS NULL";
|
||||||
break;
|
break;
|
||||||
case OP_LIKE:
|
case OP_LIKE:
|
||||||
val= " LIKE ";
|
val= " LIKE ";
|
||||||
break;
|
break;
|
||||||
case OP_XX:
|
case OP_XX:
|
||||||
val= " BETWEEN ";
|
val= (neg) ? " NOT BETWEEN " : " BETWEEN ";
|
||||||
break;
|
break;
|
||||||
case OP_EXIST:
|
case OP_EXIST:
|
||||||
val= " EXISTS ";
|
val= (neg) ? " NOT EXISTS " : " EXISTS ";
|
||||||
break;
|
break;
|
||||||
case OP_AND:
|
case OP_AND:
|
||||||
val= " AND ";
|
val= " AND ";
|
||||||
@ -1657,21 +1638,20 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg)
|
|||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Check the WHERE condition and return an ODBC/WQL filter. */
|
/* Check the WHERE condition and return a MYSQL/ODBC/WQL filter. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
|
||||||
{
|
{
|
||||||
char *body= filp->Body;
|
char *body= filp->Body;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool ismul= false, x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
bool ismul= false, x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
||||||
PPARM pfirst= NULL, pprec= NULL, pp[2]= {NULL, NULL};
|
|
||||||
OPVAL vop= OP_XX;
|
OPVAL vop= OP_XX;
|
||||||
|
|
||||||
if (!cond)
|
if (!cond)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Cond type=%d\n", cond->type());
|
htrc("Cond type=%d\n", cond->type());
|
||||||
|
|
||||||
if (cond->type() == COND::COND_ITEM) {
|
if (cond->type() == COND::COND_ITEM) {
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
@ -1681,7 +1661,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(),
|
||||||
cond_item->func_name());
|
cond_item->func_name());
|
||||||
|
|
||||||
switch (cond_item->functype()) {
|
switch (cond_item->functype()) {
|
||||||
@ -1728,7 +1708,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
Item* *args= condf->arguments();
|
Item* *args= condf->arguments();
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Func type=%d argnum=%d\n", condf->functype(),
|
htrc("Func type=%d argnum=%d\n", condf->functype(),
|
||||||
condf->argument_count());
|
condf->argument_count());
|
||||||
|
|
||||||
// neg= condf->
|
// neg= condf->
|
||||||
@ -1742,8 +1722,10 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
case Item_func::GE_FUNC: vop= OP_GE; break;
|
case Item_func::GE_FUNC: vop= OP_GE; break;
|
||||||
case Item_func::GT_FUNC: vop= OP_GT; break;
|
case Item_func::GT_FUNC: vop= OP_GT; break;
|
||||||
case Item_func::IN_FUNC: vop= OP_IN;
|
case Item_func::IN_FUNC: vop= OP_IN;
|
||||||
|
case Item_func::BETWEEN:
|
||||||
|
ismul= true;
|
||||||
neg= ((Item_func_opt_neg *)condf)->negated;
|
neg= ((Item_func_opt_neg *)condf)->negated;
|
||||||
case Item_func::BETWEEN: ismul= true; break;
|
break;
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
} // endswitch functype
|
} // endswitch functype
|
||||||
|
|
||||||
@ -1757,11 +1739,11 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
|
|
||||||
for (i= 0; i < condf->argument_count(); i++) {
|
for (i= 0; i < condf->argument_count(); i++) {
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Argtype(%d)=%d\n", i, args[i]->type());
|
htrc("Argtype(%d)=%d\n", i, args[i]->type());
|
||||||
|
|
||||||
if (i >= 2 && !ismul) {
|
if (i >= 2 && !ismul) {
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Unexpected arg for vop=%d\n", vop);
|
htrc("Unexpected arg for vop=%d\n", vop);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} // endif i
|
} // endif i
|
||||||
@ -1793,8 +1775,8 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
fnm= pField->field->field_name;
|
fnm= pField->field->field_name;
|
||||||
|
|
||||||
if (xtrace) {
|
if (xtrace) {
|
||||||
printf("Field index=%d\n", pField->field->field_index);
|
htrc("Field index=%d\n", pField->field->field_index);
|
||||||
printf("Field name=%s\n", pField->field->field_name);
|
htrc("Field name=%s\n", pField->field->field_name);
|
||||||
} // endif xtrace
|
} // endif xtrace
|
||||||
|
|
||||||
// IN and BETWEEN clauses should be col VOP list
|
// IN and BETWEEN clauses should be col VOP list
|
||||||
@ -1815,7 +1797,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
String *res, tmp(buff, sizeof(buff), &my_charset_bin);
|
String *res, tmp(buff, sizeof(buff), &my_charset_bin);
|
||||||
Item_basic_constant *pval= (Item_basic_constant *)args[i];
|
Item_basic_constant *pval= (Item_basic_constant *)args[i];
|
||||||
|
|
||||||
switch (args[i]->type()) {
|
switch (args[i]->real_type()) {
|
||||||
case COND::STRING_ITEM:
|
case COND::STRING_ITEM:
|
||||||
case COND::INT_ITEM:
|
case COND::INT_ITEM:
|
||||||
case COND::REAL_ITEM:
|
case COND::REAL_ITEM:
|
||||||
@ -1832,7 +1814,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
return NULL; // To be clarified
|
return NULL; // To be clarified
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Value=%.*s\n", res->length(), res->ptr());
|
htrc("Value=%.*s\n", res->length(), res->ptr());
|
||||||
|
|
||||||
// IN and BETWEEN clauses should be col VOP list
|
// IN and BETWEEN clauses should be col VOP list
|
||||||
if (!i && (x || ismul))
|
if (!i && (x || ismul))
|
||||||
@ -1877,7 +1859,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("Unsupported condition\n");
|
htrc("Unsupported condition\n");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endif's type
|
} // endif's type
|
||||||
@ -1912,32 +1894,33 @@ const COND *ha_connect::cond_push(const COND *cond)
|
|||||||
if (tdbp) {
|
if (tdbp) {
|
||||||
AMT tty= tdbp->GetAmType();
|
AMT tty= tdbp->GetAmType();
|
||||||
bool x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
bool x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC);
|
||||||
|
bool b= (tty == TYPE_AM_WMI || tty == TYPE_AM_ODBC ||
|
||||||
|
tty == TYPE_AM_TBL || tty == TYPE_AM_MYSQL ||
|
||||||
|
tty == TYPE_AM_PLG || x);
|
||||||
|
|
||||||
if (tty == TYPE_AM_WMI || tty == TYPE_AM_ODBC ||
|
if (b) {
|
||||||
tty == TYPE_AM_TBL || tty == TYPE_AM_MYSQL ||
|
|
||||||
tty == TYPE_AM_PLG || x) {
|
|
||||||
PGLOBAL& g= xp->g;
|
PGLOBAL& g= xp->g;
|
||||||
PFIL filp= (PFIL)PlugSubAlloc(g, NULL, sizeof(FILTER));
|
PCFIL filp= (PCFIL)PlugSubAlloc(g, NULL, sizeof(CONDFIL));
|
||||||
|
|
||||||
filp->Body= (char*)PlugSubAlloc(g, NULL, (x) ? 128 : 0);
|
filp->Body= (char*)PlugSubAlloc(g, NULL, (x) ? 128 : 0);
|
||||||
*filp->Body= 0;
|
*filp->Body= 0;
|
||||||
filp->Op= OP_XX;
|
filp->Op= OP_XX;
|
||||||
filp->Cmds= NULL;
|
filp->Cmds= NULL;
|
||||||
|
|
||||||
if (CheckCond(g, filp, tty, (Item *)cond)) {
|
if (CheckCond(g, filp, tty, (Item *)cond)) {
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("cond_push: %s\n", filp->Body);
|
htrc("cond_push: %s\n", filp->Body);
|
||||||
|
|
||||||
if (!x)
|
if (!x)
|
||||||
PlugSubAlloc(g, NULL, strlen(filp->Body) + 1);
|
PlugSubAlloc(g, NULL, strlen(filp->Body) + 1);
|
||||||
else
|
else
|
||||||
cond= NULL; // Does this work?
|
cond= NULL; // Does this work?
|
||||||
|
|
||||||
tdbp->SetFilter(filp);
|
tdbp->SetCondFil(filp);
|
||||||
} else if (x && cond)
|
} else if (x && cond)
|
||||||
tdbp->SetFilter(filp); // Wrong filter
|
tdbp->SetCondFil(filp); // Wrong filter
|
||||||
|
|
||||||
} // endif tty
|
} // endif b
|
||||||
|
|
||||||
} // endif tdbp
|
} // endif tdbp
|
||||||
|
|
||||||
@ -2019,7 +2002,7 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
|
|||||||
DBUG_ENTER("ha_connect::open");
|
DBUG_ENTER("ha_connect::open");
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("open: name=%s mode=%d test=%u\n", name, mode, test_if_locked);
|
htrc("open: name=%s mode=%d test=%u\n", name, mode, test_if_locked);
|
||||||
|
|
||||||
if (!(share= get_share()))
|
if (!(share= get_share()))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@ -2031,17 +2014,9 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
|
|||||||
PGLOBAL g= (xp) ? xp->g : NULL;
|
PGLOBAL g= (xp) ? xp->g : NULL;
|
||||||
|
|
||||||
// Try to set the database environment
|
// Try to set the database environment
|
||||||
if (g) {
|
if (g)
|
||||||
rc= (CntCheckDB(g, this, name)) ? (-2) : 0;
|
rc= (CntCheckDB(g, this, name)) ? (-2) : 0;
|
||||||
#if defined(MRRBKA_SUPPORT)
|
else
|
||||||
if (g->Mrr) {
|
|
||||||
// This should only happen for the mrr secondary handler
|
|
||||||
mrr= true;
|
|
||||||
g->Mrr= false;
|
|
||||||
} else
|
|
||||||
mrr= false;
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
} else
|
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@ -2062,7 +2037,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT* check_opt)
|
|||||||
tdbp= GetTDB(g);
|
tdbp= GetTDB(g);
|
||||||
dup->Check |= CHK_OPT;
|
dup->Check |= CHK_OPT;
|
||||||
|
|
||||||
if (tdbp || (tdbp= GetTDB(g))) {
|
if (tdbp) {
|
||||||
if (!((PTDBASE)tdbp)->GetDef()->Indexable()) {
|
if (!((PTDBASE)tdbp)->GetDef()->Indexable()) {
|
||||||
sprintf(g->Message, "optimize: Table %s is not indexable", tdbp->GetName());
|
sprintf(g->Message, "optimize: Table %s is not indexable", tdbp->GetName());
|
||||||
my_message(ER_INDEX_REBUILD, g->Message, MYF(0));
|
my_message(ER_INDEX_REBUILD, g->Message, MYF(0));
|
||||||
@ -2179,7 +2154,7 @@ int ha_connect::write_row(uchar *buf)
|
|||||||
// Return result code from write operation
|
// Return result code from write operation
|
||||||
if (CntWriteRow(g, tdbp)) {
|
if (CntWriteRow(g, tdbp)) {
|
||||||
DBUG_PRINT("write_row", ("%s", g->Message));
|
DBUG_PRINT("write_row", ("%s", g->Message));
|
||||||
printf("write_row: %s\n", g->Message);
|
htrc("write_row: %s\n", g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} // endif RC
|
} // endif RC
|
||||||
|
|
||||||
@ -2216,7 +2191,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data)
|
|||||||
DBUG_ENTER("ha_connect::update_row");
|
DBUG_ENTER("ha_connect::update_row");
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
printf("update_row: old=%s new=%s\n", old_data, new_data);
|
htrc("update_row: old=%s new=%s\n", old_data, new_data);
|
||||||
|
|
||||||
// Check values for possible change in indexed column
|
// Check values for possible change in indexed column
|
||||||
if ((rc= CheckRecord(g, old_data, new_data)))
|
if ((rc= CheckRecord(g, old_data, new_data)))
|
||||||
@ -2224,7 +2199,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data)
|
|||||||
|
|
||||||
if (CntUpdateRow(g, tdbp)) {
|
if (CntUpdateRow(g, tdbp)) {
|
||||||
DBUG_PRINT("update_row", ("%s", g->Message));
|
DBUG_PRINT("update_row", ("%s", g->Message));
|
||||||
printf("update_row CONNECT: %s\n", g->Message);
|
htrc("update_row CONNECT: %s\n", g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} // endif RC
|
} // endif RC
|
||||||
|
|
||||||
@ -2258,7 +2233,7 @@ int ha_connect::delete_row(const uchar *buf)
|
|||||||
|
|
||||||
if (CntDeleteRow(xp->g, tdbp, false)) {
|
if (CntDeleteRow(xp->g, tdbp, false)) {
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
printf("delete_row CONNECT: %s\n", xp->g->Message);
|
htrc("delete_row CONNECT: %s\n", xp->g->Message);
|
||||||
} // endif DeleteRow
|
} // endif DeleteRow
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@ -2275,7 +2250,7 @@ int ha_connect::index_init(uint idx, bool sorted)
|
|||||||
DBUG_ENTER("index_init");
|
DBUG_ENTER("index_init");
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted);
|
htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted);
|
||||||
|
|
||||||
if ((rc= rnd_init(0)))
|
if ((rc= rnd_init(0)))
|
||||||
return rc;
|
return rc;
|
||||||
@ -2291,7 +2266,7 @@ int ha_connect::index_init(uint idx, bool sorted)
|
|||||||
|
|
||||||
if (indexing <= 0) {
|
if (indexing <= 0) {
|
||||||
DBUG_PRINT("index_init", ("%s", g->Message));
|
DBUG_PRINT("index_init", ("%s", g->Message));
|
||||||
printf("index_init CONNECT: %s\n", g->Message);
|
htrc("index_init CONNECT: %s\n", g->Message);
|
||||||
active_index= MAX_KEY;
|
active_index= MAX_KEY;
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} else {
|
} else {
|
||||||
@ -2307,7 +2282,7 @@ int ha_connect::index_init(uint idx, bool sorted)
|
|||||||
} // endif indexing
|
} // endif indexing
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("index_init: rc=%d indexing=%d active_index=%d\n",
|
htrc("index_init: rc=%d indexing=%d active_index=%d\n",
|
||||||
rc, indexing, active_index);
|
rc, indexing, active_index);
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@ -2320,9 +2295,6 @@ int ha_connect::index_end()
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("index_end");
|
DBUG_ENTER("index_end");
|
||||||
active_index= MAX_KEY;
|
active_index= MAX_KEY;
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
ds_mrr.dsmrr_close();
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
DBUG_RETURN(rnd_end());
|
DBUG_RETURN(rnd_end());
|
||||||
} // end of index_end
|
} // end of index_end
|
||||||
|
|
||||||
@ -2350,13 +2322,13 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const uchar *key, uint key_len
|
|||||||
break;
|
break;
|
||||||
default: // Read error
|
default: // Read error
|
||||||
DBUG_PRINT("ReadIndexed", ("%s", xp->g->Message));
|
DBUG_PRINT("ReadIndexed", ("%s", xp->g->Message));
|
||||||
printf("ReadIndexed: %s\n", xp->g->Message);
|
htrc("ReadIndexed: %s\n", xp->g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
break;
|
break;
|
||||||
} // endswitch RC
|
} // endswitch RC
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
printf("ReadIndexed: op=%d rc=%d\n", op, rc);
|
htrc("ReadIndexed: op=%d rc=%d\n", op, rc);
|
||||||
|
|
||||||
table->status= (rc == RC_OK) ? 0 : STATUS_NOT_FOUND;
|
table->status= (rc == RC_OK) ? 0 : STATUS_NOT_FOUND;
|
||||||
return rc;
|
return rc;
|
||||||
@ -2399,7 +2371,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len,
|
|||||||
} // endswitch find_flag
|
} // endswitch find_flag
|
||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
printf("%p index_read: op=%d\n", this, op);
|
htrc("%p index_read: op=%d\n", this, op);
|
||||||
|
|
||||||
if (indexing > 0)
|
if (indexing > 0)
|
||||||
rc= ReadIndexed(buf, op, key, key_len);
|
rc= ReadIndexed(buf, op, key, key_len);
|
||||||
@ -2542,7 +2514,7 @@ int ha_connect::rnd_init(bool scan)
|
|||||||
} // endif xmod
|
} // endif xmod
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("rnd_init: this=%p scan=%d xmod=%d alter=%d\n",
|
htrc("rnd_init: this=%p scan=%d xmod=%d alter=%d\n",
|
||||||
this, scan, xmod, alter);
|
this, scan, xmod, alter);
|
||||||
|
|
||||||
if (!g || !table || xmod == MODE_INSERT)
|
if (!g || !table || xmod == MODE_INSERT)
|
||||||
@ -2589,9 +2561,6 @@ int ha_connect::rnd_end()
|
|||||||
// if (tdbp && xp->last_query_id == valid_query_id)
|
// if (tdbp && xp->last_query_id == valid_query_id)
|
||||||
// rc= CloseTable(xp->g);
|
// rc= CloseTable(xp->g);
|
||||||
|
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
ds_mrr.dsmrr_close();
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
} // end of rnd_end
|
} // end of rnd_end
|
||||||
|
|
||||||
@ -2637,22 +2606,23 @@ int ha_connect::rnd_next(uchar *buf)
|
|||||||
rc= HA_ERR_RECORD_DELETED;
|
rc= HA_ERR_RECORD_DELETED;
|
||||||
break;
|
break;
|
||||||
default: // Read error
|
default: // Read error
|
||||||
printf("rnd_next CONNECT: %s\n", xp->g->Message);
|
htrc("rnd_next CONNECT: %s\n", xp->g->Message);
|
||||||
rc= (records()) ? HA_ERR_INTERNAL_ERROR : HA_ERR_END_OF_FILE;
|
rc= (records()) ? HA_ERR_INTERNAL_ERROR : HA_ERR_END_OF_FILE;
|
||||||
break;
|
break;
|
||||||
} // endswitch RC
|
} // endswitch RC
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
if (xtrace > 1 && (rc || !(xp->nrd++ % 16384))) {
|
||||||
if (rc || !(xp->nrd++ % 16384)) {
|
|
||||||
ulonglong tb2= my_interval_timer();
|
ulonglong tb2= my_interval_timer();
|
||||||
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
||||||
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
||||||
rc, (uint)xp->nrd, (uint)xp->fnd,
|
rc, (uint)xp->nrd, (uint)xp->fnd,
|
||||||
(uint)xp->nfd, elapsed));
|
(uint)xp->nfd, elapsed));
|
||||||
|
htrc("rnd_next: rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
||||||
|
rc, (uint)xp->nrd, (uint)xp->fnd,
|
||||||
|
(uint)xp->nfd, elapsed);
|
||||||
xp->tb1= tb2;
|
xp->tb1= tb2;
|
||||||
xp->fnd= xp->nfd= 0;
|
xp->fnd= xp->nfd= 0;
|
||||||
} // endif nrd
|
} // endif nrd
|
||||||
#endif
|
|
||||||
|
|
||||||
table->status= (!rc) ? 0 : STATUS_NOT_FOUND;
|
table->status= (!rc) ? 0 : STATUS_NOT_FOUND;
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
@ -2766,7 +2736,7 @@ int ha_connect::info(uint flag)
|
|||||||
DBUG_ENTER("ha_connect::info");
|
DBUG_ENTER("ha_connect::info");
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
|
||||||
|
|
||||||
if (!valid_info) {
|
if (!valid_info) {
|
||||||
// tdbp must be available to get updated info
|
// tdbp must be available to get updated info
|
||||||
@ -2879,7 +2849,7 @@ int ha_connect::delete_all_rows()
|
|||||||
|
|
||||||
if (!(rc= OpenTable(g))) {
|
if (!(rc= OpenTable(g))) {
|
||||||
if (CntDeleteRow(g, tdbp, true)) {
|
if (CntDeleteRow(g, tdbp, true)) {
|
||||||
printf("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@ -2989,8 +2959,8 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
{
|
{
|
||||||
if (xtrace) {
|
if (xtrace) {
|
||||||
LEX_STRING *query_string= thd_query_string(thd);
|
LEX_STRING *query_string= thd_query_string(thd);
|
||||||
printf("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
|
htrc("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
|
||||||
printf("Cmd=%.*s\n", (int) query_string->length, query_string->str);
|
htrc("Cmd=%.*s\n", (int) query_string->length, query_string->str);
|
||||||
} // endif xtrace
|
} // endif xtrace
|
||||||
|
|
||||||
// Next code is temporarily replaced until sql_command is set
|
// Next code is temporarily replaced until sql_command is set
|
||||||
@ -3040,7 +3010,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
newmode= MODE_ALTER;
|
newmode= MODE_ALTER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unsupported sql_command=%d", thd_sql_command(thd));
|
htrc("Unsupported sql_command=%d", thd_sql_command(thd));
|
||||||
strcpy(g->Message, "CONNECT Unsupported command");
|
strcpy(g->Message, "CONNECT Unsupported command");
|
||||||
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
||||||
newmode= MODE_ERROR;
|
newmode= MODE_ERROR;
|
||||||
@ -3085,7 +3055,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
newmode= MODE_ALTER;
|
newmode= MODE_ALTER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Unsupported sql_command=%d", thd_sql_command(thd));
|
htrc("Unsupported sql_command=%d", thd_sql_command(thd));
|
||||||
strcpy(g->Message, "CONNECT Unsupported command");
|
strcpy(g->Message, "CONNECT Unsupported command");
|
||||||
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
|
||||||
newmode= MODE_ERROR;
|
newmode= MODE_ERROR;
|
||||||
@ -3095,7 +3065,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
|
|||||||
} // endif's newmode
|
} // endif's newmode
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("New mode=%d\n", newmode);
|
htrc("New mode=%d\n", newmode);
|
||||||
|
|
||||||
return newmode;
|
return newmode;
|
||||||
} // end of check_mode
|
} // end of check_mode
|
||||||
@ -3170,7 +3140,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
DBUG_ASSERT(thd == current_thd);
|
DBUG_ASSERT(thd == current_thd);
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d\n",
|
htrc("external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d\n",
|
||||||
this, thd, xp, g, lock_type);
|
this, thd, xp, g, lock_type);
|
||||||
|
|
||||||
if (!g)
|
if (!g)
|
||||||
@ -3309,7 +3279,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
|
|
||||||
if (check_privileges(thd, options, table->s->db.str)) {
|
if (check_privileges(thd, options, table->s->db.str)) {
|
||||||
strcpy(g->Message, "This operation requires the FILE privilege");
|
strcpy(g->Message, "This operation requires the FILE privilege");
|
||||||
printf("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||||
} // endif check_privileges
|
} // endif check_privileges
|
||||||
|
|
||||||
@ -3343,18 +3313,18 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
|
|
||||||
if (xtrace) {
|
if (xtrace) {
|
||||||
#if 0
|
#if 0
|
||||||
printf("xcheck=%d cras=%d\n", xcheck, cras);
|
htrc("xcheck=%d cras=%d\n", xcheck, cras);
|
||||||
|
|
||||||
if (xcheck)
|
if (xcheck)
|
||||||
printf("oldsep=%d oldpix=%p\n",
|
htrc("oldsep=%d oldpix=%p\n",
|
||||||
((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix);
|
((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix);
|
||||||
#endif // 0
|
#endif // 0
|
||||||
printf("Calling CntCheckDB db=%s cras=%d\n", GetDBName(NULL), cras);
|
htrc("Calling CntCheckDB db=%s cras=%d\n", GetDBName(NULL), cras);
|
||||||
} // endif xtrace
|
} // endif xtrace
|
||||||
|
|
||||||
// Set or reset the good database environment
|
// Set or reset the good database environment
|
||||||
if (CntCheckDB(g, this, GetDBName(NULL))) {
|
if (CntCheckDB(g, this, GetDBName(NULL))) {
|
||||||
printf("%p external_lock: %s\n", this, g->Message);
|
htrc("%p external_lock: %s\n", this, g->Message);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
// This can NOT be called without open called first, but
|
// This can NOT be called without open called first, but
|
||||||
// the table can have been closed since then
|
// the table can have been closed since then
|
||||||
@ -3375,7 +3345,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
} // endif tdbp
|
} // endif tdbp
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("external_lock: rc=%d\n", rc);
|
htrc("external_lock: rc=%d\n", rc);
|
||||||
|
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
} // end of external_lock
|
} // end of external_lock
|
||||||
@ -3517,10 +3487,10 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
|
|||||||
|
|
||||||
if (xtrace) {
|
if (xtrace) {
|
||||||
if (to)
|
if (to)
|
||||||
printf("rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s\n",
|
htrc("rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s\n",
|
||||||
this, thd, sqlcom, name, to);
|
this, thd, sqlcom, name, to);
|
||||||
else
|
else
|
||||||
printf("delete_table: this=%p thd=%p sqlcom=%d name=%s\n",
|
htrc("delete_table: this=%p thd=%p sqlcom=%d name=%s\n",
|
||||||
this, thd, sqlcom, name);
|
this, thd, sqlcom, name);
|
||||||
|
|
||||||
} // endif xtrace
|
} // endif xtrace
|
||||||
@ -3625,7 +3595,7 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
|
|||||||
index_init(inx, false);
|
index_init(inx, false);
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("records_in_range: inx=%d indexing=%d\n", inx, indexing);
|
htrc("records_in_range: inx=%d indexing=%d\n", inx, indexing);
|
||||||
|
|
||||||
if (indexing > 0) {
|
if (indexing > 0) {
|
||||||
int nval;
|
int nval;
|
||||||
@ -4626,7 +4596,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
table= table_arg; // Used by called functions
|
table= table_arg; // Used by called functions
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s\n",
|
htrc("create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s\n",
|
||||||
this, thd, xp, g, sqlcom, GetTableName());
|
this, thd, xp, g, sqlcom, GetTableName());
|
||||||
|
|
||||||
// CONNECT engine specific table options:
|
// CONNECT engine specific table options:
|
||||||
@ -4954,7 +4924,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("xchk=%p createas=%d\n", g->Xchk, g->Createas);
|
htrc("xchk=%p createas=%d\n", g->Xchk, g->Createas);
|
||||||
|
|
||||||
// To check whether indices have to be made or remade
|
// To check whether indices have to be made or remade
|
||||||
if (!g->Xchk) {
|
if (!g->Xchk) {
|
||||||
@ -4985,7 +4955,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
cat->SetDataPath(g, table_arg->s->db.str);
|
cat->SetDataPath(g, table_arg->s->db.str);
|
||||||
|
|
||||||
if ((rc= optimize(table->in_use, NULL))) {
|
if ((rc= optimize(table->in_use, NULL))) {
|
||||||
printf("Create rc=%d %s\n", rc, g->Message);
|
htrc("Create rc=%d %s\n", rc, g->Message);
|
||||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
} else
|
} else
|
||||||
@ -5025,7 +4995,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
g->Xchk= NULL;
|
g->Xchk= NULL;
|
||||||
|
|
||||||
if (xtrace && g->Xchk)
|
if (xtrace && g->Xchk)
|
||||||
printf("oldsep=%d newsep=%d oldpix=%p newpix=%p\n",
|
htrc("oldsep=%d newsep=%d oldpix=%p newpix=%p\n",
|
||||||
xcp->oldsep, xcp->newsep, xcp->oldpix, xcp->newpix);
|
xcp->oldsep, xcp->newsep, xcp->oldpix, xcp->newpix);
|
||||||
|
|
||||||
// if (g->Xchk &&
|
// if (g->Xchk &&
|
||||||
@ -5306,7 +5276,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
|
|||||||
tshp= NULL;
|
tshp= NULL;
|
||||||
|
|
||||||
if (xtrace && g->Xchk)
|
if (xtrace && g->Xchk)
|
||||||
printf(
|
htrc(
|
||||||
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
||||||
xcp->oldsep, xcp->newsep,
|
xcp->oldsep, xcp->newsep,
|
||||||
SVP(xcp->oldopn), SVP(xcp->newopn),
|
SVP(xcp->oldopn), SVP(xcp->newopn),
|
||||||
@ -5419,86 +5389,6 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info,
|
|||||||
} // end of check_if_incompatible_data
|
} // end of check_if_incompatible_data
|
||||||
|
|
||||||
|
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
//#error This is not implemented yet
|
|
||||||
/****************************************************************************
|
|
||||||
* CONNECT MRR implementation: use DS-MRR
|
|
||||||
This is just copied from myisam
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
int ha_connect::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
|
|
||||||
uint n_ranges, uint mode,
|
|
||||||
HANDLER_BUFFER *buf)
|
|
||||||
{
|
|
||||||
return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
|
|
||||||
} // end of multi_range_read_init
|
|
||||||
|
|
||||||
int ha_connect::multi_range_read_next(range_id_t *range_info)
|
|
||||||
{
|
|
||||||
return ds_mrr.dsmrr_next(range_info);
|
|
||||||
} // end of multi_range_read_next
|
|
||||||
|
|
||||||
ha_rows ha_connect::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
|
|
||||||
void *seq_init_param,
|
|
||||||
uint n_ranges, uint *bufsz,
|
|
||||||
uint *flags, Cost_estimate *cost)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
This call is here because there is no location where this->table would
|
|
||||||
already be known.
|
|
||||||
TODO: consider moving it into some per-query initialization call.
|
|
||||||
*/
|
|
||||||
ds_mrr.init(this, table);
|
|
||||||
|
|
||||||
// MMR is implemented for "local" file based tables only
|
|
||||||
if (!IsFileType(GetRealType(GetTableOptionStruct(table))))
|
|
||||||
*flags|= HA_MRR_USE_DEFAULT_IMPL;
|
|
||||||
|
|
||||||
ha_rows rows= ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges,
|
|
||||||
bufsz, flags, cost);
|
|
||||||
xp->g->Mrr= !(*flags & HA_MRR_USE_DEFAULT_IMPL);
|
|
||||||
return rows;
|
|
||||||
} // end of multi_range_read_info_const
|
|
||||||
|
|
||||||
ha_rows ha_connect::multi_range_read_info(uint keyno, uint n_ranges, uint keys,
|
|
||||||
uint key_parts, uint *bufsz,
|
|
||||||
uint *flags, Cost_estimate *cost)
|
|
||||||
{
|
|
||||||
ds_mrr.init(this, table);
|
|
||||||
|
|
||||||
// MMR is implemented for "local" file based tables only
|
|
||||||
if (!IsFileType(GetRealType(GetTableOptionStruct(table))))
|
|
||||||
*flags|= HA_MRR_USE_DEFAULT_IMPL;
|
|
||||||
|
|
||||||
ha_rows rows= ds_mrr.dsmrr_info(keyno, n_ranges, keys, key_parts, bufsz,
|
|
||||||
flags, cost);
|
|
||||||
xp->g->Mrr= !(*flags & HA_MRR_USE_DEFAULT_IMPL);
|
|
||||||
return rows;
|
|
||||||
} // end of multi_range_read_info
|
|
||||||
|
|
||||||
|
|
||||||
int ha_connect::multi_range_read_explain_info(uint mrr_mode, char *str,
|
|
||||||
size_t size)
|
|
||||||
{
|
|
||||||
return ds_mrr.dsmrr_explain_info(mrr_mode, str, size);
|
|
||||||
} // end of multi_range_read_explain_info
|
|
||||||
|
|
||||||
/* CONNECT MRR implementation ends */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Does this make sens for CONNECT?
|
|
||||||
Item *ha_connect::idx_cond_push(uint keyno_arg, Item* idx_cond_arg)
|
|
||||||
{
|
|
||||||
pushed_idx_cond_keyno= keyno_arg;
|
|
||||||
pushed_idx_cond= idx_cond_arg;
|
|
||||||
in_range_check_pushed_down= TRUE;
|
|
||||||
if (active_index == pushed_idx_cond_keyno)
|
|
||||||
mi_set_index_cond_func(file, handler_index_cond_check, this);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif // 0
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
|
|
||||||
struct st_mysql_storage_engine connect_storage_engine=
|
struct st_mysql_storage_engine connect_storage_engine=
|
||||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||||
|
|
||||||
|
@ -122,8 +122,6 @@ struct ha_table_option_struct {
|
|||||||
struct ha_field_option_struct
|
struct ha_field_option_struct
|
||||||
{
|
{
|
||||||
ulonglong offset;
|
ulonglong offset;
|
||||||
ulonglong freq; // Not used by this version
|
|
||||||
ulonglong opt; // Not used by this version
|
|
||||||
ulonglong fldlen;
|
ulonglong fldlen;
|
||||||
const char *dateformat;
|
const char *dateformat;
|
||||||
const char *fieldformat;
|
const char *fieldformat;
|
||||||
@ -243,11 +241,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
ulong index_flags(uint inx, uint part, bool all_parts) const
|
ulong index_flags(uint inx, uint part, bool all_parts) const
|
||||||
{
|
{
|
||||||
return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER
|
return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY;
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
| HA_KEYREAD_ONLY
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
;
|
|
||||||
} // end of index_flags
|
} // end of index_flags
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
@ -334,7 +328,7 @@ public:
|
|||||||
condition stack.
|
condition stack.
|
||||||
*/
|
*/
|
||||||
virtual const COND *cond_push(const COND *cond);
|
virtual const COND *cond_push(const COND *cond);
|
||||||
PFIL CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond);
|
PCFIL CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond);
|
||||||
const char *GetValStr(OPVAL vop, bool neg);
|
const char *GetValStr(OPVAL vop, bool neg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -424,6 +418,9 @@ const char *GetValStr(OPVAL vop, bool neg);
|
|||||||
*/
|
*/
|
||||||
//int index_last(uchar *buf);
|
//int index_last(uchar *buf);
|
||||||
|
|
||||||
|
/* Index condition pushdown implementation */
|
||||||
|
//Item *idx_cond_push(uint keyno, Item* idx_cond);
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
Unlike index_init(), rnd_init() can be called two consecutive times
|
Unlike index_init(), rnd_init() can be called two consecutive times
|
||||||
without rnd_end() in between (it only makes sense if scan=1). In this
|
without rnd_end() in between (it only makes sense if scan=1). In this
|
||||||
@ -499,28 +496,4 @@ public:
|
|||||||
char *index_file_name;
|
char *index_file_name;
|
||||||
uint int_table_flags; // Inherited from MyISAM
|
uint int_table_flags; // Inherited from MyISAM
|
||||||
bool enable_activate_all_index; // Inherited from MyISAM
|
bool enable_activate_all_index; // Inherited from MyISAM
|
||||||
|
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
/**
|
|
||||||
* Multi Range Read interface
|
|
||||||
*/
|
|
||||||
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
|
|
||||||
uint n_ranges, uint mode, HANDLER_BUFFER *buf);
|
|
||||||
int multi_range_read_next(range_id_t *range_info);
|
|
||||||
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
|
|
||||||
void *seq_init_param,
|
|
||||||
uint n_ranges, uint *bufsz,
|
|
||||||
uint *flags, Cost_estimate *cost);
|
|
||||||
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
|
|
||||||
uint key_parts, uint *bufsz,
|
|
||||||
uint *flags, Cost_estimate *cost);
|
|
||||||
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size);
|
|
||||||
|
|
||||||
int reset(void) {ds_mrr.dsmrr_close(); return 0;}
|
|
||||||
|
|
||||||
/* Index condition pushdown implementation */
|
|
||||||
// Item *idx_cond_push(uint keyno, Item* idx_cond);
|
|
||||||
private:
|
|
||||||
DsMrr_impl ds_mrr;
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
}; // end of ha_connect class definition
|
}; // end of ha_connect class definition
|
||||||
|
@ -63,15 +63,10 @@ class DllItem MYSQLC {
|
|||||||
bool Connected(void);
|
bool Connected(void);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
// int GetCurPos(void) {return (m_Res) ? N : 0;}
|
|
||||||
// int GetProgCur(void) {return N;}
|
|
||||||
int GetResultSize(PGLOBAL g, PSZ sql);
|
int GetResultSize(PGLOBAL g, PSZ sql);
|
||||||
int Open(PGLOBAL g, const char *host, const char *db,
|
int Open(PGLOBAL g, const char *host, const char *db,
|
||||||
const char *user= "root", const char *pwd= "*",
|
const char *user= "root", const char *pwd= "*",
|
||||||
int pt= 0);
|
int pt= 0);
|
||||||
//ulong GetThreadID(void);
|
|
||||||
//ulong ServerVersion(void);
|
|
||||||
//const char *ServerInfo(void);
|
|
||||||
int KillQuery(ulong id);
|
int KillQuery(ulong id);
|
||||||
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
|
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
|
||||||
int ExecSQLcmd(PGLOBAL g, const char *query, int *w);
|
int ExecSQLcmd(PGLOBAL g, const char *query, int *w);
|
||||||
@ -87,7 +82,6 @@ class DllItem MYSQLC {
|
|||||||
void Rewind(void);
|
void Rewind(void);
|
||||||
void FreeResult(void);
|
void FreeResult(void);
|
||||||
void Close(void);
|
void Close(void);
|
||||||
//void DiscardResults(void);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MYSQL_FIELD *GetNextField(void);
|
MYSQL_FIELD *GetNextField(void);
|
||||||
|
@ -62,146 +62,6 @@ enum INFO {INDX_RC, /* Index of PlugDB return code field */
|
|||||||
INDX_SIZE, /* Index of returned data size field */
|
INDX_SIZE, /* Index of returned data size field */
|
||||||
INDX_MAX}; /* Size of info array */
|
INDX_MAX}; /* Size of info array */
|
||||||
|
|
||||||
#ifdef NOT_USED
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Internal message types. */
|
|
||||||
/**************************************************************************/
|
|
||||||
enum MSGTYP {MST_OPEN = 10, /* Code for old connecting message */
|
|
||||||
MST_COMMAND = 11, /* Code for send command message */
|
|
||||||
MST_RESULT = 12, /* Code for get result message */
|
|
||||||
MST_CLOSE = 13, /* Code for disconnecting message */
|
|
||||||
MST_PROGRESS = 14, /* Code for progress message */
|
|
||||||
MST_CANCEL = 15, /* Code for cancel message */
|
|
||||||
MST_PROCESSED = 16, /* Code for already processed msg */
|
|
||||||
MST_ERROR = 17, /* Code for get error message */
|
|
||||||
MST_CHAR = 18, /* Code for get char value message */
|
|
||||||
MST_LONG = 19, /* Code for get int value message */
|
|
||||||
MST_COLUMN = 20, /* Code for get col value message */
|
|
||||||
MST_MESSAGE = 21, /* Code for get message message */
|
|
||||||
MST_HEADER = 22, /* Code for get header message */
|
|
||||||
MST_SOCKET = 23, /* Code for socket error message */
|
|
||||||
MST_SHUTDOWN = 24, /* Code for shutdown message */
|
|
||||||
MST_SOCKPROG = 25, /* Code for socket progress message */
|
|
||||||
MST_POST = 26, /* Code for post command message */
|
|
||||||
MST_NEW_OPEN = 27, /* Code for new connecting message */
|
|
||||||
MST_PROG_NUM = 5}; /* Num of integers in progress msg */
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Vendors. */
|
|
||||||
/**************************************************************************/
|
|
||||||
enum VENDOR {VDR_UNKNOWN = -2, /* Not known or not connected */
|
|
||||||
VDR_PlugDB = -1, /* PlugDB */
|
|
||||||
VDR_OTHER = 0}; /* OEM */
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Attribute keys of Result Description structure (arranged by type). */
|
|
||||||
/**************************************************************************/
|
|
||||||
enum CKEYS {K_ProgMsg, K_Lang, K_ActiveDB, K_Cmax};
|
|
||||||
enum LKEYS {K_NBcol, K_NBlin, K_CurPos, K_RC, K_Result, K_Elapsed,
|
|
||||||
K_Continued, K_Maxsize, K_Affrows, K_Lmax, K_Maxcol,
|
|
||||||
K_Maxres, K_Maxlin, K_NBparm};
|
|
||||||
enum NKEYS {K_Type, K_Length, K_Prec, K_DataLen, K_Unsigned, K_Nmax};
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Result description structures. */
|
|
||||||
/**************************************************************************/
|
|
||||||
typedef struct _MsgTagAttr {
|
|
||||||
bool fSupplied;
|
|
||||||
char Attr[MAXMESSAGE];
|
|
||||||
} MTAG, *PMTAG;
|
|
||||||
|
|
||||||
typedef struct _CharTagAttr {
|
|
||||||
bool fSupplied;
|
|
||||||
char Attr[MAXDBNAME];
|
|
||||||
} CTAG, *PCTAG;
|
|
||||||
|
|
||||||
typedef struct _LongTagAttr {
|
|
||||||
bool fSupplied;
|
|
||||||
int Attr;
|
|
||||||
} LTAG, *PLTAG;
|
|
||||||
|
|
||||||
typedef struct _ColVar {
|
|
||||||
LTAG Lat[K_Nmax];
|
|
||||||
CTAG Cat;
|
|
||||||
} COLVAR, *LPCOLVAR;
|
|
||||||
|
|
||||||
typedef struct _ResDesc {
|
|
||||||
int Maxcol; /* Max number of columns */
|
|
||||||
int Colnum; /* Number of columns */
|
|
||||||
MTAG Mat; /* Message */
|
|
||||||
CTAG Cat[K_Cmax]; /* Character attributes */
|
|
||||||
LTAG Lat[K_Lmax]; /* Long int attributes */
|
|
||||||
COLVAR Col[1]; /* Column attributes */
|
|
||||||
} RDESC, *PRDESC;
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Exported PlugDB client functions in Plgcnx DLL. */
|
|
||||||
/**************************************************************************/
|
|
||||||
#if !defined(CNXFUNC)
|
|
||||||
#if defined(UNIX) || defined(UNIV_LINUX)
|
|
||||||
#undef __stdcall
|
|
||||||
#define __stdcall
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NOLIB) /* Dynamic link of plgcnx.dll */
|
|
||||||
#define CNXFUNC(f) (__stdcall *f)
|
|
||||||
#else /* LIB */ /* Static link with plgcnx.lib */
|
|
||||||
#define CNXFUNC(f) __stdcall f
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(CNXKEY)
|
|
||||||
#define CNXKEY uint
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(XTRN)
|
|
||||||
#define XTRN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#if !defined(NO_FUNC)
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
XTRN int CNXFUNC(PLGConnect) (CNXKEY *, const char *, bool);
|
|
||||||
XTRN int CNXFUNC(PLGSendCommand) (CNXKEY, const char *, void *, int, int *);
|
|
||||||
XTRN int CNXFUNC(PLGGetResult) (CNXKEY, void *, int, int *, bool);
|
|
||||||
XTRN int CNXFUNC(PLGDisconnect) (CNXKEY);
|
|
||||||
XTRN int CNXFUNC(PLGGetErrorMsg) (CNXKEY, char *, int, int *);
|
|
||||||
XTRN bool CNXFUNC(PLGGetCharValue)(CNXKEY, char *, int, int);
|
|
||||||
XTRN bool CNXFUNC(PLGGetIntValue)(CNXKEY, int *, int);
|
|
||||||
XTRN bool CNXFUNC(PLGGetColValue) (CNXKEY, int *, int, int);
|
|
||||||
XTRN bool CNXFUNC(PLGGetMessage) (CNXKEY, char *, int);
|
|
||||||
XTRN bool CNXFUNC(PLGGetHeader) (CNXKEY, char *, int, int, int);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
//#endif /* !NO_FUNC */
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Convenience function Definitions */
|
|
||||||
/**************************************************************************/
|
|
||||||
#define PLGPostCommand(T,C) PLGSendCommand(T,C,NULL,0,NULL)
|
|
||||||
#if defined(FNCMAC)
|
|
||||||
#define PLGGetProgMsg(T,C,S) PLGGetCharValue(T,C,S,K_ProgMsg)
|
|
||||||
#define PLGGetLangID(T,C,S) PLGGetCharValue(T,C,S,K_Lang)
|
|
||||||
#define PLGGetActiveDB(T,C,S) PLGGetCharValue(T,C,S,K_ActiveDB)
|
|
||||||
#define PLGGetCursorPos(T,L) PLGGetIntValue(T,L,K_CurPos)
|
|
||||||
#define PLGGetResultType(T,L) PLGGetIntValue(T,L,K_Result)
|
|
||||||
#define PLGGetNBcol(T,L) PLGGetIntValue(T,L,K_NBcol)
|
|
||||||
#define PLGGetNBlin(T,L) PLGGetIntValue(T,L,K_NBlin)
|
|
||||||
#define PLGGetRetCode(T,L) PLGGetIntValue(T,L,K_RC)
|
|
||||||
#define PLGGetElapsed(T,L) PLGGetIntValue(T,L,K_Elapsed)
|
|
||||||
#define PLGGetContinued(T,L) PLGGetIntValue(T,L,K_Continued)
|
|
||||||
#define PLGGetMaxSize(T,L) PLGGetIntValue(T,L,K_Maxsize)
|
|
||||||
#define PLGGetLength(T,L,C) PLGGetColValue(T,L,K_Length,C)
|
|
||||||
#define PLGGetDataSize(T,L,C) PLGGetColValue(T,L,K_DataLen,C)
|
|
||||||
#define PLGGetDecimal(T,L,C) PLGGetColValue(T,L,K_Prec,C)
|
|
||||||
#define PLGGetType(T,L,C) PLGGetColValue(T,L,K_Type,C)
|
|
||||||
#endif /* FNCMAC */
|
|
||||||
#endif // NOT_USED
|
|
||||||
|
|
||||||
#endif /* !_PLGCNX_H */
|
#endif /* !_PLGCNX_H */
|
||||||
|
|
||||||
/* ------------------------- End of Plgcnx.h ---------------------------- */
|
/* ------------------------- End of Plgcnx.h ---------------------------- */
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Srcdef/... Block */
|
enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Srcdef/... Block */
|
||||||
TYPE_COLUMN = 51, /* Column Name/Qualifier Block */
|
TYPE_COLUMN = 51, /* Column Name/Qualifier Block */
|
||||||
// TYPE_OPVAL = 52, /* Operator value (OPVAL) */
|
|
||||||
TYPE_TDB = 53, /* Table Description Block */
|
TYPE_TDB = 53, /* Table Description Block */
|
||||||
TYPE_COLBLK = 54, /* Column Description Block */
|
TYPE_COLBLK = 54, /* Column Description Block */
|
||||||
TYPE_PSZ = 64, /* Pointer to String ended by 0 */
|
TYPE_PSZ = 64, /* Pointer to String ended by 0 */
|
||||||
@ -34,8 +33,6 @@ enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Srcdef/... Block */
|
|||||||
TYPE_XOBJECT = 69, /* Extended DB object */
|
TYPE_XOBJECT = 69, /* Extended DB object */
|
||||||
TYPE_COLCRT = 71, /* Column creation block */
|
TYPE_COLCRT = 71, /* Column creation block */
|
||||||
TYPE_CONST = 72, /* Constant */
|
TYPE_CONST = 72, /* Constant */
|
||||||
// TYPE_INDEXDEF = 73, /* Index definition block */
|
|
||||||
// TYPE_OPER = 74, /* Operator block (OPER) */
|
|
||||||
|
|
||||||
/*-------------------- type tokenized string --------------------------*/
|
/*-------------------- type tokenized string --------------------------*/
|
||||||
TYPE_DATE = 8, /* Timestamp */
|
TYPE_DATE = 8, /* Timestamp */
|
||||||
@ -144,21 +141,19 @@ enum RECFM {RECFM_NAF = -2, /* Not a file */
|
|||||||
RECFM_PLG = 5, /* Table accessed via PLGconn */
|
RECFM_PLG = 5, /* Table accessed via PLGconn */
|
||||||
RECFM_DBF = 6}; /* DBase formatted file */
|
RECFM_DBF = 6}; /* DBase formatted file */
|
||||||
|
|
||||||
#if 0
|
|
||||||
enum MISC {DB_TABNO = 1, /* DB routines in Utility Table */
|
enum MISC {DB_TABNO = 1, /* DB routines in Utility Table */
|
||||||
MAX_MULT_KEY = 10, /* Max multiple key number */
|
MAX_MULT_KEY = 10, /* Max multiple key number */
|
||||||
NAM_LEN = 128, /* Length of col and tab names */
|
NAM_LEN = 128, /* Length of col and tab names */
|
||||||
ARRAY_SIZE = 50, /* Default array block size */
|
ARRAY_SIZE = 50, /* Default array block size */
|
||||||
MAXRES = 500, /* Default maximum result lines */
|
// MAXRES = 500, /* Default maximum result lines */
|
||||||
MAXLIN = 10000, /* Default maximum data lines */
|
// MAXLIN = 10000, /* Default maximum data lines */
|
||||||
MAXBMP = 32}; /* Default XDB2 max bitmap size */
|
MAXBMP = 32}; /* Default XDB2 max bitmap size */
|
||||||
|
|
||||||
|
#if 0
|
||||||
enum ALGMOD {AMOD_AUTO = 0, /* PLG chooses best algorithm */
|
enum ALGMOD {AMOD_AUTO = 0, /* PLG chooses best algorithm */
|
||||||
AMOD_SQL = 1, /* Use SQL algorithm */
|
AMOD_SQL = 1, /* Use SQL algorithm */
|
||||||
AMOD_QRY = 2}; /* Use QUERY algorithm */
|
AMOD_QRY = 2}; /* Use QUERY algorithm */
|
||||||
#else // !0
|
#endif // 0
|
||||||
#define NAM_LEN 128
|
|
||||||
#endif // !0
|
|
||||||
|
|
||||||
enum MODE {MODE_ERROR = -1, /* Invalid mode */
|
enum MODE {MODE_ERROR = -1, /* Invalid mode */
|
||||||
MODE_ANY = 0, /* Unspecified mode */
|
MODE_ANY = 0, /* Unspecified mode */
|
||||||
@ -342,9 +337,7 @@ typedef class XTAB *PTABLE;
|
|||||||
typedef class COLUMN *PCOLUMN;
|
typedef class COLUMN *PCOLUMN;
|
||||||
typedef class XOBJECT *PXOB;
|
typedef class XOBJECT *PXOB;
|
||||||
typedef class COLBLK *PCOL;
|
typedef class COLBLK *PCOL;
|
||||||
typedef class TBX *PTBX;
|
|
||||||
typedef class TDB *PTDB;
|
typedef class TDB *PTDB;
|
||||||
typedef void *PSQL; // Not used
|
|
||||||
typedef class TDBASE *PTDBASE;
|
typedef class TDBASE *PTDBASE;
|
||||||
typedef class TDBDOS *PTDBDOS;
|
typedef class TDBDOS *PTDBDOS;
|
||||||
typedef class TDBFIX *PTDBFIX;
|
typedef class TDBFIX *PTDBFIX;
|
||||||
@ -413,41 +406,25 @@ typedef struct _mblock { /* Memory block */
|
|||||||
/* The QUERY application User Block. */
|
/* The QUERY application User Block. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
typedef struct { /* User application block */
|
typedef struct { /* User application block */
|
||||||
//void *Act2; /* RePoint to activity block */
|
|
||||||
//short LineLen; /* Current output line len */
|
|
||||||
NAME Name; /* User application name */
|
NAME Name; /* User application name */
|
||||||
//NAME Password; /* User application password */
|
|
||||||
//PSZ UserFile; /* User application filename */
|
|
||||||
char Server[17]; /* Server name */
|
char Server[17]; /* Server name */
|
||||||
char DBName[17]; /* Current database name */
|
char DBName[17]; /* Current database name */
|
||||||
//char Host[65]; /* Caller's host name */
|
|
||||||
//char User[17]; /* Caller's user name */
|
|
||||||
//uint Granted; /* Grant bitmap */
|
|
||||||
PCATLG Catalog; /* To CATALOG class */
|
PCATLG Catalog; /* To CATALOG class */
|
||||||
PQRYRES Result; /* To query result blocks */
|
PQRYRES Result; /* To query result blocks */
|
||||||
PFBLOCK Openlist; /* To file/map open list */
|
PFBLOCK Openlist; /* To file/map open list */
|
||||||
PMBLOCK Memlist; /* To memory block list */
|
PMBLOCK Memlist; /* To memory block list */
|
||||||
PXUSED Xlist; /* To used index list */
|
PXUSED Xlist; /* To used index list */
|
||||||
//int Maxres; /* Result Max nb of lines */
|
|
||||||
//int Maxtmp; /* Intermediate tables Maxres */
|
|
||||||
//int Maxlin; /* Query Max nb of data lines */
|
|
||||||
//int Maxbmp; /* Maximum XDB2 bitmap size */
|
|
||||||
int Check; /* General level of checking */
|
int Check; /* General level of checking */
|
||||||
int Numlines; /* Number of lines involved */
|
int Numlines; /* Number of lines involved */
|
||||||
//ALGMOD AlgChoice; /* Choice of algorithm mode */
|
|
||||||
//AREADEF DescArea; /* Table desc. area size */
|
|
||||||
USETEMP UseTemp; /* Use temporary file */
|
USETEMP UseTemp; /* Use temporary file */
|
||||||
//int Curtype; /* 0: static else: dynamic */
|
|
||||||
int Vtdbno; /* Used for TDB number setting */
|
int Vtdbno; /* Used for TDB number setting */
|
||||||
bool Remote; /* true: if remotely called */
|
bool Remote; /* true: if remotely called */
|
||||||
//bool NotFinal; /* true: for intermediate table */
|
|
||||||
bool Proginfo; /* true: return progress info */
|
bool Proginfo; /* true: return progress info */
|
||||||
bool Subcor; /* Used for Progress info */
|
bool Subcor; /* Used for Progress info */
|
||||||
size_t ProgMax; /* Used for Progress info */
|
size_t ProgMax; /* Used for Progress info */
|
||||||
size_t ProgCur; /* Used for Progress info */
|
size_t ProgCur; /* Used for Progress info */
|
||||||
size_t ProgSav; /* Used for Progress info */
|
size_t ProgSav; /* Used for Progress info */
|
||||||
LPCSTR Step; /* Execution step name */
|
LPCSTR Step; /* Execution step name */
|
||||||
//char Work[_MAX_PATH]; /* Local work path */
|
|
||||||
} DBUSERBLK, *PDBUSER;
|
} DBUSERBLK, *PDBUSER;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -578,9 +555,6 @@ DllExport void PlgDBfree(MBLOCK&);
|
|||||||
DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
|
DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
|
||||||
DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
|
DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
|
||||||
DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t);
|
DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t);
|
||||||
//lExport PSZ GetIniString(PGLOBAL, void *, LPCSTR, LPCSTR, LPCSTR, LPCSTR);
|
|
||||||
//lExport int GetIniSize(char *, char *, char *, char *);
|
|
||||||
//lExport bool WritePrivateProfileInt(LPCSTR, LPCSTR, int, LPCSTR);
|
|
||||||
DllExport void NewPointer(PTABS, void *, void *);
|
DllExport void NewPointer(PTABS, void *, void *);
|
||||||
DllExport char *GetIni(int n= 0);
|
DllExport char *GetIni(int n= 0);
|
||||||
DllExport void SetTrc(void);
|
DllExport void SetTrc(void);
|
||||||
|
@ -153,9 +153,6 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
|
|||||||
g->Trace = 0;
|
g->Trace = 0;
|
||||||
g->Createas = 0;
|
g->Createas = 0;
|
||||||
g->Alchecked = 0;
|
g->Alchecked = 0;
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
g->Mrr = 0;
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
g->Activityp = g->ActivityStart = NULL;
|
g->Activityp = g->ActivityStart = NULL;
|
||||||
g->Xchk = NULL;
|
g->Xchk = NULL;
|
||||||
strcpy(g->Message, "");
|
strcpy(g->Message, "");
|
||||||
|
@ -3,31 +3,6 @@
|
|||||||
|
|
||||||
#include "checklvl.h"
|
#include "checklvl.h"
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Struct of variables used by the SQL pre-parsers. */
|
|
||||||
/***********************************************************************/
|
|
||||||
typedef struct _prepar {
|
|
||||||
struct _prepar *Next;
|
|
||||||
char *Debinp; // Start of input buffer
|
|
||||||
char *Endinp; // End of input buffer
|
|
||||||
char *Pluginp; // Points on current parsing position
|
|
||||||
char *Plugbuf; // Start of output buffer
|
|
||||||
char *Plugptr; // Current output position
|
|
||||||
char *Debchar; // Next/current start of command
|
|
||||||
char *Debselp; // Beginning of selection
|
|
||||||
char *Debline; // Start of current line
|
|
||||||
char *Plugpar[32]; // Parameters
|
|
||||||
int Numparms; // Number of defined parameters
|
|
||||||
int Nprms; // Number of ODBC parameters
|
|
||||||
int Lines; // Line number
|
|
||||||
int Chars; // Index of selection start in line
|
|
||||||
int Endchars; // Index of selection end in line
|
|
||||||
int Frinp, Frbuf; // 0: no, 1: free, 2: delete Debinp/Plugbuf
|
|
||||||
int Outsize; // Size of output buffer
|
|
||||||
FILE *Argfile; // File containing arguments
|
|
||||||
int Addargs; // 1 if arguments are added to the list
|
|
||||||
} PREPAR, *PPREP;
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Struct of variables used by the date format pre-parser. */
|
/* Struct of variables used by the date format pre-parser. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -49,8 +24,6 @@ typedef struct _datpar {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sqlflex(PPREP pp);
|
|
||||||
int sqpflex(PPREP pp);
|
|
||||||
int fmdflex(PDTP pp);
|
int fmdflex(PDTP pp);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -204,6 +204,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
|
|||||||
return xdefp;
|
return xdefp;
|
||||||
} // end of GetXdef
|
} // end of GetXdef
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DeleteTableFile: Delete an OEM table file if applicable. */
|
/* DeleteTableFile: Delete an OEM table file if applicable. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -214,6 +215,7 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
return (Pxdef) ? Pxdef->DeleteTableFile(g) : true;
|
return (Pxdef) ? Pxdef->DeleteTableFile(g) : true;
|
||||||
} // end of DeleteTableFile
|
} // end of DeleteTableFile
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Define: initialize the table definition block from XDB file. */
|
/* Define: initialize the table definition block from XDB file. */
|
||||||
@ -286,7 +288,6 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
txfp = new(g) ZIPFAM(defp);
|
txfp = new(g) ZIPFAM(defp);
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Compress 2 not supported yet");
|
strcpy(g->Message, "Compress 2 not supported yet");
|
||||||
// txfp = new(g) ZLBFAM(defp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endelse
|
} // endelse
|
||||||
#else // !ZIP_SUPPORT
|
#else // !ZIP_SUPPORT
|
||||||
@ -341,7 +342,6 @@ COLCRT::COLCRT(PSZ name)
|
|||||||
Precision = -1;
|
Precision = -1;
|
||||||
Key = -1;
|
Key = -1;
|
||||||
Scale = -1;
|
Scale = -1;
|
||||||
Opt = -1;
|
|
||||||
DataType = '*';
|
DataType = '*';
|
||||||
} // end of COLCRT constructor for table creation
|
} // end of COLCRT constructor for table creation
|
||||||
|
|
||||||
@ -357,7 +357,6 @@ COLCRT::COLCRT(void)
|
|||||||
Precision = 0;
|
Precision = 0;
|
||||||
Key = 0;
|
Key = 0;
|
||||||
Scale = 0;
|
Scale = 0;
|
||||||
Opt = 0;
|
|
||||||
DataType = '*';
|
DataType = '*';
|
||||||
} // end of COLCRT constructor for table & view definition
|
} // end of COLCRT constructor for table & view definition
|
||||||
|
|
||||||
@ -399,9 +398,7 @@ int COLDEF::Define(PGLOBAL g, void *memp, PCOLINFO cfp, int poff)
|
|||||||
Precision = cfp->Precision;
|
Precision = cfp->Precision;
|
||||||
Scale = cfp->Scale;
|
Scale = cfp->Scale;
|
||||||
Long = cfp->Length;
|
Long = cfp->Length;
|
||||||
Opt = cfp->Opt;
|
|
||||||
Key = cfp->Key;
|
Key = cfp->Key;
|
||||||
// Freq = cfp->Freq;
|
|
||||||
|
|
||||||
if (cfp->Remark && *cfp->Remark) {
|
if (cfp->Remark && *cfp->Remark) {
|
||||||
Desc = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Remark) + 1);
|
Desc = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Remark) + 1);
|
||||||
|
@ -38,7 +38,6 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
|
|||||||
void SetCat(PCATLG cat) { Cat=cat; }
|
void SetCat(PCATLG cat) { Cat=cat; }
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
|
||||||
virtual bool Indexable(void) {return false;}
|
virtual bool Indexable(void) {return false;}
|
||||||
virtual bool Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) = 0;
|
virtual bool Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) = 0;
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE mode) = 0;
|
virtual PTDB GetTable(PGLOBAL g, MODE mode) = 0;
|
||||||
@ -116,7 +115,6 @@ class DllExport OEMDEF : public TABDEF { /* OEM table */
|
|||||||
virtual AMT GetDefType(void) {return TYPE_AM_OEM;}
|
virtual AMT GetDefType(void) {return TYPE_AM_OEM;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool DeleteTableFile(PGLOBAL g);
|
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
||||||
|
|
||||||
@ -147,7 +145,6 @@ class DllExport COLCRT : public BLOCK { /* Column description block
|
|||||||
PSZ GetName(void) {return Name;}
|
PSZ GetName(void) {return Name;}
|
||||||
PSZ GetDecode(void) {return Decode;}
|
PSZ GetDecode(void) {return Decode;}
|
||||||
PSZ GetFmt(void) {return Fmt;}
|
PSZ GetFmt(void) {return Fmt;}
|
||||||
int GetOpt(void) {return Opt;}
|
|
||||||
int GetLong(void) {return Long;}
|
int GetLong(void) {return Long;}
|
||||||
int GetPrecision(void) {return Precision;}
|
int GetPrecision(void) {return Precision;}
|
||||||
int GetOffset(void) {return Offset;}
|
int GetOffset(void) {return Offset;}
|
||||||
@ -164,7 +161,6 @@ class DllExport COLCRT : public BLOCK { /* Column description block
|
|||||||
int Key; /* Key (greater than 1 if multiple) */
|
int Key; /* Key (greater than 1 if multiple) */
|
||||||
int Precision; /* Logical column length */
|
int Precision; /* Logical column length */
|
||||||
int Scale; /* Decimals for float/decimal values */
|
int Scale; /* Decimals for float/decimal values */
|
||||||
int Opt; /* 0:Not 1:clustered 2:sorted-asc 3:desc */
|
|
||||||
char DataType; /* Internal data type (C, N, F, T) */
|
char DataType; /* Internal data type (C, N, F, T) */
|
||||||
}; // end of COLCRT
|
}; // end of COLCRT
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block.
|
|||||||
virtual bool Compare(PXOB) {assert(false); return false;}
|
virtual bool Compare(PXOB) {assert(false); return false;}
|
||||||
virtual bool SetFormat(PGLOBAL, FORMAT&);
|
virtual bool SetFormat(PGLOBAL, FORMAT&);
|
||||||
virtual bool Eval(PGLOBAL) {assert(false); return true;}
|
virtual bool Eval(PGLOBAL) {assert(false); return true;}
|
||||||
virtual int CheckSpcCol(PTDB, int) {assert(false); return 2;}
|
|
||||||
virtual bool CheckSort(PTDB) {assert(false); return false;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Members
|
// Members
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/************* TabDos C++ Program Source Code File (.CPP) **************/
|
/************* TabDos C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABDOS */
|
/* PROGRAM NAME: TABDOS */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 4.8 */
|
/* Version 4.9 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2012 */
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@ -58,27 +58,12 @@
|
|||||||
#include "tabfix.h"
|
#include "tabfix.h"
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
|
|
||||||
#define PLGINI "plugdb.ini" // Configuration settings file
|
|
||||||
|
|
||||||
#if defined(UNIX)
|
|
||||||
#define _fileno fileno
|
|
||||||
#define _O_RDONLY O_RDONLY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int num_read, num_there, num_eq[2]; // Statistics
|
int num_read, num_there, num_eq[2]; // Statistics
|
||||||
extern "C" char plgini[_MAX_PATH];
|
|
||||||
extern "C" int trace;
|
extern "C" int trace;
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Min and Max blocks contains zero ended fields (blank = false). */
|
|
||||||
/* No conversion of block values (check = true). */
|
|
||||||
/***********************************************************************/
|
|
||||||
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int len = 0, int prec = 0,
|
|
||||||
bool check = true, bool blank = false, bool un = false);
|
|
||||||
|
|
||||||
/* --------------------------- Class DOSDEF -------------------------- */
|
/* --------------------------- Class DOSDEF -------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -96,7 +81,6 @@ DOSDEF::DOSDEF(void)
|
|||||||
Huge = false;
|
Huge = false;
|
||||||
Accept = false;
|
Accept = false;
|
||||||
Eof = false;
|
Eof = false;
|
||||||
To_Pos = NULL;
|
|
||||||
Compressed = 0;
|
Compressed = 0;
|
||||||
Lrecl = 0;
|
Lrecl = 0;
|
||||||
AvgLen = 0;
|
AvgLen = 0;
|
||||||
@ -109,6 +93,50 @@ DOSDEF::DOSDEF(void)
|
|||||||
//Mtime = 0;
|
//Mtime = 0;
|
||||||
} // end of DOSDEF constructor
|
} // end of DOSDEF constructor
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* DefineAM: define specific AM block values from XDB file. */
|
||||||
|
/***********************************************************************/
|
||||||
|
bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||||
|
{
|
||||||
|
char buf[8];
|
||||||
|
bool map = (am && (*am == 'M' || *am == 'm'));
|
||||||
|
LPCSTR dfm = (am && (*am == 'F' || *am == 'f')) ? "F"
|
||||||
|
: (am && (*am == 'B' || *am == 'b')) ? "B"
|
||||||
|
: (am && !stricmp(am, "DBF")) ? "D" : "V";
|
||||||
|
|
||||||
|
Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
|
||||||
|
Ofn = Cat->GetStringCatInfo(g, "Optname", Fn);
|
||||||
|
Cat->GetCharCatInfo("Recfm", (PSZ)dfm, buf, sizeof(buf));
|
||||||
|
Recfm = (toupper(*buf) == 'F') ? RECFM_FIX :
|
||||||
|
(toupper(*buf) == 'B') ? RECFM_BIN :
|
||||||
|
(toupper(*buf) == 'D') ? RECFM_DBF : RECFM_VAR;
|
||||||
|
Lrecl = Cat->GetIntCatInfo("Lrecl", 0);
|
||||||
|
|
||||||
|
if (Recfm != RECFM_DBF)
|
||||||
|
Compressed = Cat->GetIntCatInfo("Compressed", 0);
|
||||||
|
|
||||||
|
Mapped = Cat->GetBoolCatInfo("Mapped", map);
|
||||||
|
Block = Cat->GetIntCatInfo("Blocks", 0);
|
||||||
|
Last = Cat->GetIntCatInfo("Last", 0);
|
||||||
|
Ending = Cat->GetIntCatInfo("Ending", CRLF);
|
||||||
|
|
||||||
|
if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) {
|
||||||
|
Huge = Cat->GetBoolCatInfo("Huge", Cat->GetDefHuge());
|
||||||
|
Padded = Cat->GetBoolCatInfo("Padded", false);
|
||||||
|
Blksize = Cat->GetIntCatInfo("Blksize", 0);
|
||||||
|
Eof = (Cat->GetIntCatInfo("EOF", 0) != 0);
|
||||||
|
} else if (Recfm == RECFM_DBF) {
|
||||||
|
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
|
||||||
|
Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
|
||||||
|
ReadMode = Cat->GetIntCatInfo("Readmode", 0);
|
||||||
|
} else // (Recfm == RECFM_VAR)
|
||||||
|
AvgLen = Cat->GetIntCatInfo("Avglen", 0);
|
||||||
|
|
||||||
|
// Ignore wrong Index definitions for catalog commands
|
||||||
|
return (Cat->GetIndexInfo(g, this) /*&& !Cat->GetCatFnc()*/);
|
||||||
|
} // end of DefineAM
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DeleteTableFile: Delete DOS/UNIX table files using platform API. */
|
/* DeleteTableFile: Delete DOS/UNIX table files using platform API. */
|
||||||
/* If the table file is protected (declared as read/only) we still */
|
/* If the table file is protected (declared as read/only) we still */
|
||||||
@ -147,6 +175,7 @@ bool DOSDEF::Erase(char *filename)
|
|||||||
|
|
||||||
return rc; // Return true if error
|
return rc; // Return true if error
|
||||||
} // end of Erase
|
} // end of Erase
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DeleteIndexFile: Delete DOS/UNIX index file(s) using platform API. */
|
/* DeleteIndexFile: Delete DOS/UNIX index file(s) using platform API. */
|
||||||
@ -221,49 +250,6 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
|
|||||||
return rc; // Return true if error
|
return rc; // Return true if error
|
||||||
} // end of DeleteIndexFile
|
} // end of DeleteIndexFile
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* DefineAM: define specific AM block values from XDB file. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
|
||||||
{
|
|
||||||
char buf[8];
|
|
||||||
bool map = (am && (*am == 'M' || *am == 'm'));
|
|
||||||
LPCSTR dfm = (am && (*am == 'F' || *am == 'f')) ? "F"
|
|
||||||
: (am && (*am == 'B' || *am == 'b')) ? "B"
|
|
||||||
: (am && !stricmp(am, "DBF")) ? "D" : "V";
|
|
||||||
|
|
||||||
Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
|
|
||||||
Ofn = Cat->GetStringCatInfo(g, "Optname", Fn);
|
|
||||||
Cat->GetCharCatInfo("Recfm", (PSZ)dfm, buf, sizeof(buf));
|
|
||||||
Recfm = (toupper(*buf) == 'F') ? RECFM_FIX :
|
|
||||||
(toupper(*buf) == 'B') ? RECFM_BIN :
|
|
||||||
(toupper(*buf) == 'D') ? RECFM_DBF : RECFM_VAR;
|
|
||||||
Lrecl = Cat->GetIntCatInfo("Lrecl", 0);
|
|
||||||
|
|
||||||
if (Recfm != RECFM_DBF)
|
|
||||||
Compressed = Cat->GetIntCatInfo("Compressed", 0);
|
|
||||||
|
|
||||||
Mapped = Cat->GetBoolCatInfo("Mapped", map);
|
|
||||||
Block = Cat->GetIntCatInfo("Blocks", 0);
|
|
||||||
Last = Cat->GetIntCatInfo("Last", 0);
|
|
||||||
Ending = Cat->GetIntCatInfo("Ending", CRLF);
|
|
||||||
|
|
||||||
if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) {
|
|
||||||
Huge = Cat->GetBoolCatInfo("Huge", Cat->GetDefHuge());
|
|
||||||
Padded = Cat->GetBoolCatInfo("Padded", false);
|
|
||||||
Blksize = Cat->GetIntCatInfo("Blksize", 0);
|
|
||||||
Eof = (Cat->GetIntCatInfo("EOF", 0) != 0);
|
|
||||||
} else if (Recfm == RECFM_DBF) {
|
|
||||||
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
|
|
||||||
Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
|
|
||||||
ReadMode = Cat->GetIntCatInfo("Readmode", 0);
|
|
||||||
} else // (Recfm == RECFM_VAR)
|
|
||||||
AvgLen = Cat->GetIntCatInfo("Avglen", 0);
|
|
||||||
|
|
||||||
// Ignore wrong Index definitions for catalog commands
|
|
||||||
return (Cat->GetIndexInfo(g, this) /*&& !Cat->GetCatFnc()*/);
|
|
||||||
} // end of DefineAM
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* InvalidateIndex: mark all indexes as invalid. */
|
/* InvalidateIndex: mark all indexes as invalid. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -311,28 +297,31 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
txfp = new(g) BGXFAM(this);
|
txfp = new(g) BGXFAM(this);
|
||||||
else if (map)
|
else if (map)
|
||||||
txfp = new(g) MPXFAM(this);
|
txfp = new(g) MPXFAM(this);
|
||||||
|
else if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(ZIP_SUPPORT)
|
||||||
else if (Compressed)
|
|
||||||
txfp = new(g) ZIXFAM(this);
|
txfp = new(g) ZIXFAM(this);
|
||||||
#endif // ZIP_SUPPORT
|
#else // !ZIP_SUPPORT
|
||||||
else
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||||
|
return NULL;
|
||||||
|
#endif // !ZIP_SUPPORT
|
||||||
|
} else
|
||||||
txfp = new(g) FIXFAM(this);
|
txfp = new(g) FIXFAM(this);
|
||||||
|
|
||||||
tdbp = new(g) TDBFIX(this, txfp);
|
tdbp = new(g) TDBFIX(this, txfp);
|
||||||
} else {
|
} else {
|
||||||
#if defined(ZIP_SUPPORT)
|
|
||||||
if (Compressed) {
|
if (Compressed) {
|
||||||
|
#if defined(ZIP_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZIPFAM(this);
|
txfp = new(g) ZIPFAM(this);
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Compress 2 not supported yet");
|
strcpy(g->Message, "Compress 2 not supported yet");
|
||||||
// txfp = new(g) ZLBFAM(defp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endelse
|
} // endelse
|
||||||
|
#else // !ZIP_SUPPORT
|
||||||
} else
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||||
#endif // ZIP_SUPPORT
|
return NULL;
|
||||||
if (map)
|
#endif // !ZIP_SUPPORT
|
||||||
|
} else if (map)
|
||||||
txfp = new(g) MAPFAM(this);
|
txfp = new(g) MAPFAM(this);
|
||||||
else
|
else
|
||||||
txfp = new(g) DOSFAM(this);
|
txfp = new(g) DOSFAM(this);
|
||||||
@ -730,10 +719,17 @@ bool TDBDOS::OpenDB(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Table already open, just replace it at its beginning. */
|
/* Table already open, just replace it at its beginning. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Txfp->Rewind(); // see comment in Work.log
|
if (!To_Kindex) {
|
||||||
|
Txfp->Rewind(); // see comment in Work.log
|
||||||
|
|
||||||
if (SkipHeader(g))
|
if (SkipHeader(g))
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
|
} else
|
||||||
|
/*****************************************************************/
|
||||||
|
/* Table is to be accessed through a sorted index table. */
|
||||||
|
/*****************************************************************/
|
||||||
|
To_Kindex->Reset();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // endif use
|
} // endif use
|
||||||
@ -927,7 +923,6 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
|
|||||||
Deplac = cdp->GetOffset();
|
Deplac = cdp->GetOffset();
|
||||||
Long = cdp->GetLong();
|
Long = cdp->GetLong();
|
||||||
To_Val = NULL;
|
To_Val = NULL;
|
||||||
|
|
||||||
OldVal = NULL; // Currently used only in MinMax
|
OldVal = NULL; // Currently used only in MinMax
|
||||||
Ldz = false;
|
Ldz = false;
|
||||||
Nod = false;
|
Nod = false;
|
||||||
@ -971,28 +966,6 @@ DOSCOL::DOSCOL(DOSCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
|
|||||||
Buf = col1->Buf;
|
Buf = col1->Buf;
|
||||||
} // end of DOSCOL copy constructor
|
} // end of DOSCOL copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* VarSize: This function tells UpdateDB whether or not the block */
|
|
||||||
/* optimization file must be redone if this column is updated, even */
|
|
||||||
/* it is not sorted or clustered. This applies to the last column of */
|
|
||||||
/* a variable length table that is blocked, because if it is updated */
|
|
||||||
/* using a temporary file, the block size may be modified. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool DOSCOL::VarSize(void)
|
|
||||||
{
|
|
||||||
PTDBDOS tdbp = (PTDBDOS)To_Tdb;
|
|
||||||
PTXF txfp = tdbp->Txfp;
|
|
||||||
|
|
||||||
if (Cdp && !Cdp->GetNext() // Must be the last column
|
|
||||||
&& tdbp->Ftype == RECFM_VAR // of a DOS variable length
|
|
||||||
&& txfp->Blocked // blocked table
|
|
||||||
&& txfp->GetUseTemp()) // using a temporary file.
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // end VarSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* SetBuffer: prepare a column block for write operation. */
|
/* SetBuffer: prepare a column block for write operation. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -1151,6 +1124,13 @@ void DOSCOL::WriteColumn(PGLOBAL g)
|
|||||||
htrc("Lrecl=%d deplac=%d int=%d\n", tdbp->Lrecl, Deplac, Long);
|
htrc("Lrecl=%d deplac=%d int=%d\n", tdbp->Lrecl, Deplac, Long);
|
||||||
|
|
||||||
field = Long;
|
field = Long;
|
||||||
|
len = (signed)strlen(tdbp->To_Line);
|
||||||
|
|
||||||
|
if (tdbp->GetAmType() == TYPE_AM_DOS && len > tdbp->Lrecl) {
|
||||||
|
sprintf(g->Message, "Line size %d is bigger than lrecl %d",
|
||||||
|
len, tdbp->Lrecl);
|
||||||
|
longjmp(g->jumper[g->jump_level], 32);
|
||||||
|
} // endif
|
||||||
|
|
||||||
if (tdbp->Ftype == RECFM_VAR && tdbp->Mode == MODE_UPDATE) {
|
if (tdbp->Ftype == RECFM_VAR && tdbp->Mode == MODE_UPDATE) {
|
||||||
len = (signed)strlen(tdbp->To_Line);
|
len = (signed)strlen(tdbp->To_Line);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*************** TabDos H Declares Source Code File (.H) ***************/
|
/*************** TabDos H Declares Source Code File (.H) ***************/
|
||||||
/* Name: TABDOS.H Version 3.2 */
|
/* Name: TABDOS.H Version 3.3 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1999-2012 */
|
/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the DOS classes declares. */
|
/* This file contains the DOS classes declares. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -34,6 +34,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
virtual const char *GetType(void) {return "DOS";}
|
virtual const char *GetType(void) {return "DOS";}
|
||||||
virtual PIXDEF GetIndx(void) {return To_Indx;}
|
virtual PIXDEF GetIndx(void) {return To_Indx;}
|
||||||
virtual void SetIndx(PIXDEF xdp) {To_Indx = xdp;}
|
virtual void SetIndx(PIXDEF xdp) {To_Indx = xdp;}
|
||||||
|
virtual bool IsHuge(void) {return Huge;}
|
||||||
PSZ GetFn(void) {return Fn;}
|
PSZ GetFn(void) {return Fn;}
|
||||||
PSZ GetOfn(void) {return Ofn;}
|
PSZ GetOfn(void) {return Ofn;}
|
||||||
void SetBlock(int block) {Block = block;}
|
void SetBlock(int block) {Block = block;}
|
||||||
@ -46,11 +47,8 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
bool GetEof(void) {return Eof;}
|
bool GetEof(void) {return Eof;}
|
||||||
int GetBlksize(void) {return Blksize;}
|
int GetBlksize(void) {return Blksize;}
|
||||||
int GetEnding(void) {return Ending;}
|
int GetEnding(void) {return Ending;}
|
||||||
int *GetTo_Pos(void) {return To_Pos;}
|
|
||||||
virtual bool IsHuge(void) {return Huge;}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool DeleteTableFile(PGLOBAL g);
|
|
||||||
virtual bool Indexable(void) {return Compressed != 1;}
|
virtual bool Indexable(void) {return Compressed != 1;}
|
||||||
virtual bool DeleteIndexFile(PGLOBAL g, PIXDEF pxdf);
|
virtual bool DeleteIndexFile(PGLOBAL g, PIXDEF pxdf);
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
@ -58,7 +56,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
bool InvalidateIndex(PGLOBAL g);
|
bool InvalidateIndex(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool Erase(char *filename);
|
//virtual bool Erase(char *filename);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PSZ Fn; /* Path/Name of corresponding file */
|
PSZ Fn; /* Path/Name of corresponding file */
|
||||||
@ -70,7 +68,6 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
bool Huge; /* true for files larger than 2GB */
|
bool Huge; /* true for files larger than 2GB */
|
||||||
bool Accept; /* true if wrong lines are accepted (DBF)*/
|
bool Accept; /* true if wrong lines are accepted (DBF)*/
|
||||||
bool Eof; /* true if an EOF (0xA) character exists */
|
bool Eof; /* true if an EOF (0xA) character exists */
|
||||||
int *To_Pos; /* To array of block starting positions */
|
|
||||||
int Compressed; /* 0: No, 1: gz, 2:zlib compressed file */
|
int Compressed; /* 0: No, 1: gz, 2:zlib compressed file */
|
||||||
int Lrecl; /* Size of biggest record */
|
int Lrecl; /* Size of biggest record */
|
||||||
int AvgLen; /* Average size of records */
|
int AvgLen; /* Average size of records */
|
||||||
@ -88,14 +85,12 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
/* The last column (and record) is of variable length. */
|
/* The last column (and record) is of variable length. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport TDBDOS : public TDBASE {
|
class DllExport TDBDOS : public TDBASE {
|
||||||
//friend class KINDEX;
|
|
||||||
friend class XINDEX;
|
friend class XINDEX;
|
||||||
friend class DOSCOL;
|
friend class DOSCOL;
|
||||||
friend class MAPCOL;
|
friend class MAPCOL;
|
||||||
friend class TXTFAM;
|
friend class TXTFAM;
|
||||||
friend class DOSFAM;
|
friend class DOSFAM;
|
||||||
friend class VCTCOL;
|
friend class VCTCOL;
|
||||||
//friend class TDBMUL;
|
|
||||||
friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool);
|
friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool);
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -111,7 +106,6 @@ class DllExport TDBDOS : public TDBASE {
|
|||||||
inline void IncLine(int inc) {To_Line += inc;}
|
inline void IncLine(int inc) {To_Line += inc;}
|
||||||
inline bool IsRead(void) {return Txfp->IsRead;}
|
inline bool IsRead(void) {return Txfp->IsRead;}
|
||||||
inline PXOB *GetLink(void) {return To_Link;}
|
inline PXOB *GetLink(void) {return To_Link;}
|
||||||
//inline PCOL *GetKeyCol(void) {return To_Key_Col;}
|
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual AMT GetAmType(void) {return Txfp->GetAmType();}
|
virtual AMT GetAmType(void) {return Txfp->GetAmType();}
|
||||||
@ -127,15 +121,8 @@ class DllExport TDBDOS : public TDBASE {
|
|||||||
virtual PTDB CopyOne(PTABS t);
|
virtual PTDB CopyOne(PTABS t);
|
||||||
virtual void ResetDB(void) {Txfp->Reset();}
|
virtual void ResetDB(void) {Txfp->Reset();}
|
||||||
virtual bool IsUsingTemp(PGLOBAL g);
|
virtual bool IsUsingTemp(PGLOBAL g);
|
||||||
//virtual bool NeedIndexing(PGLOBAL g);
|
|
||||||
virtual void ResetSize(void) {MaxSize = Cardinal = -1;}
|
virtual void ResetSize(void) {MaxSize = Cardinal = -1;}
|
||||||
virtual int ResetTableOpt(PGLOBAL g, bool dox);
|
virtual int ResetTableOpt(PGLOBAL g, bool dox);
|
||||||
//virtual int MakeBlockValues(PGLOBAL g);
|
|
||||||
//virtual bool SaveBlockValues(PGLOBAL g);
|
|
||||||
//virtual bool GetBlockValues(PGLOBAL g);
|
|
||||||
//virtual PBF InitBlockFilter(PGLOBAL g, PFIL filp);
|
|
||||||
//virtual PBX InitBlockIndex(PGLOBAL g);
|
|
||||||
//virtual int TestBlock(PGLOBAL g);
|
|
||||||
virtual void PrintAM(FILE *f, char *m);
|
virtual void PrintAM(FILE *f, char *m);
|
||||||
|
|
||||||
// Database routines
|
// Database routines
|
||||||
@ -162,25 +149,16 @@ class DllExport TDBDOS : public TDBASE {
|
|||||||
virtual int EstimatedLength(PGLOBAL g);
|
virtual int EstimatedLength(PGLOBAL g);
|
||||||
|
|
||||||
// Optimization routines
|
// Optimization routines
|
||||||
// void ResetBlockFilter(PGLOBAL g);
|
int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
|
||||||
int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
|
|
||||||
// bool GetDistinctColumnValues(PGLOBAL g, int nrec);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// PBF CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv);
|
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PTXF Txfp; // To the File access method class
|
PTXF Txfp; // To the File access method class
|
||||||
//PBX To_BlkIdx; // To index test block
|
|
||||||
//PBF To_BlkFil; // To evaluation block filter
|
|
||||||
//PFIL SavFil; // Saved hidden filter
|
|
||||||
char *To_Line; // Points to current processed line
|
char *To_Line; // Points to current processed line
|
||||||
int Cardinal; // Table Cardinality
|
int Cardinal; // Table Cardinality
|
||||||
RECFM Ftype; // File type: 0-var 1-fixed 2-binary (VCT)
|
RECFM Ftype; // File type: 0-var 1-fixed 2-binary (VCT)
|
||||||
int Lrecl; // Logical Record Length
|
int Lrecl; // Logical Record Length
|
||||||
int AvgLen; // Logical Record Average Length
|
int AvgLen; // Logical Record Average Length
|
||||||
//int Xeval; // BlockTest return value
|
|
||||||
//int Beval; // BlockEval return value
|
|
||||||
}; // end of class TDBDOS
|
}; // end of class TDBDOS
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -198,50 +176,27 @@ class DllExport DOSCOL : public COLBLK {
|
|||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual int GetAmType(void) {return TYPE_AM_DOS;}
|
virtual int GetAmType(void) {return TYPE_AM_DOS;}
|
||||||
//virtual int GetClustered(void) {return Clustered;}
|
|
||||||
//virtual int IsClustered(void) {return (Clustered &&
|
|
||||||
// ((PDOSDEF)(((PTDBDOS)To_Tdb)->To_Def))->IsOptimized());}
|
|
||||||
//virtual int IsSorted(void) {return Sorted;}
|
|
||||||
virtual void SetTo_Val(PVAL valp) {To_Val = valp;}
|
virtual void SetTo_Val(PVAL valp) {To_Val = valp;}
|
||||||
//virtual PVBLK GetMin(void) {return Min;}
|
|
||||||
//virtual PVBLK GetMax(void) {return Max;}
|
|
||||||
//virtual int GetNdv(void) {return Ndv;}
|
|
||||||
//virtual int GetNbm(void) {return Nbm;}
|
|
||||||
//virtual PVBLK GetBmap(void) {return Bmap;}
|
|
||||||
//virtual PVBLK GetDval(void) {return Dval;}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool VarSize(void);
|
|
||||||
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
virtual void Print(PGLOBAL g, FILE *, uint);
|
virtual void Print(PGLOBAL g, FILE *, uint);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//virtual bool SetMinMax(PGLOBAL g);
|
|
||||||
//virtual bool SetBitMap(PGLOBAL g);
|
|
||||||
// bool CheckSorted(PGLOBAL g);
|
|
||||||
// bool AddDistinctValue(PGLOBAL g);
|
|
||||||
|
|
||||||
// Default constructor not to be used
|
// Default constructor not to be used
|
||||||
DOSCOL(void) {}
|
DOSCOL(void) {}
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
//PVBLK Min; // Array of block min values
|
|
||||||
//PVBLK Max; // Array of block max values
|
|
||||||
//PVBLK Bmap; // Array of block bitmap values
|
|
||||||
//PVBLK Dval; // Array of column distinct values
|
|
||||||
PVAL To_Val; // To value used for Update/Insert
|
PVAL To_Val; // To value used for Update/Insert
|
||||||
PVAL OldVal; // The previous value of the object.
|
PVAL OldVal; // The previous value of the object.
|
||||||
char *Buf; // Buffer used in write operations
|
char *Buf; // Buffer used in write operations
|
||||||
bool Ldz; // True if field contains leading zeros
|
bool Ldz; // True if field contains leading zeros
|
||||||
bool Nod; // True if no decimal point
|
bool Nod; // True if no decimal point
|
||||||
int Dcm; // Last Dcm digits are decimals
|
int Dcm; // Last Dcm digits are decimals
|
||||||
//int Clustered; // 0:No 1:Yes
|
|
||||||
//int Sorted; // 0:No 1:Asc (2:Desc - NIY)
|
|
||||||
int Deplac; // Offset in dos_buf
|
int Deplac; // Offset in dos_buf
|
||||||
//int Ndv; // Number of distinct values
|
|
||||||
//int Nbm; // Number of uint in bitmap
|
|
||||||
}; // end of class DOSCOL
|
}; // end of class DOSCOL
|
||||||
|
|
||||||
#endif // __TABDOS_H
|
#endif // __TABDOS_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/************* TabFix C++ Program Source Code File (.CPP) **************/
|
/************* TabFix C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABFIX */
|
/* PROGRAM NAME: TABFIX */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 4.8 */
|
/* Version 4.9 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2012 */
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
|
@ -460,7 +460,6 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
txfp = new(g) ZIPFAM(this);
|
txfp = new(g) ZIPFAM(this);
|
||||||
else {
|
else {
|
||||||
strcpy(g->Message, "Compress 2 not supported yet");
|
strcpy(g->Message, "Compress 2 not supported yet");
|
||||||
// txfp = new(g) ZLBFAM(defp);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} // endelse
|
} // endelse
|
||||||
#else // !ZIP_SUPPORT
|
#else // !ZIP_SUPPORT
|
||||||
@ -1272,25 +1271,6 @@ CSVCOL::CSVCOL(CSVCOL *col1, PTDB tdbp) : DOSCOL(col1, tdbp)
|
|||||||
Fldnum = col1->Fldnum;
|
Fldnum = col1->Fldnum;
|
||||||
} // end of CSVCOL copy constructor
|
} // end of CSVCOL copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* VarSize: This function tells UpdateDB whether or not the block */
|
|
||||||
/* optimization file must be redone if this column is updated, even */
|
|
||||||
/* it is not sorted or clustered. This applies to a blocked table, */
|
|
||||||
/* because if it is updated using a temporary file, the block size */
|
|
||||||
/* may be modified. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool CSVCOL::VarSize(void)
|
|
||||||
{
|
|
||||||
PTXF txfp = ((PTDBCSV)To_Tdb)->Txfp;
|
|
||||||
|
|
||||||
if (txfp->IsBlocked() && txfp->GetUseTemp())
|
|
||||||
// Blocked table using a temporary file
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // end VarSize
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ReadColumn: call DOSCOL::ReadColumn after having set the offet */
|
/* ReadColumn: call DOSCOL::ReadColumn after having set the offet */
|
||||||
/* and length of the field to read as calculated by TDBCSV::ReadDB. */
|
/* and length of the field to read as calculated by TDBCSV::ReadDB. */
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "xtable.h" // Base class declares
|
#include "xtable.h" // Base class declares
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
|
|
||||||
//pedef struct _tabdesc *PTABD; // For friend setting
|
|
||||||
typedef class TDBFMT *PTDBFMT;
|
typedef class TDBFMT *PTDBFMT;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -90,8 +89,8 @@ class TDBCSV : public TDBDOS {
|
|||||||
int Nerr; // Number of bad records
|
int Nerr; // Number of bad records
|
||||||
int Maxerr; // Maximum number of bad records
|
int Maxerr; // Maximum number of bad records
|
||||||
int Quoted; // Quoting level for quoted fields
|
int Quoted; // Quoting level for quoted fields
|
||||||
bool Accept; // true if bad lines are accepted
|
bool Accept; // true if bad lines are accepted
|
||||||
bool Header; // true if first line contains column headers
|
bool Header; // true if first line contains column headers
|
||||||
char Sep; // Separator
|
char Sep; // Separator
|
||||||
char Qot; // Quoting character
|
char Qot; // Quoting character
|
||||||
}; // end of class TDBCSV
|
}; // end of class TDBCSV
|
||||||
@ -112,10 +111,8 @@ class CSVCOL : public DOSCOL {
|
|||||||
virtual int GetAmType() {return TYPE_AM_CSV;}
|
virtual int GetAmType() {return TYPE_AM_CSV;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool VarSize(void);
|
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
// void Print(FILE *, uint);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Default constructor not to be used
|
// Default constructor not to be used
|
||||||
|
@ -36,27 +36,6 @@ extern "C" int trace; // The general trace value
|
|||||||
void NewPointer(PTABS, void *, void *);
|
void NewPointer(PTABS, void *, void *);
|
||||||
void AddPointer(PTABS, void *);
|
void AddPointer(PTABS, void *);
|
||||||
|
|
||||||
/* ---------------------------- class TBX ---------------------------- */
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* TBX public constructors. */
|
|
||||||
/***********************************************************************/
|
|
||||||
TBX::TBX(void)
|
|
||||||
{
|
|
||||||
Use = USE_NO;
|
|
||||||
To_Orig = NULL;
|
|
||||||
To_Filter = NULL;
|
|
||||||
} // end of TBX constructor
|
|
||||||
|
|
||||||
TBX::TBX(PTBX txp)
|
|
||||||
{
|
|
||||||
Use = txp->Use;
|
|
||||||
To_Orig = txp;
|
|
||||||
To_Filter = NULL;
|
|
||||||
} // end of TBX copy constructor
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
|
|
||||||
/* ---------------------------- class TDB ---------------------------- */
|
/* ---------------------------- class TDB ---------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -64,6 +43,9 @@ TBX::TBX(PTBX txp)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
|
TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
|
||||||
{
|
{
|
||||||
|
Use = USE_NO;
|
||||||
|
To_Orig = NULL;
|
||||||
|
To_CondFil = NULL;
|
||||||
Next = NULL;
|
Next = NULL;
|
||||||
Name = (tdp) ? tdp->GetName() : NULL;
|
Name = (tdp) ? tdp->GetName() : NULL;
|
||||||
To_Table = NULL;
|
To_Table = NULL;
|
||||||
@ -72,8 +54,11 @@ TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
|
|||||||
Mode = MODE_READ;
|
Mode = MODE_READ;
|
||||||
} // end of TDB standard constructor
|
} // end of TDB standard constructor
|
||||||
|
|
||||||
TDB::TDB(PTDB tdbp) : TBX(tdbp), Tdb_No(++Tnum)
|
TDB::TDB(PTDB tdbp) : Tdb_No(++Tnum)
|
||||||
{
|
{
|
||||||
|
Use = tdbp->Use;
|
||||||
|
To_Orig = tdbp;
|
||||||
|
To_CondFil = NULL;
|
||||||
Next = NULL;
|
Next = NULL;
|
||||||
Name = tdbp->Name;
|
Name = tdbp->Name;
|
||||||
To_Table = tdbp->To_Table;
|
To_Table = tdbp->To_Table;
|
||||||
@ -82,92 +67,6 @@ TDB::TDB(PTDB tdbp) : TBX(tdbp), Tdb_No(++Tnum)
|
|||||||
Mode = tdbp->Mode;
|
Mode = tdbp->Mode;
|
||||||
} // end of TDB copy constructor
|
} // end of TDB copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* OpenTable: Call AM open routine. */
|
|
||||||
/***********************************************************************/
|
|
||||||
bool TDB::OpenTable(PGLOBAL g, PSQL sqlp, MODE mode)
|
|
||||||
{
|
|
||||||
if (trace)
|
|
||||||
htrc("Open Tdb_No=%d use=%d type=%d tdb.Mode=%d mode=%d\n",
|
|
||||||
Tdb_No, Use, GetAmType(), Mode, mode);
|
|
||||||
|
|
||||||
switch (Use) {
|
|
||||||
case USE_LIN:
|
|
||||||
/*****************************************************************/
|
|
||||||
/* If table is read/only, only MODE_READ is allowed. */
|
|
||||||
/*****************************************************************/
|
|
||||||
if (IsReadOnly() && mode != MODE_READ) {
|
|
||||||
strcpy(g->Message, MSG(READ_ONLY));
|
|
||||||
return true;
|
|
||||||
} // endif ReadOnly
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
/* This could be done in any order. */
|
|
||||||
/* Note: for not Read only first table in open in that mode. */
|
|
||||||
/*****************************************************************/
|
|
||||||
if (Next)
|
|
||||||
Next->OpenTable(g, sqlp, MODE_READ);
|
|
||||||
|
|
||||||
Mode = mode;
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
/* Pre-opening is done, allocate select buffers now. */
|
|
||||||
/*****************************************************************/
|
|
||||||
Use = USE_READY;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USE_READY:
|
|
||||||
/*****************************************************************/
|
|
||||||
/* This is to open files in reverse order. */
|
|
||||||
/*****************************************************************/
|
|
||||||
if (Next)
|
|
||||||
if (Next->OpenTable(g, sqlp, mode))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
/* This was moved after filter conversion so filtering can be */
|
|
||||||
/* done when making index tables for DOS files. */
|
|
||||||
/* Also it was moved after allocating select buffers so some */
|
|
||||||
/* data can be pre-read during open to allow storage sorting. */
|
|
||||||
/*****************************************************************/
|
|
||||||
if (OpenDB(g)) // Do open the table file
|
|
||||||
return true;
|
|
||||||
|
|
||||||
Use = USE_OPEN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case USE_OPEN:
|
|
||||||
/*****************************************************************/
|
|
||||||
/* Table is already open. */
|
|
||||||
/* Call open routine that will just "rewind" the files. */
|
|
||||||
/*****************************************************************/
|
|
||||||
if (OpenDB(g)) // Rewind the table file
|
|
||||||
return true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
sprintf(g->Message, MSG(TDB_USE_ERROR), Use);
|
|
||||||
return true;
|
|
||||||
} // endswitch Use
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} // end of OpenTable
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* CloseTable: Close a table of any AM type. */
|
|
||||||
/***********************************************************************/
|
|
||||||
void TDB::CloseTable(PGLOBAL g)
|
|
||||||
{
|
|
||||||
if (trace)
|
|
||||||
htrc("CloseTable: tdb_no %d use=%d amtype=%d am.Mode=%d\n",
|
|
||||||
Tdb_No, Use, GetAmType(), Mode);
|
|
||||||
|
|
||||||
CloseDB(g);
|
|
||||||
Use = USE_READY; // x'7FFD'
|
|
||||||
Mode = MODE_ANY;
|
|
||||||
} // end of CloseTable
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -179,7 +78,7 @@ int TDB::RowNumber(PGLOBAL g, bool b)
|
|||||||
return 0;
|
return 0;
|
||||||
} // end of RowNumber
|
} // end of RowNumber
|
||||||
|
|
||||||
PTBX TDB::Copy(PTABS t)
|
PTDB TDB::Copy(PTABS t)
|
||||||
{
|
{
|
||||||
PTDB tp, tdb1, tdb2 = NULL, outp = NULL;
|
PTDB tp, tdb1, tdb2 = NULL, outp = NULL;
|
||||||
//PGLOBAL g = t->G; // Is this really useful ???
|
//PGLOBAL g = t->G; // Is this really useful ???
|
||||||
|
@ -31,7 +31,7 @@ class DllExport MACDEF : public TABDEF { /* Logical table description */
|
|||||||
// Methods
|
// Methods
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
||||||
virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
//virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
|
@ -38,7 +38,7 @@ class DllExport TDBMUL : public TDBASE {
|
|||||||
// Methods
|
// Methods
|
||||||
virtual void ResetDB(void);
|
virtual void ResetDB(void);
|
||||||
virtual PTDB CopyOne(PTABS t);
|
virtual PTDB CopyOne(PTABS t);
|
||||||
virtual bool IsSame(PTBX tp) {return tp == (PTBX)Tdbp;}
|
virtual bool IsSame(PTDB tp) {return tp == (PTDB)Tdbp;}
|
||||||
virtual PSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);}
|
virtual PSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);}
|
||||||
virtual int GetRecpos(void) {return 0;}
|
virtual int GetRecpos(void) {return 0;}
|
||||||
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
|
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
|
||||||
|
@ -527,8 +527,8 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g)
|
|||||||
|
|
||||||
strcat(strcat(strcat(strcat(Query, " FROM "), tk), Tabname), tk);
|
strcat(strcat(strcat(strcat(Query, " FROM "), tk), Tabname), tk);
|
||||||
|
|
||||||
if (To_Filter)
|
if (To_CondFil)
|
||||||
strcat(strcat(Query, " WHERE "), To_Filter->Body);
|
strcat(strcat(Query, " WHERE "), To_CondFil->Body);
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("Query=%s\n", Query);
|
htrc("Query=%s\n", Query);
|
||||||
@ -1135,7 +1135,6 @@ MYSQLCOL::MYSQLCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PSZ am)
|
|||||||
: COLBLK(NULL, tdbp, i)
|
: COLBLK(NULL, tdbp, i)
|
||||||
{
|
{
|
||||||
Name = fld->name;
|
Name = fld->name;
|
||||||
Opt = 0;
|
|
||||||
Precision = Long = fld->length;
|
Precision = Long = fld->length;
|
||||||
Buf_Type = MYSQLtoPLG(fld->type);
|
Buf_Type = MYSQLtoPLG(fld->type);
|
||||||
strcpy(Format.Type, GetFormatType(Buf_Type));
|
strcpy(Format.Type, GetFormatType(Buf_Type));
|
||||||
@ -1395,11 +1394,11 @@ PCMD TDBMYEXC::MakeCMD(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
PCMD xcmd = NULL;
|
PCMD xcmd = NULL;
|
||||||
|
|
||||||
if (To_Filter) {
|
if (To_CondFil) {
|
||||||
if (Cmdcol) {
|
if (Cmdcol) {
|
||||||
if (!stricmp(Cmdcol, To_Filter->Body) &&
|
if (!stricmp(Cmdcol, To_CondFil->Body) &&
|
||||||
(To_Filter->Op == OP_EQ || To_Filter->Op == OP_IN)) {
|
(To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
|
||||||
xcmd = To_Filter->Cmds;
|
xcmd = To_CondFil->Cmds;
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, "Invalid command specification filter");
|
strcpy(g->Message, "Invalid command specification filter");
|
||||||
|
|
||||||
|
@ -185,14 +185,7 @@ class TDBMYEXC : public TDBMYSQL {
|
|||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual PTDB CopyOne(PTABS t);
|
virtual PTDB CopyOne(PTABS t);
|
||||||
//virtual int GetAffectedRows(void) {return AftRows;}
|
|
||||||
//virtual int GetRecpos(void) {return N;}
|
|
||||||
//virtual int GetProgMax(PGLOBAL g);
|
|
||||||
//virtual void ResetDB(void) {N = 0;}
|
|
||||||
//virtual int RowNumber(PGLOBAL g, bool b = FALSE);
|
|
||||||
virtual bool IsView(void) {return Isview;}
|
virtual bool IsView(void) {return Isview;}
|
||||||
//virtual PSZ GetServer(void) {return Server;}
|
|
||||||
// void SetDatabase(LPCSTR db) {Database = (char*)db;}
|
|
||||||
|
|
||||||
// Database routines
|
// Database routines
|
||||||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
||||||
@ -200,20 +193,10 @@ class TDBMYEXC : public TDBMYSQL {
|
|||||||
virtual bool OpenDB(PGLOBAL g);
|
virtual bool OpenDB(PGLOBAL g);
|
||||||
virtual int ReadDB(PGLOBAL g);
|
virtual int ReadDB(PGLOBAL g);
|
||||||
virtual int WriteDB(PGLOBAL g);
|
virtual int WriteDB(PGLOBAL g);
|
||||||
//virtual int DeleteDB(PGLOBAL g, int irc);
|
|
||||||
//virtual void CloseDB(PGLOBAL g);
|
|
||||||
|
|
||||||
// Specific routines
|
|
||||||
// bool SetColumnRanks(PGLOBAL g);
|
|
||||||
// PCOL MakeFieldColumn(PGLOBAL g, char *name);
|
|
||||||
// PSZ FindFieldColumn(char *name);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Internal functions
|
// Internal functions
|
||||||
PCMD MakeCMD(PGLOBAL g);
|
PCMD MakeCMD(PGLOBAL g);
|
||||||
//bool MakeSelect(PGLOBAL g);
|
|
||||||
//bool MakeInsert(PGLOBAL g);
|
|
||||||
//int BindColumns(PGLOBAL g);
|
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PCMD Cmdlist; // The commands to execute
|
PCMD Cmdlist; // The commands to execute
|
||||||
@ -237,15 +220,9 @@ class MYXCOL : public MYSQLCOL {
|
|||||||
MYXCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PSZ am = "MYSQL");
|
MYXCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PSZ am = "MYSQL");
|
||||||
MYXCOL(MYXCOL *colp, PTDB tdbp); // Constructor used in copy process
|
MYXCOL(MYXCOL *colp, PTDB tdbp); // Constructor used in copy process
|
||||||
|
|
||||||
// Implementation
|
|
||||||
//virtual int GetAmType(void) {return TYPE_AM_MYSQL;}
|
|
||||||
// void InitBind(PGLOBAL g);
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
//virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
// bool FindRank(PGLOBAL g);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Default constructor not to be used
|
// Default constructor not to be used
|
||||||
|
@ -68,7 +68,6 @@ class TDBOCCUR : public TDBPRX {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
//PTDBASE Tdbp; // To the source table or view
|
|
||||||
LPCSTR Tabname; // Name of source table
|
LPCSTR Tabname; // Name of source table
|
||||||
char *Colist; // Source column list
|
char *Colist; // Source column list
|
||||||
char *Xcolumn; // Occurence column name
|
char *Xcolumn; // Occurence column name
|
||||||
|
@ -408,7 +408,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
|
|||||||
|
|
||||||
// Below 14 is length of 'select ' + length of ' from ' + 1
|
// Below 14 is length of 'select ' + length of ' from ' + 1
|
||||||
len = (strlen(colist) + strlen(buf) + 14);
|
len = (strlen(colist) + strlen(buf) + 14);
|
||||||
len += (To_Filter ? strlen(To_Filter->Body) + 7 : 0);
|
len += (To_CondFil ? strlen(To_CondFil->Body) + 7 : 0);
|
||||||
|
|
||||||
if (Catalog && *Catalog)
|
if (Catalog && *Catalog)
|
||||||
catp = Catalog;
|
catp = Catalog;
|
||||||
@ -441,8 +441,8 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
|
|||||||
|
|
||||||
strcat(sql, tabname);
|
strcat(sql, tabname);
|
||||||
|
|
||||||
if (To_Filter)
|
if (To_CondFil)
|
||||||
strcat(strcat(sql, " WHERE "), To_Filter->Body);
|
strcat(strcat(sql, " WHERE "), To_CondFil->Body);
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
} // end of MakeSQL
|
} // end of MakeSQL
|
||||||
@ -1229,11 +1229,11 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
PCMD xcmd = NULL;
|
PCMD xcmd = NULL;
|
||||||
|
|
||||||
if (To_Filter) {
|
if (To_CondFil) {
|
||||||
if (Cmdcol) {
|
if (Cmdcol) {
|
||||||
if (!stricmp(Cmdcol, To_Filter->Body) &&
|
if (!stricmp(Cmdcol, To_CondFil->Body) &&
|
||||||
(To_Filter->Op == OP_EQ || To_Filter->Op == OP_IN)) {
|
(To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
|
||||||
xcmd = To_Filter->Cmds;
|
xcmd = To_CondFil->Cmds;
|
||||||
} else
|
} else
|
||||||
strcpy(g->Message, "Invalid command specification filter");
|
strcpy(g->Message, "Invalid command specification filter");
|
||||||
|
|
||||||
|
@ -158,7 +158,6 @@ class ODBCCOL : public COLBLK {
|
|||||||
// PVBLK GetBlkp(void) {return Blkp;}
|
// PVBLK GetBlkp(void) {return Blkp;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
//virtual bool CheckLocal(PTDB tdbp);
|
|
||||||
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
|
@ -113,6 +113,7 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
|
|||||||
return tdbp;
|
return tdbp;
|
||||||
} // end of GetTable
|
} // end of GetTable
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DeleteTableFile: Delete INI table files using platform API. */
|
/* DeleteTableFile: Delete INI table files using platform API. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -134,6 +135,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
return rc; // Return true if error
|
return rc; // Return true if error
|
||||||
} // end of DeleteTableFile
|
} // end of DeleteTableFile
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ class DllExport INIDEF : public TABDEF { /* INI table description */
|
|||||||
// Methods
|
// Methods
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
||||||
virtual bool DeleteTableFile(PGLOBAL g);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/************* TabTbl C++ Program Source Code File (.CPP) **************/
|
/************* TabTbl C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABTBL */
|
/* PROGRAM NAME: TABTBL */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.6 */
|
/* Version 1.7 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to PlugDB Software Development 2008-2013 */
|
/* (C) Copyright to PlugDB Software Development 2008-2014 */
|
||||||
/* Author: Olivier BERTRAND */
|
/* Author: Olivier BERTRAND */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
@ -66,7 +66,6 @@
|
|||||||
#include "global.h" // global declarations
|
#include "global.h" // global declarations
|
||||||
#include "plgdbsem.h" // DB application declarations
|
#include "plgdbsem.h" // DB application declarations
|
||||||
#include "reldef.h" // DB definition declares
|
#include "reldef.h" // DB definition declares
|
||||||
//#include "filter.h" // FILTER classes dcls
|
|
||||||
#include "filamtxt.h"
|
#include "filamtxt.h"
|
||||||
#include "tabcol.h"
|
#include "tabcol.h"
|
||||||
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
|
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
|
||||||
@ -245,7 +244,7 @@ bool TDBTBL::InitTableList(PGLOBAL g)
|
|||||||
// PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath());
|
// PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath());
|
||||||
|
|
||||||
for (n = 0, tp = tdp->Tablep; tp; tp = tp->GetNext()) {
|
for (n = 0, tp = tdp->Tablep; tp; tp = tp->GetNext()) {
|
||||||
if (TestFil(g, To_Filter, tp)) {
|
if (TestFil(g, To_CondFil, tp)) {
|
||||||
tabp = new(g) XTAB(tp);
|
tabp = new(g) XTAB(tp);
|
||||||
|
|
||||||
if (tabp->GetSrc()) {
|
if (tabp->GetSrc()) {
|
||||||
@ -286,14 +285,14 @@ bool TDBTBL::InitTableList(PGLOBAL g)
|
|||||||
hc->get_table()->s->connect_string.length = sln;
|
hc->get_table()->s->connect_string.length = sln;
|
||||||
|
|
||||||
//NumTables = n;
|
//NumTables = n;
|
||||||
To_Filter = NULL; // To avoid doing it several times
|
To_CondFil = NULL; // To avoid doing it several times
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} // end of InitTableList
|
} // end of InitTableList
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Test the tablename against the pseudo "local" filter. */
|
/* Test the tablename against the pseudo "local" filter. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool TDBTBL::TestFil(PGLOBAL g, PFIL filp, PTABLE tabp)
|
bool TDBTBL::TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp)
|
||||||
{
|
{
|
||||||
char *body, *fil, op[8], tn[NAME_LEN];
|
char *body, *fil, op[8], tn[NAME_LEN];
|
||||||
bool neg;
|
bool neg;
|
||||||
@ -421,12 +420,12 @@ bool TDBTBL::OpenDB(PGLOBAL g)
|
|||||||
} // endif use
|
} // endif use
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* When GetMaxsize was called, To_Filter was not set yet. */
|
/* When GetMaxsize was called, To_CondFil was not set yet. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (To_Filter && Tablist) {
|
if (To_CondFil && Tablist) {
|
||||||
Tablist = NULL;
|
Tablist = NULL;
|
||||||
Nbc = 0;
|
Nbc = 0;
|
||||||
} // endif To_Filter
|
} // endif To_CondFil
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Open the first table of the list. */
|
/* Open the first table of the list. */
|
||||||
@ -661,12 +660,12 @@ bool TDBTBM::OpenDB(PGLOBAL g)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* When GetMaxsize was called, To_Filter was not set yet. */
|
/* When GetMaxsize was called, To_CondFil was not set yet. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (To_Filter && Tablist) {
|
if (To_CondFil && Tablist) {
|
||||||
Tablist = NULL;
|
Tablist = NULL;
|
||||||
Nbc = 0;
|
Nbc = 0;
|
||||||
} // endif To_Filter
|
} // endif To_CondFil
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
@ -87,7 +87,7 @@ class DllExport TDBTBL : public TDBPRX {
|
|||||||
protected:
|
protected:
|
||||||
// Internal functions
|
// Internal functions
|
||||||
bool InitTableList(PGLOBAL g);
|
bool InitTableList(PGLOBAL g);
|
||||||
bool TestFil(PGLOBAL g, PFIL filp, PTABLE tabp);
|
bool TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PTABLE Tablist; // Points to the table list
|
PTABLE Tablist; // Points to the table list
|
||||||
@ -133,26 +133,17 @@ class DllExport TDBTBM : public TDBTBL {
|
|||||||
// Constructor
|
// Constructor
|
||||||
TDBTBM(PTBLDEF tdp = NULL);
|
TDBTBM(PTBLDEF tdp = NULL);
|
||||||
|
|
||||||
// Implementation
|
|
||||||
//virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void ResetDB(void);
|
virtual void ResetDB(void);
|
||||||
//virtual int GetRecpos(void) {return Rows;}
|
|
||||||
//virtual int GetBadLines(void) {return (int)Nbc;}
|
|
||||||
|
|
||||||
// Database routines
|
// Database routines
|
||||||
//virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
|
||||||
virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
|
virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
|
||||||
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
|
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
|
||||||
//virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
|
|
||||||
virtual bool OpenDB(PGLOBAL g);
|
virtual bool OpenDB(PGLOBAL g);
|
||||||
virtual int ReadDB(PGLOBAL g);
|
virtual int ReadDB(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Internal functions
|
// Internal functions
|
||||||
//bool InitTableList(PGLOBAL g);
|
|
||||||
//bool TestFil(PGLOBAL g, PFIL filp, PTABLE tabp);
|
|
||||||
bool OpenTables(PGLOBAL g);
|
bool OpenTables(PGLOBAL g);
|
||||||
int ReadNextRemote(PGLOBAL g);
|
int ReadNextRemote(PGLOBAL g);
|
||||||
|
|
||||||
@ -165,5 +156,4 @@ class DllExport TDBTBM : public TDBTBL {
|
|||||||
int Nlc; // Number of local connections
|
int Nlc; // Number of local connections
|
||||||
}; // end of class TDBTBM
|
}; // end of class TDBTBM
|
||||||
|
|
||||||
|
|
||||||
pthread_handler_t ThreadOpen(void *p);
|
pthread_handler_t ThreadOpen(void *p);
|
||||||
|
@ -54,7 +54,6 @@ class DllExport PRXDEF : public TABDEF { /* Logical table description */
|
|||||||
/* This is the class declaration for the XCSV table. */
|
/* This is the class declaration for the XCSV table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport TDBPRX : public TDBASE {
|
class DllExport TDBPRX : public TDBASE {
|
||||||
//friend class MULINDX;
|
|
||||||
friend class PRXDEF;
|
friend class PRXDEF;
|
||||||
friend class PRXCOL;
|
friend class PRXCOL;
|
||||||
public:
|
public:
|
||||||
@ -126,8 +125,6 @@ class TDBTBC : public TDBCAT {
|
|||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
TDBTBC(PPRXDEF tdp);
|
TDBTBC(PPRXDEF tdp);
|
||||||
//TDBTBC(PTBLDEF tdp);
|
|
||||||
//TDBTBC(PXCLDEF tdp);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Specific routines
|
// Specific routines
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/************* TabVct C++ Program Source Code File (.CPP) **************/
|
/************* TabVct C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABVCT */
|
/* PROGRAM NAME: TABVCT */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 3.7 */
|
/* Version 3.8 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1999-2012 */
|
/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@ -118,6 +118,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
|||||||
return false;
|
return false;
|
||||||
} // end of DefineAM
|
} // end of DefineAM
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Erase: This was made a separate routine because a strange thing */
|
/* Erase: This was made a separate routine because a strange thing */
|
||||||
/* happened when DeleteTablefile was defined for the VCTDEF class: */
|
/* happened when DeleteTablefile was defined for the VCTDEF class: */
|
||||||
@ -157,6 +158,7 @@ bool VCTDEF::Erase(char *filename)
|
|||||||
|
|
||||||
return rc; // Return true if error
|
return rc; // Return true if error
|
||||||
} // end of Erase
|
} // end of Erase
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Prepare the column file name pattern for a split table. */
|
/* Prepare the column file name pattern for a split table. */
|
||||||
@ -231,7 +233,8 @@ PTDB VCTDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (mode != MODE_INSERT)
|
if (mode != MODE_INSERT)
|
||||||
if (tdbp->GetBlockValues(g))
|
if (tdbp->GetBlockValues(g))
|
||||||
return NULL;
|
PushWarning(g, (PTDBASE)tdbp);
|
||||||
|
// return NULL; // causes a crash when deleting index
|
||||||
|
|
||||||
return tdbp;
|
return tdbp;
|
||||||
} // end of GetTable
|
} // end of GetTable
|
||||||
|
@ -36,8 +36,6 @@ class DllExport VCTDEF : public DOSDEF { /* Logical table description */
|
|||||||
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Specific file erase routine for vertical tables
|
|
||||||
virtual bool Erase(char *filename);
|
|
||||||
int MakeFnPattern(char *fpat);
|
int MakeFnPattern(char *fpat);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "reldef.h"
|
#include "reldef.h"
|
||||||
#include "xtable.h"
|
#include "xtable.h"
|
||||||
#include "colblk.h"
|
#include "colblk.h"
|
||||||
#include "filter.h"
|
//#include "filter.h"
|
||||||
//#include "xindex.h"
|
//#include "xindex.h"
|
||||||
#include "tabwmi.h"
|
#include "tabwmi.h"
|
||||||
#include "valblk.h"
|
#include "valblk.h"
|
||||||
@ -480,8 +480,8 @@ bool TDBWMI::Initialize(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void TDBWMI::DoubleSlash(PGLOBAL g)
|
void TDBWMI::DoubleSlash(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (To_Filter && strchr(To_Filter->Body, '\\')) {
|
if (To_CondFil && strchr(To_CondFil->Body, '\\')) {
|
||||||
char *body = To_Filter->Body;
|
char *body = To_CondFil->Body;
|
||||||
char *buf = (char*)PlugSubAlloc(g, NULL, strlen(body) * 2);
|
char *buf = (char*)PlugSubAlloc(g, NULL, strlen(body) * 2);
|
||||||
int i = 0, k = 0;
|
int i = 0, k = 0;
|
||||||
|
|
||||||
@ -492,8 +492,8 @@ void TDBWMI::DoubleSlash(PGLOBAL g)
|
|||||||
buf[k++] = body[i];
|
buf[k++] = body[i];
|
||||||
} while (body[i++]);
|
} while (body[i++]);
|
||||||
|
|
||||||
To_Filter->Body = buf;
|
To_CondFil->Body = buf;
|
||||||
} // endif To_Filter
|
} // endif To_CondFil
|
||||||
|
|
||||||
} // end of DoubleSlash
|
} // end of DoubleSlash
|
||||||
|
|
||||||
@ -540,13 +540,13 @@ char *TDBWMI::MakeWQL(PGLOBAL g)
|
|||||||
|
|
||||||
// Below 14 is length of 'select ' + length of ' from ' + 1
|
// Below 14 is length of 'select ' + length of ' from ' + 1
|
||||||
len = (strlen(colist) + strlen(Wclass) + 14);
|
len = (strlen(colist) + strlen(Wclass) + 14);
|
||||||
len += (To_Filter ? strlen(To_Filter->Body) + 7 : 0);
|
len += (To_CondFil ? strlen(To_CondFil->Body) + 7 : 0);
|
||||||
wql = (char*)PlugSubAlloc(g, NULL, len);
|
wql = (char*)PlugSubAlloc(g, NULL, len);
|
||||||
strcat(strcat(strcpy(wql, "SELECT "), colist), " FROM ");
|
strcat(strcat(strcpy(wql, "SELECT "), colist), " FROM ");
|
||||||
strcat(wql, Wclass);
|
strcat(wql, Wclass);
|
||||||
|
|
||||||
if (To_Filter)
|
if (To_CondFil)
|
||||||
strcat(strcat(wql, " WHERE "), To_Filter->Body);
|
strcat(strcat(wql, " WHERE "), To_CondFil->Body);
|
||||||
|
|
||||||
return wql;
|
return wql;
|
||||||
} // end of MakeWQL
|
} // end of MakeWQL
|
||||||
@ -659,8 +659,8 @@ bool TDBWMI::OpenDB(PGLOBAL g)
|
|||||||
return true;
|
return true;
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
if (!To_Filter && !stricmp(Wclass, "CIM_Datafile")
|
if (!To_CondFil && !stricmp(Wclass, "CIM_Datafile")
|
||||||
&& !stricmp(Nspace, "root\\cimv2")) {
|
&& !stricmp(Nspace, "root\\cimv2")) {
|
||||||
strcpy(g->Message,
|
strcpy(g->Message,
|
||||||
"Would last forever when not filtered, use DIR table instead");
|
"Would last forever when not filtered, use DIR table instead");
|
||||||
return true;
|
return true;
|
||||||
|
@ -48,7 +48,6 @@ class WMIDEF : public TABDEF { /* Logical table description */
|
|||||||
// Methods
|
// Methods
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
||||||
virtual bool DeleteTableFile(PGLOBAL g) {return true;}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
|
@ -187,6 +187,7 @@ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
|
|||||||
return tdbp;
|
return tdbp;
|
||||||
} // end of GetTable
|
} // end of GetTable
|
||||||
|
|
||||||
|
#if 0
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DeleteTableFile: Delete XML table files using platform API. */
|
/* DeleteTableFile: Delete XML table files using platform API. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -208,6 +209,7 @@ bool XMLDEF::DeleteTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
return rc; // Return true if error
|
return rc; // Return true if error
|
||||||
} // end of DeleteTableFile
|
} // end of DeleteTableFile
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
/* ------------------------- TDBXML Class ---------------------------- */
|
/* ------------------------- TDBXML Class ---------------------------- */
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@ typedef class XMLDEF *PXMLDEF;
|
|||||||
typedef class TDBXML *PTDBXML;
|
typedef class TDBXML *PTDBXML;
|
||||||
typedef class XMLCOL *PXMLCOL;
|
typedef class XMLCOL *PXMLCOL;
|
||||||
|
|
||||||
// These functions are exported from the Extended.dll
|
|
||||||
//PTABDEF __stdcall GetXML(PGLOBAL g, void *memp);
|
|
||||||
|
|
||||||
/* --------------------------- XML classes --------------------------- */
|
/* --------------------------- XML classes --------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -30,7 +27,6 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
|
|||||||
// Methods
|
// Methods
|
||||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||||
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
||||||
virtual bool DeleteTableFile(PGLOBAL g);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
@ -53,7 +49,6 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
|
|||||||
}; // end of XMLDEF
|
}; // end of XMLDEF
|
||||||
|
|
||||||
#if defined(INCLUDE_TDBXML)
|
#if defined(INCLUDE_TDBXML)
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the class declaration for the simple XML tables. */
|
/* This is the class declaration for the simple XML tables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -242,5 +237,4 @@ class XPOSCOL : public XMLCOLX {
|
|||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
}; // end of class XPOSCOL
|
}; // end of class XPOSCOL
|
||||||
|
|
||||||
#endif // INCLUDE_TDBXML
|
#endif // INCLUDE_TDBXML
|
||||||
|
@ -147,9 +147,6 @@ bool user_connect::CheckCleanup(void)
|
|||||||
g->Xchk = NULL;
|
g->Xchk = NULL;
|
||||||
g->Createas = 0;
|
g->Createas = 0;
|
||||||
g->Alchecked = 0;
|
g->Alchecked = 0;
|
||||||
#if defined(MRRBKA_SUPPORT)
|
|
||||||
g->Mrr = 0;
|
|
||||||
#endif // MRRBKA_SUPPORT
|
|
||||||
last_query_id= thdp->query_id;
|
last_query_id= thdp->query_id;
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
|
@ -63,11 +63,10 @@ public:
|
|||||||
PCONNECT next; // Next user in chain
|
PCONNECT next; // Next user in chain
|
||||||
PCONNECT previous; // Previous user in chain
|
PCONNECT previous; // Previous user in chain
|
||||||
PGLOBAL g; // The common handle to CONNECT
|
PGLOBAL g; // The common handle to CONNECT
|
||||||
//char dbname[32]; // The DBCONNECT database
|
|
||||||
query_id_t last_query_id; // the latest user query id
|
query_id_t last_query_id; // the latest user query id
|
||||||
int count; // if used by several handlers
|
int count; // if used by several handlers
|
||||||
// Statistics
|
// Statistics
|
||||||
ulong nrd, fnd, nfd;
|
ulong nrd, fnd, nfd;
|
||||||
ulonglong tb1;
|
ulonglong tb1;
|
||||||
}; // end of user_connect class definition
|
}; // end of user_connect class definition
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
#include "plgdbsem.h"
|
#include "plgdbsem.h"
|
||||||
#include "valblk.h"
|
#include "valblk.h"
|
||||||
|
|
||||||
#define CheckBlanks assert(!Blanks);
|
#define CheckBlanks assert(!Blanks);
|
||||||
|
#define CheckParms(V, N) ChkIndx(N); ChkTyp(V);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* AllocValBlock: allocate a VALBLK according to type. */
|
/* AllocValBlock: allocate a VALBLK according to type. */
|
||||||
|
@ -26,7 +26,6 @@ const char *GetFmt(int type, bool un = false);
|
|||||||
/* Class VALBLK represent a base class for variable blocks. */
|
/* Class VALBLK represent a base class for variable blocks. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class VALBLK : public BLOCK {
|
class VALBLK : public BLOCK {
|
||||||
//friend void SemColData(PGLOBAL g, PSEM semp);
|
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
VALBLK(void *mp, int type, int nval, bool un = false);
|
VALBLK(void *mp, int type, int nval, bool un = false);
|
||||||
@ -79,12 +78,6 @@ class VALBLK : public BLOCK {
|
|||||||
virtual void SetValue(char *sp, uint len, int n) {assert(false);}
|
virtual void SetValue(char *sp, uint len, int n) {assert(false);}
|
||||||
virtual void SetValue(PVAL valp, int n) = 0;
|
virtual void SetValue(PVAL valp, int n) = 0;
|
||||||
virtual void SetValue(PVBLK pv, int n1, int n2) = 0;
|
virtual void SetValue(PVBLK pv, int n1, int n2) = 0;
|
||||||
#if 0
|
|
||||||
virtual void SetMin(PVAL valp, int n) = 0;
|
|
||||||
virtual void SetMax(PVAL valp, int n) = 0;
|
|
||||||
virtual void SetValues(PVBLK pv, int i, int n) = 0;
|
|
||||||
virtual void AddMinus1(PVBLK pv, int n1, int n2) {assert(false);}
|
|
||||||
#endif // 0
|
|
||||||
virtual void Move(int i, int j) = 0;
|
virtual void Move(int i, int j) = 0;
|
||||||
virtual int CompVal(PVAL vp, int n) = 0;
|
virtual int CompVal(PVAL vp, int n) = 0;
|
||||||
virtual int CompVal(int i1, int i2) = 0;
|
virtual int CompVal(int i1, int i2) = 0;
|
||||||
@ -119,12 +112,10 @@ class TYPBLK : public VALBLK {
|
|||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false);
|
TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false);
|
||||||
//TYPBLK(void *mp, int size, int prec, int type);
|
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual void Init(PGLOBAL g, bool check);
|
virtual void Init(PGLOBAL g, bool check);
|
||||||
virtual int GetVlen(void) {return sizeof(TYPE);}
|
virtual int GetVlen(void) {return sizeof(TYPE);}
|
||||||
//virtual PSZ GetCharValue(int n);
|
|
||||||
virtual char GetTinyValue(int n) {return (char)Typp[n];}
|
virtual char GetTinyValue(int n) {return (char)Typp[n];}
|
||||||
virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
|
virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
|
||||||
virtual short GetShortValue(int n) {return (short)Typp[n];}
|
virtual short GetShortValue(int n) {return (short)Typp[n];}
|
||||||
@ -160,7 +151,6 @@ class TYPBLK : public VALBLK {
|
|||||||
{Typp[n] = (TYPE)cval; SetNull(n, false);}
|
{Typp[n] = (TYPE)cval; SetNull(n, false);}
|
||||||
virtual void SetValue(PVAL valp, int n);
|
virtual void SetValue(PVAL valp, int n);
|
||||||
virtual void SetValue(PVBLK pv, int n1, int n2);
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
||||||
//virtual void SetValues(PVBLK pv, int k, int n);
|
|
||||||
virtual void Move(int i, int j);
|
virtual void Move(int i, int j);
|
||||||
virtual int CompVal(PVAL vp, int n);
|
virtual int CompVal(PVAL vp, int n);
|
||||||
virtual int CompVal(int i1, int i2);
|
virtual int CompVal(int i1, int i2);
|
||||||
@ -211,7 +201,6 @@ class CHRBLK : public VALBLK {
|
|||||||
virtual void SetValue(char *sp, uint len, int n);
|
virtual void SetValue(char *sp, uint len, int n);
|
||||||
virtual void SetValue(PVAL valp, int n);
|
virtual void SetValue(PVAL valp, int n);
|
||||||
virtual void SetValue(PVBLK pv, int n1, int n2);
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
||||||
//virtual void SetValues(PVBLK pv, int k, int n);
|
|
||||||
virtual void Move(int i, int j);
|
virtual void Move(int i, int j);
|
||||||
virtual int CompVal(PVAL vp, int n);
|
virtual int CompVal(PVAL vp, int n);
|
||||||
virtual int CompVal(int i1, int i2);
|
virtual int CompVal(int i1, int i2);
|
||||||
@ -263,7 +252,6 @@ class STRBLK : public VALBLK {
|
|||||||
virtual void SetValue(char *sp, uint len, int n);
|
virtual void SetValue(char *sp, uint len, int n);
|
||||||
virtual void SetValue(PVAL valp, int n);
|
virtual void SetValue(PVAL valp, int n);
|
||||||
virtual void SetValue(PVBLK pv, int n1, int n2);
|
virtual void SetValue(PVBLK pv, int n1, int n2);
|
||||||
//virtual void SetValues(PVBLK pv, int k, int n);
|
|
||||||
virtual void Move(int i, int j);
|
virtual void Move(int i, int j);
|
||||||
virtual int CompVal(PVAL vp, int n);
|
virtual int CompVal(PVAL vp, int n);
|
||||||
virtual int CompVal(int i1, int i2);
|
virtual int CompVal(int i1, int i2);
|
||||||
|
@ -83,6 +83,7 @@ int DTVAL::Shift = 0;
|
|||||||
/* Routines called externally. */
|
/* Routines called externally. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
|
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
PSZ strupr(PSZ s);
|
PSZ strupr(PSZ s);
|
||||||
@ -277,55 +278,6 @@ const char *GetFmt(int type, bool un)
|
|||||||
return fmt;
|
return fmt;
|
||||||
} // end of GetFmt
|
} // end of GetFmt
|
||||||
|
|
||||||
#if 0
|
|
||||||
/***********************************************************************/
|
|
||||||
/* ConvertType: what this function does is to determine the type to */
|
|
||||||
/* which should be converted a value so no precision would be lost. */
|
|
||||||
/* This can be a numeric type if num is true or non numeric if false. */
|
|
||||||
/* Note: this is an ultra simplified version of this function that */
|
|
||||||
/* should become more and more complex as new types are added. */
|
|
||||||
/* Not evaluated types (TYPE_VOID or TYPE_UNDEF) return false from */
|
|
||||||
/* IsType... functions so match does not prevent correct setting. */
|
|
||||||
/***********************************************************************/
|
|
||||||
int ConvertType(int target, int type, CONV kind, bool match)
|
|
||||||
{
|
|
||||||
switch (kind) {
|
|
||||||
case CNV_CHAR:
|
|
||||||
if (match && (!IsTypeChar(target) || !IsTypeChar(type)))
|
|
||||||
return TYPE_ERROR;
|
|
||||||
|
|
||||||
return TYPE_STRING;
|
|
||||||
case CNV_NUM:
|
|
||||||
if (match && (!IsTypeNum(target) || !IsTypeNum(type)))
|
|
||||||
return TYPE_ERROR;
|
|
||||||
|
|
||||||
return (target == TYPE_DOUBLE || type == TYPE_DOUBLE) ? TYPE_DOUBLE
|
|
||||||
: (target == TYPE_DATE || type == TYPE_DATE) ? TYPE_DATE
|
|
||||||
: (target == TYPE_BIGINT || type == TYPE_BIGINT) ? TYPE_BIGINT
|
|
||||||
: (target == TYPE_INT || type == TYPE_INT) ? TYPE_INT
|
|
||||||
: (target == TYPE_SHORT || type == TYPE_SHORT) ? TYPE_SHORT
|
|
||||||
: TYPE_TINY;
|
|
||||||
default:
|
|
||||||
if (target == TYPE_ERROR || target == type)
|
|
||||||
return type;
|
|
||||||
|
|
||||||
if (match && ((IsTypeChar(target) && !IsTypeChar(type)) ||
|
|
||||||
(IsTypeNum(target) && !IsTypeNum(type))))
|
|
||||||
return TYPE_ERROR;
|
|
||||||
|
|
||||||
return (target == TYPE_DOUBLE || type == TYPE_DOUBLE) ? TYPE_DOUBLE
|
|
||||||
: (target == TYPE_DATE || type == TYPE_DATE) ? TYPE_DATE
|
|
||||||
: (target == TYPE_BIGINT || type == TYPE_BIGINT) ? TYPE_BIGINT
|
|
||||||
: (target == TYPE_INT || type == TYPE_INT) ? TYPE_INT
|
|
||||||
: (target == TYPE_SHORT || type == TYPE_SHORT) ? TYPE_SHORT
|
|
||||||
: (target == TYPE_STRING || type == TYPE_STRING) ? TYPE_STRING
|
|
||||||
: (target == TYPE_TINY || type == TYPE_TINY) ? TYPE_TINY
|
|
||||||
: TYPE_ERROR;
|
|
||||||
} // endswitch kind
|
|
||||||
|
|
||||||
} // end of ConvertType
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* AllocateConstant: allocates a constant Value. */
|
/* AllocateConstant: allocates a constant Value. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -422,76 +374,6 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec,
|
|||||||
return valp;
|
return valp;
|
||||||
} // end of AllocateValue
|
} // end of AllocateValue
|
||||||
|
|
||||||
#if 0
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Allocate a constant Value converted to newtype. */
|
|
||||||
/* Can also be used to copy a Value eventually converted. */
|
|
||||||
/***********************************************************************/
|
|
||||||
PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
|
|
||||||
{
|
|
||||||
PSZ p, sp;
|
|
||||||
bool un = (uns < 0) ? false : (uns > 0) ? true : valp->IsUnsigned();
|
|
||||||
|
|
||||||
if (newtype == TYPE_VOID) // Means allocate a value of the same type
|
|
||||||
newtype = valp->GetType();
|
|
||||||
|
|
||||||
switch (newtype) {
|
|
||||||
case TYPE_STRING:
|
|
||||||
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
|
|
||||||
|
|
||||||
if ((sp = valp->GetCharString(p)) != p)
|
|
||||||
strcpy (p, sp);
|
|
||||||
|
|
||||||
valp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
|
|
||||||
break;
|
|
||||||
case TYPE_SHORT:
|
|
||||||
if (un)
|
|
||||||
valp = new(g) TYPVAL<ushort>(valp->GetUShortValue(),
|
|
||||||
TYPE_SHORT, 0, true);
|
|
||||||
else
|
|
||||||
valp = new(g) TYPVAL<short>(valp->GetShortValue(), TYPE_SHORT);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case TYPE_INT:
|
|
||||||
if (un)
|
|
||||||
valp = new(g) TYPVAL<uint>(valp->GetUIntValue(), TYPE_INT, 0, true);
|
|
||||||
else
|
|
||||||
valp = new(g) TYPVAL<int>(valp->GetIntValue(), TYPE_INT);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case TYPE_BIGINT:
|
|
||||||
if (un)
|
|
||||||
valp = new(g) TYPVAL<ulonglong>(valp->GetUBigintValue(),
|
|
||||||
TYPE_BIGINT, 0, true);
|
|
||||||
else
|
|
||||||
valp = new(g) TYPVAL<longlong>(valp->GetBigintValue(), TYPE_BIGINT);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case TYPE_DATE:
|
|
||||||
valp = new(g) DTVAL(g, valp->GetIntValue());
|
|
||||||
break;
|
|
||||||
case TYPE_DOUBLE:
|
|
||||||
valp = new(g) TYPVAL<double>(valp->GetFloatValue(), TYPE_DOUBLE,
|
|
||||||
valp->GetValPrec());
|
|
||||||
break;
|
|
||||||
case TYPE_TINY:
|
|
||||||
if (un)
|
|
||||||
valp = new(g) TYPVAL<uchar>(valp->GetUTinyValue(),
|
|
||||||
TYPE_TINY, 0, true);
|
|
||||||
else
|
|
||||||
valp = new(g) TYPVAL<char>(valp->GetTinyValue(), TYPE_TINY);
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sprintf(g->Message, MSG(BAD_VALUE_TYPE), newtype);
|
|
||||||
return NULL;
|
|
||||||
} // endswitch type
|
|
||||||
|
|
||||||
valp->SetGlobal(g);
|
|
||||||
return valp;
|
|
||||||
} // end of AllocateValue
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
/* -------------------------- Class VALUE ---------------------------- */
|
/* -------------------------- Class VALUE ---------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@ -46,8 +46,6 @@ DllExport char *GetFormatType(int);
|
|||||||
DllExport int GetFormatType(char);
|
DllExport int GetFormatType(char);
|
||||||
DllExport bool IsTypeChar(int type);
|
DllExport bool IsTypeChar(int type);
|
||||||
DllExport bool IsTypeNum(int type);
|
DllExport bool IsTypeNum(int type);
|
||||||
//lExport int ConvertType(int, int, CONV, bool match = false);
|
|
||||||
//lExport PVAL AllocateValue(PGLOBAL, PVAL, int = TYPE_VOID, int = 0);
|
|
||||||
DllExport PVAL AllocateValue(PGLOBAL, int, int len = 0, int prec = 0,
|
DllExport PVAL AllocateValue(PGLOBAL, int, int len = 0, int prec = 0,
|
||||||
bool uns = false, PSZ fmt = NULL);
|
bool uns = false, PSZ fmt = NULL);
|
||||||
DllExport ulonglong CharToNumber(char *, int, ulonglong, bool,
|
DllExport ulonglong CharToNumber(char *, int, ulonglong, bool,
|
||||||
@ -271,17 +269,9 @@ class DllExport DECVAL: public TYPVAL<PSZ> {
|
|||||||
virtual int GetValPrec() {return Prec;}
|
virtual int GetValPrec() {return Prec;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
//virtual bool SetValue_pval(PVAL valp, bool chktype);
|
|
||||||
//virtual bool SetValue_char(char *p, int n);
|
|
||||||
//virtual void SetValue_psz(PSZ s);
|
|
||||||
//virtual void SetValue_pvblk(PVBLK blk, int n);
|
|
||||||
//virtual void SetBinValue(void *p);
|
|
||||||
virtual bool GetBinValue(void *buf, int buflen, bool go);
|
virtual bool GetBinValue(void *buf, int buflen, bool go);
|
||||||
virtual char *ShowValue(char *buf, int);
|
virtual char *ShowValue(char *buf, int);
|
||||||
//virtual char *GetCharString(char *p);
|
|
||||||
virtual bool IsEqual(PVAL vp, bool chktype);
|
virtual bool IsEqual(PVAL vp, bool chktype);
|
||||||
//virtual bool FormatValue(PVAL vp, char *fmt);
|
|
||||||
//virtual bool SetConstFormat(PGLOBAL, FORMAT&);
|
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
}; // end of class DECVAL
|
}; // end of class DECVAL
|
||||||
@ -310,15 +300,12 @@ class DllExport DTVAL : public TYPVAL<int> {
|
|||||||
bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
|
bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
|
||||||
bool SetFormat(PGLOBAL g, PVAL valp);
|
bool SetFormat(PGLOBAL g, PVAL valp);
|
||||||
bool IsFormatted(void) {return Pdtp != NULL;}
|
bool IsFormatted(void) {return Pdtp != NULL;}
|
||||||
// bool GetTmMember(OPVAL op, int& mval);
|
|
||||||
// bool DateDiff(DTVAL *dtp, OPVAL op, int& tdif);
|
|
||||||
bool MakeTime(struct tm *ptm);
|
bool MakeTime(struct tm *ptm);
|
||||||
static void SetTimeShift(void);
|
static void SetTimeShift(void);
|
||||||
static int GetShift(void) {return Shift;}
|
static int GetShift(void) {return Shift;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
bool MakeDate(PGLOBAL g, int *val, int nval);
|
bool MakeDate(PGLOBAL g, int *val, int nval);
|
||||||
// bool WeekNum(PGLOBAL g, int& nval);
|
|
||||||
|
|
||||||
struct tm *GetGmTime(struct tm *);
|
struct tm *GetGmTime(struct tm *);
|
||||||
|
|
||||||
|
@ -1792,7 +1792,8 @@ int XINDEX::FastFind(int nv)
|
|||||||
XINDXS::XINDXS(PTDBDOS tdbp, PIXDEF xdp, PXLOAD pxp, PCOL *cp, PXOB *xp)
|
XINDXS::XINDXS(PTDBDOS tdbp, PIXDEF xdp, PXLOAD pxp, PCOL *cp, PXOB *xp)
|
||||||
: XINDEX(tdbp, xdp, pxp, cp, xp)
|
: XINDEX(tdbp, xdp, pxp, cp, xp)
|
||||||
{
|
{
|
||||||
Srtd = To_Cols[0]->GetOpt() < 0; // ?????
|
//Srtd = To_Cols[0]->GetOpt() < 0; // ?????
|
||||||
|
Srtd = false;
|
||||||
} // end of XINDXS constructor
|
} // end of XINDXS constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@ -2797,7 +2798,8 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
|
|||||||
|
|
||||||
// Store this information to avoid sorting when already done
|
// Store this information to avoid sorting when already done
|
||||||
if (Asc)
|
if (Asc)
|
||||||
IsSorted = colp->GetOpt() < 0;
|
// IsSorted = colp->GetOpt() < 0;
|
||||||
|
IsSorted = false;
|
||||||
|
|
||||||
//SetNulls(colp->IsNullable()); for when null columns will be indexable
|
//SetNulls(colp->IsNullable()); for when null columns will be indexable
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,12 +98,6 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */
|
|||||||
void SetNParts(uint np) {Nparts = (signed)np;}
|
void SetNParts(uint np) {Nparts = (signed)np;}
|
||||||
void SetMaxSame(int mxs) {MaxSame = mxs;}
|
void SetMaxSame(int mxs) {MaxSame = mxs;}
|
||||||
void SetMxsame(PXINDEX x);
|
void SetMxsame(PXINDEX x);
|
||||||
//int GetOffset(void) {return Offset;}
|
|
||||||
//void SetOffset(int off) {Offset = off;}
|
|
||||||
//int GetOffhigh(void) {return Offhigh;}
|
|
||||||
//void SetOffhigh(int hof) {Offhigh = hof;}
|
|
||||||
//int GetSize(void) {return Size;}
|
|
||||||
//void SetSize(int size) {Size = size;}
|
|
||||||
int GetMaxSame(void) {return MaxSame;}
|
int GetMaxSame(void) {return MaxSame;}
|
||||||
bool Define(PGLOBAL g, void *memp, PTABDEF dfp, LPCSTR p);
|
bool Define(PGLOBAL g, void *memp, PTABDEF dfp, LPCSTR p);
|
||||||
PIXDEF GetIndexOf(PCOL colp, bool hd = false);
|
PIXDEF GetIndexOf(PCOL colp, bool hd = false);
|
||||||
@ -123,9 +117,6 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */
|
|||||||
bool AutoInc; /* true if unique key in auto increment */
|
bool AutoInc; /* true if unique key in auto increment */
|
||||||
int Nparts; /* Number of key parts */
|
int Nparts; /* Number of key parts */
|
||||||
int ID; /* Index ID number */
|
int ID; /* Index ID number */
|
||||||
//int Offset; /* Offset in index file */
|
|
||||||
//int Offhigh; /* Offset high in big index file */
|
|
||||||
//int Size; /* Size of index file */
|
|
||||||
int MaxSame; /* Max number of same values */
|
int MaxSame; /* Max number of same values */
|
||||||
}; // end of INDEXDEF
|
}; // end of INDEXDEF
|
||||||
|
|
||||||
@ -253,9 +244,6 @@ class DllExport XINDEX : public XXBASE {
|
|||||||
virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;}
|
virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;}
|
||||||
virtual void SetNval(int n) {Nval = n;}
|
virtual void SetNval(int n) {Nval = n;}
|
||||||
int GetMaxSame(void) {return MaxSame;}
|
int GetMaxSame(void) {return MaxSame;}
|
||||||
// int GetDefoff(void) {return Defoff;}
|
|
||||||
// int GetDefhigh(void) {return Defhigh;}
|
|
||||||
// int GetSize(void) {return Size;}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
@ -288,9 +276,6 @@ class DllExport XINDEX : public XXBASE {
|
|||||||
int Nk; // The number of indexed columns
|
int Nk; // The number of indexed columns
|
||||||
int Nval; // The number of used columns
|
int Nval; // The number of used columns
|
||||||
int Incr; // Increment of record position
|
int Incr; // Increment of record position
|
||||||
//int Defoff; // Offset of definition in index file
|
|
||||||
//int Defhigh; // High order of offset big value
|
|
||||||
//int Size; // Size of definition in index file
|
|
||||||
int MaxSame; // Max number of same values
|
int MaxSame; // Max number of same values
|
||||||
}; // end of class XINDEX
|
}; // end of class XINDEX
|
||||||
|
|
||||||
|
@ -109,19 +109,6 @@ int CONSTANT::GetLengthEx(void)
|
|||||||
return Value->GetValLen();
|
return Value->GetValLen();
|
||||||
} // end of GetLengthEx
|
} // end of GetLengthEx
|
||||||
|
|
||||||
#if 0
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Convert a constant to the given type. */
|
|
||||||
/***********************************************************************/
|
|
||||||
void CONSTANT::Convert(PGLOBAL g, int newtype)
|
|
||||||
{
|
|
||||||
if (Value->GetType() != newtype)
|
|
||||||
if (!(Value = AllocateValue(g, Value, newtype)))
|
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_CONST);
|
|
||||||
|
|
||||||
} // end of Convert
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Compare: returns true if this object is equivalent to xp. */
|
/* Compare: returns true if this object is equivalent to xp. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@ -60,17 +60,6 @@ class DllExport XOBJECT : public BLOCK {
|
|||||||
virtual bool Init(PGLOBAL) {return false;}
|
virtual bool Init(PGLOBAL) {return false;}
|
||||||
virtual bool Eval(PGLOBAL) {return false;}
|
virtual bool Eval(PGLOBAL) {return false;}
|
||||||
virtual bool SetFormat(PGLOBAL, FORMAT&) = 0;
|
virtual bool SetFormat(PGLOBAL, FORMAT&) = 0;
|
||||||
virtual int CheckColumn(PGLOBAL, PSQL, PXOB &, int &) {return 0;}
|
|
||||||
virtual int RefNum(PSQL) {return 0;}
|
|
||||||
virtual void AddTdb(PSQL, PTDB *, int&) {}
|
|
||||||
virtual PXOB SetSelect(PGLOBAL, PSQL, bool) {return this;}
|
|
||||||
virtual PXOB CheckSubQuery(PGLOBAL, PSQL) {return this;}
|
|
||||||
virtual bool CheckLocal(PTDB) {return true;}
|
|
||||||
virtual int CheckSpcCol(PTDB, int) {return 2;}
|
|
||||||
virtual bool CheckSort(PTDB) {return false;}
|
|
||||||
virtual bool VerifyColumn(PTBX txp) {return false;}
|
|
||||||
virtual bool VerifyTdb(PTDB& tdbp) {return false;}
|
|
||||||
virtual bool IsColInside(PCOL colp) {return false;}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PVAL Value; // The current value of the object.
|
PVAL Value; // The current value of the object.
|
||||||
@ -97,7 +86,6 @@ class DllExport XVOID : public XOBJECT {
|
|||||||
// Methods
|
// Methods
|
||||||
virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;}
|
virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;}
|
||||||
virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;}
|
virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;}
|
||||||
virtual int CheckSpcCol(PTDB, int) {return 0;}
|
|
||||||
}; // end of class XVOID
|
}; // end of class XVOID
|
||||||
|
|
||||||
|
|
||||||
@ -122,12 +110,7 @@ class DllExport CONSTANT : public XOBJECT {
|
|||||||
virtual bool Compare(PXOB xp);
|
virtual bool Compare(PXOB xp);
|
||||||
virtual bool SetFormat(PGLOBAL g, FORMAT& fmt)
|
virtual bool SetFormat(PGLOBAL g, FORMAT& fmt)
|
||||||
{return Value->SetConstFormat(g, fmt);}
|
{return Value->SetConstFormat(g, fmt);}
|
||||||
virtual int CheckSpcCol(PTDB, int) {return 1;}
|
|
||||||
// void Convert(PGLOBAL g, int newtype);
|
|
||||||
// bool Rephrase(PGLOBAL g, PSZ work);
|
|
||||||
void SetValue(PVAL vp) {Value = vp;}
|
void SetValue(PVAL vp) {Value = vp;}
|
||||||
virtual bool VerifyColumn(PTBX txp) {return true;}
|
|
||||||
virtual bool VerifyTdb(PTDB& tdbp) {return true;}
|
|
||||||
virtual void Print(PGLOBAL g, FILE *, uint);
|
virtual void Print(PGLOBAL g, FILE *, uint);
|
||||||
virtual void Print(PGLOBAL g, char *, uint);
|
virtual void Print(PGLOBAL g, char *, uint);
|
||||||
}; // end of class CONSTANT
|
}; // end of class CONSTANT
|
||||||
|
@ -33,58 +33,20 @@ class CMD : public BLOCK {
|
|||||||
char *Cmd;
|
char *Cmd;
|
||||||
}; // end of class CMD
|
}; // end of class CMD
|
||||||
|
|
||||||
// Filter passed all tables
|
// Condition filter structure
|
||||||
typedef struct _filter {
|
typedef struct _cond_filter {
|
||||||
char *Body;
|
char *Body;
|
||||||
OPVAL Op;
|
OPVAL Op;
|
||||||
PCMD Cmds;
|
PCMD Cmds;
|
||||||
} FILTER, *PFIL;
|
} CONDFIL, *PCFIL;
|
||||||
|
|
||||||
typedef class TDBCAT *PTDBCAT;
|
typedef class TDBCAT *PTDBCAT;
|
||||||
typedef class CATCOL *PCATCOL;
|
typedef class CATCOL *PCATCOL;
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Definition of class TBX (pure virtual class for TDB and OPJOIN) */
|
|
||||||
/***********************************************************************/
|
|
||||||
class DllExport TBX: public BLOCK { // Base class for OPJOIN and TDB classes.
|
|
||||||
public:
|
|
||||||
// Constructors
|
|
||||||
TBX(void);
|
|
||||||
TBX(PTBX txp);
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
inline PTBX GetOrig(void) {return To_Orig;}
|
|
||||||
inline TUSE GetUse(void) {return Use;}
|
|
||||||
inline void SetUse(TUSE n) {Use = n;}
|
|
||||||
inline PFIL GetFilter(void) {return To_Filter;}
|
|
||||||
inline void SetOrig(PTBX txp) {To_Orig = txp;}
|
|
||||||
inline void SetFilter(PFIL fp) {To_Filter = fp;}
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
virtual bool IsSame(PTBX tp) {return tp == this;}
|
|
||||||
virtual int GetTdb_No(void) = 0; // Convenience during conversion
|
|
||||||
virtual PTDB GetNext(void) = 0;
|
|
||||||
virtual int Cardinality(PGLOBAL) = 0;
|
|
||||||
virtual int GetMaxSize(PGLOBAL) = 0;
|
|
||||||
virtual int GetProgMax(PGLOBAL) = 0;
|
|
||||||
virtual int GetProgCur(void) = 0;
|
|
||||||
virtual int GetBadLines(void) {return 0;}
|
|
||||||
virtual PTBX Copy(PTABS t) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//virtual void PrepareFilters(PGLOBAL g) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// Members
|
|
||||||
PTBX To_Orig; // Pointer to original if it is a copy
|
|
||||||
PFIL To_Filter;
|
|
||||||
TUSE Use;
|
|
||||||
}; // end of class TBX
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Definition of class TDB with all its method functions. */
|
/* Definition of class TDB with all its method functions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport TDB: public TBX { // Table Descriptor Block.
|
class DllExport TDB: public BLOCK { // Table Descriptor Block.
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
TDB(PTABDEF tdp = NULL);
|
TDB(PTABDEF tdp = NULL);
|
||||||
@ -92,11 +54,17 @@ class DllExport TDB: public TBX { // Table Descriptor Block.
|
|||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
static void SetTnum(int n) {Tnum = n;}
|
static void SetTnum(int n) {Tnum = n;}
|
||||||
|
inline PTDB GetOrig(void) {return To_Orig;}
|
||||||
|
inline TUSE GetUse(void) {return Use;}
|
||||||
|
inline PCFIL GetCondFil(void) {return To_CondFil;}
|
||||||
inline LPCSTR GetName(void) {return Name;}
|
inline LPCSTR GetName(void) {return Name;}
|
||||||
inline PTABLE GetTable(void) {return To_Table;}
|
inline PTABLE GetTable(void) {return To_Table;}
|
||||||
inline PCOL GetColumns(void) {return Columns;}
|
inline PCOL GetColumns(void) {return Columns;}
|
||||||
inline int GetDegree(void) {return Degree;}
|
inline int GetDegree(void) {return Degree;}
|
||||||
inline MODE GetMode(void) {return Mode;}
|
inline MODE GetMode(void) {return Mode;}
|
||||||
|
inline void SetOrig(PTDB txp) {To_Orig = txp;}
|
||||||
|
inline void SetUse(TUSE n) {Use = n;}
|
||||||
|
inline void SetCondFil(PCFIL cfp) {To_CondFil = cfp;}
|
||||||
inline void SetNext(PTDB tdbp) {Next = tdbp;}
|
inline void SetNext(PTDB tdbp) {Next = tdbp;}
|
||||||
inline void SetName(LPCSTR name) {Name = name;}
|
inline void SetName(LPCSTR name) {Name = name;}
|
||||||
inline void SetTable(PTABLE tablep) {To_Table = tablep;}
|
inline void SetTable(PTABLE tablep) {To_Table = tablep;}
|
||||||
@ -105,25 +73,30 @@ class DllExport TDB: public TBX { // Table Descriptor Block.
|
|||||||
inline void SetMode(MODE mode) {Mode = mode;}
|
inline void SetMode(MODE mode) {Mode = mode;}
|
||||||
|
|
||||||
//Properties
|
//Properties
|
||||||
|
virtual AMT GetAmType(void) {return TYPE_AM_ERROR;}
|
||||||
virtual int GetTdb_No(void) {return Tdb_No;}
|
virtual int GetTdb_No(void) {return Tdb_No;}
|
||||||
virtual PTDB GetNext(void) {return Next;}
|
virtual PTDB GetNext(void) {return Next;}
|
||||||
virtual PCATLG GetCat(void) {return NULL;}
|
virtual PCATLG GetCat(void) {return NULL;}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual AMT GetAmType(void) {return TYPE_AM_ERROR;}
|
virtual bool IsSame(PTDB tp) {return tp == this;}
|
||||||
virtual bool GetBlockValues(PGLOBAL g) {return false;}
|
virtual bool GetBlockValues(PGLOBAL g) {return false;}
|
||||||
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
||||||
|
virtual int GetMaxSize(PGLOBAL) = 0;
|
||||||
|
virtual int GetProgMax(PGLOBAL) = 0;
|
||||||
|
virtual int GetProgCur(void) = 0;
|
||||||
virtual int RowNumber(PGLOBAL g, bool b = false);
|
virtual int RowNumber(PGLOBAL g, bool b = false);
|
||||||
virtual bool IsReadOnly(void) {return true;}
|
virtual bool IsReadOnly(void) {return true;}
|
||||||
virtual const CHARSET_INFO *data_charset() { return NULL; }
|
virtual const CHARSET_INFO *data_charset() {return NULL;}
|
||||||
virtual PTDB Duplicate(PGLOBAL g) {return NULL;}
|
virtual PTDB Duplicate(PGLOBAL g) {return NULL;}
|
||||||
virtual PTDB CopyOne(PTABS t) {return this;}
|
virtual PTDB CopyOne(PTABS t) {return this;}
|
||||||
virtual PTBX Copy(PTABS t);
|
virtual PTDB Copy(PTABS t);
|
||||||
virtual void PrintAM(FILE *f, char *m)
|
virtual void PrintAM(FILE *f, char *m)
|
||||||
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
|
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
|
||||||
virtual void Print(PGLOBAL g, FILE *f, uint n);
|
virtual void Print(PGLOBAL g, FILE *f, uint n);
|
||||||
virtual void Print(PGLOBAL g, char *ps, uint z);
|
virtual void Print(PGLOBAL g, char *ps, uint z);
|
||||||
virtual PSZ GetServer(void) = 0;
|
virtual PSZ GetServer(void) = 0;
|
||||||
|
virtual int GetBadLines(void) {return 0;}
|
||||||
|
|
||||||
// Database pure virtual routines
|
// Database pure virtual routines
|
||||||
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num) = 0;
|
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num) = 0;
|
||||||
@ -135,12 +108,11 @@ class DllExport TDB: public TBX { // Table Descriptor Block.
|
|||||||
virtual void CloseDB(PGLOBAL) = 0;
|
virtual void CloseDB(PGLOBAL) = 0;
|
||||||
virtual int CheckWrite(PGLOBAL g) {return 0;}
|
virtual int CheckWrite(PGLOBAL g) {return 0;}
|
||||||
|
|
||||||
// Database routines
|
|
||||||
bool OpenTable(PGLOBAL g, PSQL sqlp, MODE mode);
|
|
||||||
void CloseTable(PGLOBAL g);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
|
PTDB To_Orig; // Pointer to original if it is a copy
|
||||||
|
TUSE Use;
|
||||||
|
PCFIL To_CondFil; // To condition filter structure
|
||||||
static int Tnum; // Used to generate Tdb_no's
|
static int Tnum; // Used to generate Tdb_no's
|
||||||
const int Tdb_No; // GetTdb_No() is always 0 for OPJOIN
|
const int Tdb_No; // GetTdb_No() is always 0 for OPJOIN
|
||||||
PTDB Next; // Next in linearized queries
|
PTDB Next; // Next in linearized queries
|
||||||
|
Reference in New Issue
Block a user