summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-03-10 18:29:04 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2014-03-10 18:29:04 +0100
commite5729127b8a50a0e553fd8b87b2683e4a684dfcc (patch)
treee1aa801ddbce432955725707a90e0be9b8d8845f /storage/connect
parent126bb34513f34eba97598d2357bfc1c2fbf594b4 (diff)
downloadmariadb-git-e5729127b8a50a0e553fd8b87b2683e4a684dfcc.tar.gz
- 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
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/catalog.h1
-rw-r--r--storage/connect/colblk.cpp19
-rw-r--r--storage/connect/colblk.h16
-rw-r--r--storage/connect/connect.cc23
-rw-r--r--storage/connect/connect.h6
-rw-r--r--storage/connect/domdoc.h4
-rw-r--r--storage/connect/filamap.cpp41
-rw-r--r--storage/connect/filamap.h16
-rw-r--r--storage/connect/filamdbf.h11
-rw-r--r--storage/connect/filamfix.cpp4
-rw-r--r--storage/connect/filamfix.h24
-rw-r--r--storage/connect/filamtxt.cpp140
-rw-r--r--storage/connect/filamtxt.h25
-rwxr-xr-xstorage/connect/filamvct.cpp17
-rw-r--r--storage/connect/filamvct.h17
-rw-r--r--storage/connect/filamzip.cpp74
-rw-r--r--storage/connect/filamzip.h6
-rw-r--r--storage/connect/global.h3
-rw-r--r--storage/connect/ha_connect.cc278
-rw-r--r--storage/connect/ha_connect.h37
-rw-r--r--storage/connect/myconn.h6
-rw-r--r--storage/connect/plgcnx.h140
-rw-r--r--storage/connect/plgdbsem.h34
-rw-r--r--storage/connect/plugutil.c3
-rw-r--r--storage/connect/preparse.h27
-rw-r--r--storage/connect/reldef.cpp7
-rw-r--r--storage/connect/reldef.h4
-rw-r--r--storage/connect/tabcol.h2
-rw-r--r--storage/connect/tabdos.cpp172
-rw-r--r--storage/connect/tabdos.h55
-rw-r--r--storage/connect/tabfix.cpp4
-rw-r--r--storage/connect/tabfmt.cpp20
-rw-r--r--storage/connect/tabfmt.h7
-rw-r--r--storage/connect/table.cpp117
-rw-r--r--storage/connect/tabmac.h2
-rw-r--r--storage/connect/tabmul.h2
-rw-r--r--storage/connect/tabmysql.cpp13
-rw-r--r--storage/connect/tabmysql.h23
-rw-r--r--storage/connect/taboccur.h1
-rw-r--r--storage/connect/tabodbc.cpp14
-rw-r--r--storage/connect/tabodbc.h1
-rw-r--r--storage/connect/tabsys.cpp2
-rw-r--r--storage/connect/tabsys.h1
-rw-r--r--storage/connect/tabtbl.cpp23
-rw-r--r--storage/connect/tabtbl.h12
-rw-r--r--storage/connect/tabutil.h3
-rw-r--r--storage/connect/tabvct.cpp9
-rw-r--r--storage/connect/tabvct.h2
-rw-r--r--storage/connect/tabwmi.cpp20
-rw-r--r--storage/connect/tabwmi.h1
-rw-r--r--storage/connect/tabxml.cpp2
-rw-r--r--storage/connect/tabxml.h6
-rw-r--r--storage/connect/user_connect.cc3
-rw-r--r--storage/connect/user_connect.h3
-rw-r--r--storage/connect/valblk.cpp3
-rw-r--r--storage/connect/valblk.h12
-rw-r--r--storage/connect/value.cpp120
-rw-r--r--storage/connect/value.h13
-rwxr-xr-xstorage/connect/xindex.cpp6
-rw-r--r--storage/connect/xindex.h15
-rw-r--r--storage/connect/xobject.cpp13
-rw-r--r--storage/connect/xobject.h17
-rw-r--r--storage/connect/xtable.h70
63 files changed, 331 insertions, 1441 deletions
diff --git a/storage/connect/catalog.h b/storage/connect/catalog.h
index a61b1a53653..a4fba7ae920 100644
--- a/storage/connect/catalog.h
+++ b/storage/connect/catalog.h
@@ -43,7 +43,6 @@ typedef struct _colinfo {
int Key;
int Precision;
int Scale;
- int Opt;
char *Remark;
char *Datefmt;
char *Fieldfmt;
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index bce26e25387..f407907b8a7 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -36,7 +36,6 @@ COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
if ((Cdp = cdp)) {
Name = cdp->Name;
Format = cdp->F;
- Opt = cdp->Opt;
Long = cdp->Long;
Precision = cdp->Precision;
Buf_Type = cdp->Buf_Type;
@@ -46,7 +45,6 @@ COLBLK::COLBLK(PCOLDEF cdp, PTDB tdbp, int i)
} else {
Name = NULL;
memset(&Format, 0, sizeof(FORMAT));
- Opt = 0;
Long = 0;
Precision = 0;
Buf_Type = TYPE_ERROR;
@@ -123,14 +121,6 @@ bool COLBLK::SetFormat(PGLOBAL g, FORMAT& fmt)
} // 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 */
/* matching Index column if there is one. */
/***********************************************************************/
@@ -155,15 +145,6 @@ bool COLBLK::Eval(PGLOBAL g)
} // 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. */
/* Now we use Format.Length for the len parameter to avoid strings */
/* to be truncated when converting from string to coded string. */
diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h
index 7b84d237bd2..e1d4fc7e948 100644
--- a/storage/connect/colblk.h
+++ b/storage/connect/colblk.h
@@ -39,7 +39,6 @@ class DllExport COLBLK : public XOBJECT {
PCOL GetNext(void) {return Next;}
PSZ GetName(void) {return Name;}
int GetIndex(void) {return Index;}
- int GetOpt(void) {return Opt;}
ushort GetColUse(void) {return ColUse;}
ushort GetColUse(ushort u) {return (ColUse & u);}
ushort GetStatus(void) {return Status;}
@@ -49,9 +48,6 @@ class DllExport COLBLK : public XOBJECT {
void AddColUse(ushort u) {ColUse |= u;}
void AddStatus(ushort u) {Status |= u;}
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;}
PCOLDEF GetCdp(void) {return Cdp;}
PSZ GetDomain(void) {return (Cdp) ? Cdp->Decode : NULL;}
@@ -65,10 +61,7 @@ class DllExport COLBLK : public XOBJECT {
virtual void Reset(void);
virtual bool Compare(PXOB xp);
virtual bool SetFormat(PGLOBAL, FORMAT&);
- virtual int CheckColumn(PGLOBAL g, PSQL sqlp, PXOB &xp, int &ag);
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 SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void SetTo_Val(PVAL valp) {}
@@ -76,8 +69,6 @@ class DllExport COLBLK : public XOBJECT {
virtual void WriteColumn(PGLOBAL g);
virtual void Print(PGLOBAL g, FILE *, 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);
protected:
@@ -90,7 +81,6 @@ class DllExport COLBLK : public XOBJECT {
bool Nullable; // True if nullable
bool Unsigned; // True if unsigned
int Index; // Column number in table
- int Opt; // Cluster/sort information
int Buf_Type; // Data type
int Long; // Internal length in table
int Precision; // Column length (as for ODBC)
@@ -153,8 +143,6 @@ class DllExport FIDBLK : public SPCBLK {
// Methods
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);
protected:
@@ -174,8 +162,6 @@ class DllExport TIDBLK : public SPCBLK {
// Methods
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);
protected:
@@ -199,8 +185,6 @@ class DllExport SIDBLK : public SPCBLK {
// Methods
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);
protected:
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index d111ff07044..fd3add532a5 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -415,11 +415,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
colp->Reset();
// 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))
-#endif // !MRRBKA_SUPPORT
if (colp->Eval(g))
rc= RC_FX;
@@ -433,7 +429,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr)
/***********************************************************************/
/* ReadNext: Read next record sequentially. */
/***********************************************************************/
-RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
+RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
{
RCODE rc;
@@ -449,8 +445,21 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
((PTDBASE)tdbp)->SetKindex(NULL);
} // 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) ;
-
+
+ err:
+ g->jump_level--;
return (rc != RC_OK) ? rc : EvalColumns(g, tdbp);
} // end of CntReadNext
@@ -572,7 +581,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp)
return 0;
if (xtrace > 1)
- printf("About to reset opt\n");
+ printf("About to reset indexes\n");
// Make all the eventual indexes
tbxp= (TDBDOX*)tdbp;
diff --git a/storage/connect/connect.h b/storage/connect/connect.h
index bf97d61b35f..be423fcb575 100644
--- a/storage/connect/connect.h
+++ b/storage/connect/connect.h
@@ -17,7 +17,6 @@
/* Name: CONNECT.H Version 2.4 */
/* This file contains the some based classes declares. */
/***********************************************************************/
-//#include "xtable.h" // Base class declares
#include "filamtxt.h"
#include "tabdos.h"
@@ -52,8 +51,6 @@ PGLOBAL CntExit(PGLOBAL g);
/* These classes purpose is chiefly to access protected items! */
/***********************************************************************/
class DOXDEF: public DOSDEF {
-//friend class TDBDOX;
-//friend int MakeIndex(PGLOBAL, PTDB, PIXDEF);
friend int CntIndexInit(PGLOBAL, PTDB, int);
}; // end of class DOXDEF
@@ -74,10 +71,7 @@ class TDBDOX: public TDBDOS {
class XKPDEF: public KPARTDEF {
friend class TDBDOX;
friend class ha_connect;
-//friend int CntMakeIndex(PGLOBAL, const char *, PIXDEF);
friend int CntIndexInit(PGLOBAL, PTDB, int);
public:
XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
}; // end of class XKPDEF
-
-//RCODE CheckRecord(PGLOBAL g, PTDB tdbp, char *oldbuf, char *newbuf);
diff --git a/storage/connect/domdoc.h b/storage/connect/domdoc.h
index b0bcc1478a5..118541d8eb0 100644
--- a/storage/connect/domdoc.h
+++ b/storage/connect/domdoc.h
@@ -20,7 +20,6 @@ typedef struct _xblock { /* Loaded XML file block */
short Type; /* TYPE_FB_XML */
int Retcode; /* Return code from Load */
MSXML2::IXMLDOMDocumentPtr Docp;/* Document interface pointer */
-//IXMLDOMNodeListPtr Nlist;
} XBLOCK, *PXBLOCK;
/******************************************************************/
@@ -123,9 +122,6 @@ class DOMATTR : public XMLATTRIBUTE {
friend class DOMDOC;
friend class DOMNODE;
public:
- // Properties
-//virtual char *GetText(void);
-
// Methods
virtual bool SetText(PGLOBAL g, char *txtp, int len);
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 5a67c5d2dd2..48f5e9d3f80 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -322,8 +322,8 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
/*******************************************************************/
/* Record file position in case of UPDATE or DELETE. */
/*******************************************************************/
- Fpos = Mempos;
- CurBlk = (int)Rows++;
+ Fpos = Mempos;
+ CurBlk = (int)Rows++;
} else
Placed = false;
@@ -491,7 +491,7 @@ MBKFAM::MBKFAM(PDOSDEF tdp) : MAPFAM(tdp)
Block = tdp->GetBlock();
Last = tdp->GetLast();
Nrec = tdp->GetElemt();
- BlkPos = tdp->GetTo_Pos();
+ BlkPos = NULL;
CurNum = Nrec;
} // end of MBKFAM standard constructor
@@ -537,37 +537,8 @@ int MBKFAM::GetRowID(void)
/***********************************************************************/
int MBKFAM::ReadBuffer(PGLOBAL g)
{
- int len;
-
- /*********************************************************************/
- /* 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;
+ strcpy(g->Message, "This AM cannot be used in this version");
+ return RC_FX;
} // end of ReadBuffer
/***********************************************************************/
@@ -657,7 +628,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
/* New block. */
/*******************************************************************/
CurNum = 0;
-
+
if (++CurBlk >= Block)
return RC_EF;
diff --git a/storage/connect/filamap.h b/storage/connect/filamap.h
index d3503bb0c1d..7f71b90a18f 100644
--- a/storage/connect/filamap.h
+++ b/storage/connect/filamap.h
@@ -33,7 +33,6 @@ class DllExport MAPFAM : public TXTFAM {
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
- virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
@@ -66,18 +65,16 @@ class DllExport MBKFAM : public MAPFAM {
MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {}
// Implementation
- virtual PTXF Duplicate(PGLOBAL g)
+ virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MBKFAM(this);}
// Methods
- virtual void Reset(void);
+ virtual void Reset(void);
virtual int Cardinality(PGLOBAL g);
- virtual int MaxBlkSize(PGLOBAL g, int s)
- {return TXTFAM::MaxBlkSize(g, s);}
virtual int GetRowID(void);
- virtual int SkipRecord(PGLOBAL g, bool header);
- virtual int ReadBuffer(PGLOBAL g);
- virtual void Rewind(void);
+ virtual int SkipRecord(PGLOBAL g, bool header);
+ virtual int ReadBuffer(PGLOBAL g);
+ virtual void Rewind(void);
protected:
// No additional members
@@ -99,9 +96,6 @@ class DllExport MPXFAM : public MBKFAM {
// Methods
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 DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g);
diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h
index 361f2bd8360..b85b9fc47fe 100644
--- a/storage/connect/filamdbf.h
+++ b/storage/connect/filamdbf.h
@@ -43,7 +43,6 @@ class DllExport DBFBASE {
int Nerr; /* Number of bad records */
int Maxerr; /* Maximum number of bad records */
int ReadMode; /* 1: ALL 2: DEL 0: NOT DEL */
-//PSZ Defpath; /* Default data path */
}; // end of class DBFBASE
/****************************************************************************/
@@ -63,22 +62,18 @@ class DllExport DBFFAM : public FIXFAM, public DBFBASE {
// Methods
virtual int GetNerr(void) {return Nerr;}
virtual int Cardinality(PGLOBAL g);
-//virtual int GetRowID(void); // Temporarily suppressed
virtual bool OpenTableFile(PGLOBAL g);
virtual bool AllocateBuffer(PGLOBAL g);
virtual void ResetBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
-//virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
virtual void Rewind(void);
protected:
- // Members
virtual bool CopyHeader(PGLOBAL g);
-//int Records; in TXTFAM
-//int Headlen; in TXTFAM
+ // Members
}; // end of class DBFFAM
/****************************************************************************/
@@ -100,17 +95,13 @@ class DllExport DBMFAM : public MPXFAM, public DBFBASE {
// Methods
virtual int GetNerr(void) {return Nerr;}
virtual int Cardinality(PGLOBAL g);
-//virtual int GetRowID(void); // Temporarily suppressed
virtual bool AllocateBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
-//virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void Rewind(void);
protected:
// Members
-//int Records; in TXTFAM
-//int Headlen; in TXTFAM
}; // end of class DBFFAM
#endif // __FILAMDBF_H
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index a92d9766933..87639a4c757 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -1,11 +1,11 @@
/*********** File AM Fix C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: FILAMFIX */
/* ------------- */
-/* Version 1.4 */
+/* Version 1.5 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
+/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
diff --git a/storage/connect/filamfix.h b/storage/connect/filamfix.h
index 758d891bf2c..6f9e6ef3b45 100644
--- a/storage/connect/filamfix.h
+++ b/storage/connect/filamfix.h
@@ -31,18 +31,16 @@ class DllExport FIXFAM : public BLKFAM {
// Methods
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
- virtual int MaxBlkSize(PGLOBAL g, int s)
- {return TXTFAM::MaxBlkSize(g, s);}
- virtual bool AllocateBuffer(PGLOBAL g);
- virtual void ResetBuffer(PGLOBAL g);
- virtual int ReadBuffer(PGLOBAL g);
- virtual int WriteBuffer(PGLOBAL g);
- virtual int DeleteRecords(PGLOBAL g, int irc);
- virtual void CloseTableFile(PGLOBAL g);
+ virtual bool AllocateBuffer(PGLOBAL g);
+ virtual void ResetBuffer(PGLOBAL g);
+ virtual int ReadBuffer(PGLOBAL g);
+ virtual int WriteBuffer(PGLOBAL g);
+ virtual int DeleteRecords(PGLOBAL g, int irc);
+ virtual void CloseTableFile(PGLOBAL g);
protected:
- virtual bool CopyHeader(PGLOBAL g) {return false;}
- virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
+ virtual bool CopyHeader(PGLOBAL g) {return false;}
+ virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
// No additional members
}; // end of class FIXFAM
@@ -64,12 +62,11 @@ class BGXFAM : public FIXFAM {
{return (PTXF)new(g) BGXFAM(this);}
// Methods
-//virtual void Reset(void);
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(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 Rewind(void);
@@ -78,13 +75,12 @@ class BGXFAM : public FIXFAM {
, int org = FILE_BEGIN);
int BigRead(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);
// Members
HANDLE Hfile; // Handle(descriptor) to big file
HANDLE Tfile; // Handle(descriptor) to big temp file
-//BIGINT Xpos; // Current file position
}; // end of class BGXFAM
#endif // __FILAMFIX_H
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index 1d3f17e2228..b700ae182a0 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -228,25 +228,6 @@ int TXTFAM::Cardinality(PGLOBAL g)
} // 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 -------------------------- */
/***********************************************************************/
@@ -314,15 +295,6 @@ int DOSFAM::Cardinality(PGLOBAL g)
} // 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. */
/***********************************************************************/
bool DOSFAM::OpenTableFile(PGLOBAL g)
@@ -993,7 +965,7 @@ BLKFAM::BLKFAM(PDOSDEF tdp) : DOSFAM(tdp)
Last = tdp->GetLast();
Nrec = tdp->GetElemt();
Closing = false;
- BlkPos = tdp->GetTo_Pos();
+ BlkPos = NULL;
CurLine = NULL;
NxtLine = NULL;
OutBuf = NULL;
@@ -1029,23 +1001,6 @@ int BLKFAM::Cardinality(PGLOBAL g)
} // 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 */
/* used another big buffer has to be allocated because is it used */
/* to move or update the lines into the (temp) file. */
@@ -1150,97 +1105,8 @@ int BLKFAM::SkipRecord(PGLOBAL g, bool header)
/***********************************************************************/
int BLKFAM::ReadBuffer(PGLOBAL g)
{
- int i, n, rc = RC_OK;
-
- /*********************************************************************/
- /* 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;
+ strcpy(g->Message, "This AM cannot be used in this version");
+ return RC_FX;
} // end of ReadBuffer
/***********************************************************************/
diff --git a/storage/connect/filamtxt.h b/storage/connect/filamtxt.h
index a6105d0fe66..c3ee96ada1a 100644
--- a/storage/connect/filamtxt.h
+++ b/storage/connect/filamtxt.h
@@ -39,10 +39,10 @@ class DllExport TXTFAM : public BLOCK {
virtual int GetNextPos(void) = 0;
virtual PTXF Duplicate(PGLOBAL g) = 0;
virtual bool GetUseTemp(void) {return false;}
- virtual int GetDelRows(void) {return DelRows;}
+ virtual int GetDelRows(void) {return DelRows;}
int GetCurBlk(void) {return CurBlk;}
void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;}
- int GetBlock(void) {return Block;}
+ int GetBlock(void) {return Block;}
void SetBlkPos(int *bkp) {BlkPos = bkp;}
void SetNrec(int n) {Nrec = n;}
char *GetBuf(void) {return To_Buf;}
@@ -53,7 +53,6 @@ class DllExport TXTFAM : public BLOCK {
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
- virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g) {return false;}
virtual void ResetBuffer(PGLOBAL g) {}
virtual int GetNerr(void) {return 0;}
@@ -71,19 +70,19 @@ class DllExport TXTFAM : public BLOCK {
protected:
// Members
- PTDBDOS Tdbp; // To table class
+ PTDBDOS Tdbp; // To table class
PSZ To_File; // Points to table file name
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 Blocked; // true if using blocked I/O
char *To_Buf; // Points to I/O buffer
void *DelBuf; // Buffer used to move lines in Delete
int *BlkPos; // To array of block positions
- int BlkLen; // Current block length
+ int BlkLen; // Current block length
int Buflen; // 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 Headlen; // Number of bytes in header
int Lrecl; // Logical Record Length
@@ -93,14 +92,14 @@ class DllExport TXTFAM : public BLOCK {
int OldBlk; // Index of last read block
int CurBlk; // Index of current block
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 Modif; // Number of modified lines in block
int Blksize; // Size of padded blocks
- int Ending; // Length of line end
- bool Padded; // true if fixed size blocks are padded
+ int Ending; // Length of line end
+ bool Padded; // true if fixed size blocks are padded
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
/***********************************************************************/
@@ -125,7 +124,6 @@ class DllExport DOSFAM : public TXTFAM {
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
- virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
@@ -134,7 +132,7 @@ class DllExport DOSFAM : public TXTFAM {
virtual bool OpenTableFile(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 Rewind(void);
@@ -174,7 +172,6 @@ class DllExport BLKFAM : public DOSFAM {
// Methods
virtual void Reset(void);
virtual int Cardinality(PGLOBAL g);
- virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index 11c9ac69d4d..ffd46c32231 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -245,23 +245,6 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g)
} // 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. */
/* This function can be called with a null argument to test the */
/* availability of Cardinality implementation (1 yes, 0 no). */
diff --git a/storage/connect/filamvct.h b/storage/connect/filamvct.h
index 22665c6cd23..0dd1c06ad8b 100644
--- a/storage/connect/filamvct.h
+++ b/storage/connect/filamvct.h
@@ -40,7 +40,6 @@ class DllExport VCTFAM : public FIXFAM {
// Methods
virtual void Reset(void);
- virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g);
virtual bool InitInsert(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 *Tempat; // Pattern for temp file names (VER)
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 AddBlock; // True when adding new blocks on Insert
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 Bsize; // Because Nrec can be modified
int Ncol; // The number of columns;
@@ -164,7 +163,7 @@ class DllExport VECFAM : public VCTFAM {
FILE* *T_Streams; // Points to temp file structure array
PFBLOCK *To_Fbs; // Pointer to 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
}; // end of class VECFAM
@@ -189,7 +188,7 @@ class DllExport VMPFAM : public VCMFAM {
// Database routines
virtual bool OpenTableFile(PGLOBAL g);
- virtual int DeleteRecords(PGLOBAL g, int irc);
+ virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
protected:
@@ -220,7 +219,7 @@ class BGVFAM : public VCTFAM {
// Database routines
virtual bool OpenTableFile(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 Rewind(void);
@@ -233,11 +232,11 @@ class BGVFAM : public VCTFAM {
bool BigRead(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 OpenTempFile(PGLOBAL g);
+ virtual bool OpenTempFile(PGLOBAL g);
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
virtual bool CleanUnusedSpace(PGLOBAL g);
- virtual bool SetBlockInfo(PGLOBAL g);
- virtual int GetBlockInfo(PGLOBAL g);
+ virtual bool SetBlockInfo(PGLOBAL g);
+ virtual int GetBlockInfo(PGLOBAL g);
// Members
HANDLE Hfile; // Handle to big file
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index 4f1a02d8257..ae4e2c33227 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -403,7 +403,7 @@ ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
CurLine = NULL;
NxtLine = NULL;
Closing = false;
- BlkPos = tdp->GetTo_Pos();
+ BlkPos = NULL;
} // end of ZBKFAM standard constructor
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
@@ -414,23 +414,6 @@ ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
} // 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. */
/* This function can be called with a null argument to test the */
/* availability of Cardinality implementation (1 yes, 0 no). */
@@ -509,56 +492,8 @@ int ZBKFAM::SkipRecord(PGLOBAL g, bool header)
/***********************************************************************/
int ZBKFAM::ReadBuffer(PGLOBAL g)
{
- int n, rc = RC_OK;
-
- /*********************************************************************/
- /* 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;
+ strcpy(g->Message, "This AM cannot be used in this version");
+ return RC_FX;
} // end of ReadBuffer
/***********************************************************************/
@@ -770,9 +705,6 @@ int ZIXFAM::ReadBuffer(PGLOBAL g)
CurNum = 0;
Tdbp->SetLine(To_Buf);
-//if (++CurBlk >= Block)
-// return RC_EF;
-
if (!(n = gzread(Zfile, To_Buf, Buflen))) {
rc = RC_EF;
} else if (n > 0) {
diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h
index f6f28ca5315..37cc130311c 100644
--- a/storage/connect/filamzip.h
+++ b/storage/connect/filamzip.h
@@ -38,7 +38,6 @@ class DllExport ZIPFAM : public TXTFAM {
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
- virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
@@ -78,7 +77,6 @@ class DllExport ZBKFAM : public ZIPFAM {
// Methods
virtual int Cardinality(PGLOBAL g);
- virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
@@ -122,7 +120,7 @@ class DllExport ZIXFAM : public ZBKFAM {
// No additional Members
}; // end of class ZIXFAM
-#ifdef NOT_USED
+#if 0
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
/* fixed/variable files compressed using the zlib library functions. */
@@ -166,6 +164,6 @@ class DllExport ZLBFAM : public BLKFAM {
int *Zlenp; // Pointer to block length
bool Optimized; // true when opt file is available
}; // end of class ZLBFAM
-#endif // NOT_USED
+#endif // 0
#endif // __FILAMZIP_H
diff --git a/storage/connect/global.h b/storage/connect/global.h
index 374ba6e4177..8bccd742a64 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -222,9 +222,6 @@ typedef struct _global { /* Global structure */
int Createas; /* To pass info to created table */
void *Xchk; /* indexes in create/alter */
short Alchecked; /* Checked for ALTER */
-#if defined(MRRBKA_SUPPORT)
- short Mrr; /* True when doing mrr */
-#endif // MRRBKA_SUPPORT
short Trace;
int jump_level;
jmp_buf jumper[MAX_JUMP + 2];
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index f19cac9da50..39329dfb422 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -252,8 +252,6 @@ ha_create_table_option connect_table_option_list[]=
ha_create_table_option connect_field_option_list[]=
{
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_STRING("DATE_FORMAT", dateformat),
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
*/
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",
- NULL
-};
-
+ NULL};
/**
@brief
@@ -453,7 +449,7 @@ static handler* connect_create_handler(handlerton *hton,
handler *h= new (mem_root) ha_connect(hton, table);
if (xtrace)
- printf("New CONNECT %p, table: %s\n",
+ htrc("New CONNECT %p, table: %s\n",
h, table ? table->table_name.str : "<null>");
return h;
@@ -500,7 +496,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
ha_connect::~ha_connect(void)
{
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>",
xp, xp ? xp->count : 0);
@@ -923,7 +919,6 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
} // endif special
pcf->Scale= 0;
- pcf->Opt= (fop) ? (int)fop->opt : 0;
if ((pcf->Length= fp->field_length) < 0)
pcf->Length= 256; // BLOB?
@@ -932,12 +927,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
if (fop) {
pcf->Offset= (int)fop->offset;
-// pcf->Freq= fop->freq;
pcf->Datefmt= (char*)fop->dateformat;
pcf->Fieldfmt= (char*)fop->fieldformat;
} else {
pcf->Offset= -1;
-// pcf->Freq= 0;
pcf->Datefmt= NULL;
pcf->Fieldfmt= NULL;
} // endif fop
@@ -961,7 +954,6 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
// Find if collation name ends by _ci
if (!strcmp(cp + strlen(cp) - 3, "_ci")) {
pcf->Scale= 1; // Case insensitive
- pcf->Opt= 0; // Prevent index opt until it is safe
} // endif ci
break;
@@ -1046,7 +1038,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
for (int n= 0; (unsigned)n < s->keynames.count; n++) {
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
kp= s->key_info[n];
@@ -1182,7 +1174,7 @@ PTDB ha_connect::GetTDB(PGLOBAL g)
valid_query_id= xp->last_query_id;
tp->SetMode(xmod);
} else
- printf("GetTDB: %s\n", g->Message);
+ htrc("GetTDB: %s\n", g->Message);
return tp;
} // end of GetTDB
@@ -1197,7 +1189,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
// Double test to be on the safe side
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;
} // endif g
@@ -1278,9 +1270,8 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
PIXDEF oldpix= GetIndexInfo();
} // endif xmod
-// tdbp->SetOrig((PTBX)table); // used by CheckCond
} else
- printf("OpenTable: %s\n", g->Message);
+ htrc("OpenTable: %s\n", g->Message);
if (rc) {
tdbp= NULL;
@@ -1334,7 +1325,7 @@ int ha_connect::MakeRecord(char *buf)
DBUG_ENTER("ha_connect::MakeRecord");
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->vcol_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) {
// This is a used field, fill the buffer with value
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))
break;
-#endif // !MRRBKA_SUPPORT
if (!colp) {
-#if defined(MRRBKA_SUPPORT)
- if (mrr)
- continue;
-#endif // MRRBKA_SUPPORT
- printf("Column %s not found\n", fp->field_name);
+ htrc("Column %s not found\n", fp->field_name);
dbug_tmp_restore_column_map(table->write_set, org_bitmap);
DBUG_RETURN(HA_ERR_WRONG_IN_RECORD);
} // endif colp
@@ -1487,7 +1468,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
break;
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;
goto err;
} else
@@ -1612,16 +1593,16 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg)
val= (neg) ? " NOT IN (" : " IN (";
break;
case OP_NULL:
- val= " IS NULL";
+ val= (neg) ? " IS NOT NULL" : " IS NULL";
break;
case OP_LIKE:
val= " LIKE ";
break;
case OP_XX:
- val= " BETWEEN ";
+ val= (neg) ? " NOT BETWEEN " : " BETWEEN ";
break;
case OP_EXIST:
- val= " EXISTS ";
+ val= (neg) ? " NOT EXISTS " : " EXISTS ";
break;
case OP_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;
unsigned int i;
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;
if (!cond)
return NULL;
if (xtrace)
- printf("Cond type=%d\n", cond->type());
+ htrc("Cond type=%d\n", cond->type());
if (cond->type() == COND::COND_ITEM) {
char *p1, *p2;
@@ -1681,7 +1661,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
return NULL;
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());
switch (cond_item->functype()) {
@@ -1728,7 +1708,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
Item* *args= condf->arguments();
if (xtrace)
- printf("Func type=%d argnum=%d\n", condf->functype(),
+ htrc("Func type=%d argnum=%d\n", condf->functype(),
condf->argument_count());
// 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::GT_FUNC: vop= OP_GT; break;
case Item_func::IN_FUNC: vop= OP_IN;
+ case Item_func::BETWEEN:
+ ismul= true;
neg= ((Item_func_opt_neg *)condf)->negated;
- case Item_func::BETWEEN: ismul= true; break;
+ break;
default: return NULL;
} // 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++) {
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 (xtrace)
- printf("Unexpected arg for vop=%d\n", vop);
+ htrc("Unexpected arg for vop=%d\n", vop);
continue;
} // endif i
@@ -1793,8 +1775,8 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
fnm= pField->field->field_name;
if (xtrace) {
- printf("Field index=%d\n", pField->field->field_index);
- printf("Field name=%s\n", pField->field->field_name);
+ htrc("Field index=%d\n", pField->field->field_index);
+ htrc("Field name=%s\n", pField->field->field_name);
} // endif xtrace
// 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);
Item_basic_constant *pval= (Item_basic_constant *)args[i];
- switch (args[i]->type()) {
+ switch (args[i]->real_type()) {
case COND::STRING_ITEM:
case COND::INT_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
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
if (!i && (x || ismul))
@@ -1877,7 +1859,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
} else {
if (xtrace)
- printf("Unsupported condition\n");
+ htrc("Unsupported condition\n");
return NULL;
} // endif's type
@@ -1912,32 +1894,33 @@ const COND *ha_connect::cond_push(const COND *cond)
if (tdbp) {
AMT tty= tdbp->GetAmType();
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 ||
- tty == TYPE_AM_TBL || tty == TYPE_AM_MYSQL ||
- tty == TYPE_AM_PLG || x) {
+ if (b) {
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= 0;
filp->Op= OP_XX;
filp->Cmds= NULL;
-
+
if (CheckCond(g, filp, tty, (Item *)cond)) {
if (xtrace)
- printf("cond_push: %s\n", filp->Body);
-
+ htrc("cond_push: %s\n", filp->Body);
+
if (!x)
PlugSubAlloc(g, NULL, strlen(filp->Body) + 1);
else
- cond= NULL; // Does this work?
-
- tdbp->SetFilter(filp);
+ cond= NULL; // Does this work?
+
+ tdbp->SetCondFil(filp);
} else if (x && cond)
- tdbp->SetFilter(filp); // Wrong filter
+ tdbp->SetCondFil(filp); // Wrong filter
- } // endif tty
+ } // endif b
} // endif tdbp
@@ -2019,7 +2002,7 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked)
DBUG_ENTER("ha_connect::open");
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()))
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;
// Try to set the database environment
- if (g) {
+ if (g)
rc= (CntCheckDB(g, this, name)) ? (-2) : 0;
-#if defined(MRRBKA_SUPPORT)
- if (g->Mrr) {
- // This should only happen for the mrr secondary handler
- mrr= true;
- g->Mrr= false;
- } else
- mrr= false;
-#endif // MRRBKA_SUPPORT
- } else
+ else
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
@@ -2062,7 +2037,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT* check_opt)
tdbp= GetTDB(g);
dup->Check |= CHK_OPT;
- if (tdbp || (tdbp= GetTDB(g))) {
+ if (tdbp) {
if (!((PTDBASE)tdbp)->GetDef()->Indexable()) {
sprintf(g->Message, "optimize: Table %s is not indexable", tdbp->GetName());
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
if (CntWriteRow(g, tdbp)) {
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;
} // endif RC
@@ -2216,7 +2191,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data)
DBUG_ENTER("ha_connect::update_row");
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
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)) {
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;
} // endif RC
@@ -2258,7 +2233,7 @@ int ha_connect::delete_row(const uchar *buf)
if (CntDeleteRow(xp->g, tdbp, false)) {
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
DBUG_RETURN(rc);
@@ -2275,7 +2250,7 @@ int ha_connect::index_init(uint idx, bool sorted)
DBUG_ENTER("index_init");
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)))
return rc;
@@ -2291,7 +2266,7 @@ int ha_connect::index_init(uint idx, bool sorted)
if (indexing <= 0) {
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;
rc= HA_ERR_INTERNAL_ERROR;
} else {
@@ -2307,7 +2282,7 @@ int ha_connect::index_init(uint idx, bool sorted)
} // endif indexing
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);
DBUG_RETURN(rc);
@@ -2320,9 +2295,6 @@ int ha_connect::index_end()
{
DBUG_ENTER("index_end");
active_index= MAX_KEY;
-#if defined(MRRBKA_SUPPORT)
- ds_mrr.dsmrr_close();
-#endif // MRRBKA_SUPPORT
DBUG_RETURN(rnd_end());
} // end of index_end
@@ -2350,13 +2322,13 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const uchar *key, uint key_len
break;
default: // Read error
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;
break;
} // endswitch RC
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;
return rc;
@@ -2399,7 +2371,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len,
} // endswitch find_flag
if (xtrace > 1)
- printf("%p index_read: op=%d\n", this, op);
+ htrc("%p index_read: op=%d\n", this, op);
if (indexing > 0)
rc= ReadIndexed(buf, op, key, key_len);
@@ -2542,7 +2514,7 @@ int ha_connect::rnd_init(bool scan)
} // endif xmod
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);
if (!g || !table || xmod == MODE_INSERT)
@@ -2589,9 +2561,6 @@ int ha_connect::rnd_end()
// if (tdbp && xp->last_query_id == valid_query_id)
// rc= CloseTable(xp->g);
-#if defined(MRRBKA_SUPPORT)
- ds_mrr.dsmrr_close();
-#endif // MRRBKA_SUPPORT
DBUG_RETURN(rc);
} // end of rnd_end
@@ -2637,22 +2606,23 @@ int ha_connect::rnd_next(uchar *buf)
rc= HA_ERR_RECORD_DELETED;
break;
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;
break;
} // endswitch RC
-#ifndef DBUG_OFF
- if (rc || !(xp->nrd++ % 16384)) {
+ if (xtrace > 1 && (rc || !(xp->nrd++ % 16384))) {
ulonglong tb2= my_interval_timer();
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
rc, (uint)xp->nrd, (uint)xp->fnd,
(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->fnd= xp->nfd= 0;
} // endif nrd
-#endif
table->status= (!rc) ? 0 : STATUS_NOT_FOUND;
DBUG_RETURN(rc);
@@ -2766,7 +2736,7 @@ int ha_connect::info(uint flag)
DBUG_ENTER("ha_connect::info");
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) {
// tdbp must be available to get updated info
@@ -2879,7 +2849,7 @@ int ha_connect::delete_all_rows()
if (!(rc= OpenTable(g))) {
if (CntDeleteRow(g, tdbp, true)) {
- printf("%s\n", g->Message);
+ htrc("%s\n", g->Message);
rc= HA_ERR_INTERNAL_ERROR;
} // endif
@@ -2989,8 +2959,8 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
{
if (xtrace) {
LEX_STRING *query_string= thd_query_string(thd);
- printf("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
- printf("Cmd=%.*s\n", (int) query_string->length, query_string->str);
+ htrc("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd));
+ htrc("Cmd=%.*s\n", (int) query_string->length, query_string->str);
} // endif xtrace
// 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;
break;
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");
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
newmode= MODE_ERROR;
@@ -3085,7 +3055,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
newmode= MODE_ALTER;
break;
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");
my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0));
newmode= MODE_ERROR;
@@ -3095,7 +3065,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
} // endif's newmode
if (xtrace)
- printf("New mode=%d\n", newmode);
+ htrc("New mode=%d\n", newmode);
return newmode;
} // end of check_mode
@@ -3170,7 +3140,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
DBUG_ASSERT(thd == current_thd);
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);
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)) {
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);
} // endif check_privileges
@@ -3343,18 +3313,18 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (xtrace) {
#if 0
- printf("xcheck=%d cras=%d\n", xcheck, cras);
+ htrc("xcheck=%d cras=%d\n", xcheck, cras);
if (xcheck)
- printf("oldsep=%d oldpix=%p\n",
+ htrc("oldsep=%d oldpix=%p\n",
((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix);
#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
// Set or reset the good database environment
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;
// This can NOT be called without open called first, but
// the table can have been closed since then
@@ -3375,7 +3345,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
} // endif tdbp
if (xtrace)
- printf("external_lock: rc=%d\n", rc);
+ htrc("external_lock: rc=%d\n", rc);
DBUG_RETURN(rc);
} // end of external_lock
@@ -3517,10 +3487,10 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to)
if (xtrace) {
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);
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);
} // endif xtrace
@@ -3625,7 +3595,7 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
index_init(inx, false);
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) {
int nval;
@@ -4626,7 +4596,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
table= table_arg; // Used by called functions
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());
// CONNECT engine specific table options:
@@ -4954,7 +4924,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
} // endif
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
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);
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));
rc= HA_ERR_INTERNAL_ERROR;
} else
@@ -5025,7 +4995,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
g->Xchk= NULL;
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);
// if (g->Xchk &&
@@ -5306,7 +5276,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
tshp= NULL;
if (xtrace && g->Xchk)
- printf(
+ htrc(
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
xcp->oldsep, xcp->newsep,
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
-#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=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 1bd3991e907..7d4ef94e6c4 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -122,8 +122,6 @@ struct ha_table_option_struct {
struct ha_field_option_struct
{
ulonglong offset;
- ulonglong freq; // Not used by this version
- ulonglong opt; // Not used by this version
ulonglong fldlen;
const char *dateformat;
const char *fieldformat;
@@ -243,11 +241,7 @@ public:
*/
ulong index_flags(uint inx, uint part, bool all_parts) const
{
- return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER
-#if defined(MRRBKA_SUPPORT)
- | HA_KEYREAD_ONLY
-#endif // MRRBKA_SUPPORT
- ;
+ return HA_READ_NEXT | HA_READ_RANGE | HA_READ_ORDER | HA_KEYREAD_ONLY;
} // end of index_flags
/** @brief
@@ -334,7 +328,7 @@ public:
condition stack.
*/
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);
/**
@@ -424,6 +418,9 @@ const char *GetValStr(OPVAL vop, bool neg);
*/
//int index_last(uchar *buf);
+ /* Index condition pushdown implementation */
+//Item *idx_cond_push(uint keyno, Item* idx_cond);
+
/** @brief
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
@@ -499,28 +496,4 @@ public:
char *index_file_name;
uint int_table_flags; // 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
diff --git a/storage/connect/myconn.h b/storage/connect/myconn.h
index 8a49239ec7a..856b6c73ef3 100644
--- a/storage/connect/myconn.h
+++ b/storage/connect/myconn.h
@@ -63,15 +63,10 @@ class DllItem MYSQLC {
bool Connected(void);
// Methods
-// int GetCurPos(void) {return (m_Res) ? N : 0;}
-// int GetProgCur(void) {return N;}
int GetResultSize(PGLOBAL g, PSZ sql);
int Open(PGLOBAL g, const char *host, const char *db,
const char *user= "root", const char *pwd= "*",
int pt= 0);
-//ulong GetThreadID(void);
-//ulong ServerVersion(void);
-//const char *ServerInfo(void);
int KillQuery(ulong id);
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
int ExecSQLcmd(PGLOBAL g, const char *query, int *w);
@@ -87,7 +82,6 @@ class DllItem MYSQLC {
void Rewind(void);
void FreeResult(void);
void Close(void);
-//void DiscardResults(void);
protected:
MYSQL_FIELD *GetNextField(void);
diff --git a/storage/connect/plgcnx.h b/storage/connect/plgcnx.h
index fe3997d1986..a1208f9b885 100644
--- a/storage/connect/plgcnx.h
+++ b/storage/connect/plgcnx.h
@@ -62,146 +62,6 @@ enum INFO {INDX_RC, /* Index of PlugDB return code field */
INDX_SIZE, /* Index of returned data size field */
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 */
/* ------------------------- End of Plgcnx.h ---------------------------- */
diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h
index e251ded13df..04ec4894e55 100644
--- a/storage/connect/plgdbsem.h
+++ b/storage/connect/plgdbsem.h
@@ -26,7 +26,6 @@
enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Srcdef/... Block */
TYPE_COLUMN = 51, /* Column Name/Qualifier Block */
-// TYPE_OPVAL = 52, /* Operator value (OPVAL) */
TYPE_TDB = 53, /* Table Description Block */
TYPE_COLBLK = 54, /* Column Description Block */
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_COLCRT = 71, /* Column creation block */
TYPE_CONST = 72, /* Constant */
-// TYPE_INDEXDEF = 73, /* Index definition block */
-// TYPE_OPER = 74, /* Operator block (OPER) */
/*-------------------- type tokenized string --------------------------*/
TYPE_DATE = 8, /* Timestamp */
@@ -144,21 +141,19 @@ enum RECFM {RECFM_NAF = -2, /* Not a file */
RECFM_PLG = 5, /* Table accessed via PLGconn */
RECFM_DBF = 6}; /* DBase formatted file */
-#if 0
enum MISC {DB_TABNO = 1, /* DB routines in Utility Table */
MAX_MULT_KEY = 10, /* Max multiple key number */
NAM_LEN = 128, /* Length of col and tab names */
ARRAY_SIZE = 50, /* Default array block size */
- MAXRES = 500, /* Default maximum result lines */
- MAXLIN = 10000, /* Default maximum data lines */
+// MAXRES = 500, /* Default maximum result lines */
+// MAXLIN = 10000, /* Default maximum data lines */
MAXBMP = 32}; /* Default XDB2 max bitmap size */
+#if 0
enum ALGMOD {AMOD_AUTO = 0, /* PLG chooses best algorithm */
AMOD_SQL = 1, /* Use SQL algorithm */
AMOD_QRY = 2}; /* Use QUERY algorithm */
-#else // !0
-#define NAM_LEN 128
-#endif // !0
+#endif // 0
enum MODE {MODE_ERROR = -1, /* Invalid mode */
MODE_ANY = 0, /* Unspecified mode */
@@ -342,9 +337,7 @@ typedef class XTAB *PTABLE;
typedef class COLUMN *PCOLUMN;
typedef class XOBJECT *PXOB;
typedef class COLBLK *PCOL;
-typedef class TBX *PTBX;
typedef class TDB *PTDB;
-typedef void *PSQL; // Not used
typedef class TDBASE *PTDBASE;
typedef class TDBDOS *PTDBDOS;
typedef class TDBFIX *PTDBFIX;
@@ -413,41 +406,25 @@ typedef struct _mblock { /* Memory block */
/* The QUERY application User Block. */
/***********************************************************************/
typedef struct { /* User application block */
-//void *Act2; /* RePoint to activity block */
-//short LineLen; /* Current output line len */
NAME Name; /* User application name */
-//NAME Password; /* User application password */
-//PSZ UserFile; /* User application filename */
char Server[17]; /* Server 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 */
PQRYRES Result; /* To query result blocks */
PFBLOCK Openlist; /* To file/map open list */
PMBLOCK Memlist; /* To memory block 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 Numlines; /* Number of lines involved */
-//ALGMOD AlgChoice; /* Choice of algorithm mode */
-//AREADEF DescArea; /* Table desc. area size */
USETEMP UseTemp; /* Use temporary file */
-//int Curtype; /* 0: static else: dynamic */
int Vtdbno; /* Used for TDB number setting */
bool Remote; /* true: if remotely called */
-//bool NotFinal; /* true: for intermediate table */
bool Proginfo; /* true: return progress info */
bool Subcor; /* Used for Progress info */
size_t ProgMax; /* Used for Progress info */
size_t ProgCur; /* Used for Progress info */
size_t ProgSav; /* Used for Progress info */
LPCSTR Step; /* Execution step name */
-//char Work[_MAX_PATH]; /* Local work path */
} DBUSERBLK, *PDBUSER;
/***********************************************************************/
@@ -578,9 +555,6 @@ DllExport void PlgDBfree(MBLOCK&);
DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
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 char *GetIni(int n= 0);
DllExport void SetTrc(void);
diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c
index e6d452aaf97..91b850022fb 100644
--- a/storage/connect/plugutil.c
+++ b/storage/connect/plugutil.c
@@ -153,9 +153,6 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
g->Trace = 0;
g->Createas = 0;
g->Alchecked = 0;
-#if defined(MRRBKA_SUPPORT)
- g->Mrr = 0;
-#endif // MRRBKA_SUPPORT
g->Activityp = g->ActivityStart = NULL;
g->Xchk = NULL;
strcpy(g->Message, "");
diff --git a/storage/connect/preparse.h b/storage/connect/preparse.h
index 8b57d487736..2892a958bdd 100644
--- a/storage/connect/preparse.h
+++ b/storage/connect/preparse.h
@@ -4,31 +4,6 @@
#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. */
/***********************************************************************/
typedef struct _datpar {
@@ -49,8 +24,6 @@ typedef struct _datpar {
extern "C" {
#endif
-int sqlflex(PPREP pp);
-int sqpflex(PPREP pp);
int fmdflex(PDTP pp);
#ifdef __cplusplus
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index 81c9bf9faca..a117ee329ce 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -204,6 +204,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
return xdefp;
} // end of GetXdef
+#if 0
/***********************************************************************/
/* DeleteTableFile: Delete an OEM table file if applicable. */
/***********************************************************************/
@@ -214,6 +215,7 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
return (Pxdef) ? Pxdef->DeleteTableFile(g) : true;
} // end of DeleteTableFile
+#endif // 0
/***********************************************************************/
/* 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);
else {
strcpy(g->Message, "Compress 2 not supported yet");
-// txfp = new(g) ZLBFAM(defp);
return NULL;
} // endelse
#else // !ZIP_SUPPORT
@@ -341,7 +342,6 @@ COLCRT::COLCRT(PSZ name)
Precision = -1;
Key = -1;
Scale = -1;
- Opt = -1;
DataType = '*';
} // end of COLCRT constructor for table creation
@@ -357,7 +357,6 @@ COLCRT::COLCRT(void)
Precision = 0;
Key = 0;
Scale = 0;
- Opt = 0;
DataType = '*';
} // 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;
Scale = cfp->Scale;
Long = cfp->Length;
- Opt = cfp->Opt;
Key = cfp->Key;
-// Freq = cfp->Freq;
if (cfp->Remark && *cfp->Remark) {
Desc = (PSZ)PlugSubAlloc(g, memp, strlen(cfp->Remark) + 1);
diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h
index a877c8ee915..e0c37690a86 100644
--- a/storage/connect/reldef.h
+++ b/storage/connect/reldef.h
@@ -38,7 +38,6 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
void SetCat(PCATLG cat) { Cat=cat; }
// Methods
- virtual bool DeleteTableFile(PGLOBAL g) {return true;}
virtual bool Indexable(void) {return false;}
virtual bool Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) = 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;}
// Methods
- virtual bool DeleteTableFile(PGLOBAL g);
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
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 GetDecode(void) {return Decode;}
PSZ GetFmt(void) {return Fmt;}
- int GetOpt(void) {return Opt;}
int GetLong(void) {return Long;}
int GetPrecision(void) {return Precision;}
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 Precision; /* Logical column length */
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) */
}; // end of COLCRT
diff --git a/storage/connect/tabcol.h b/storage/connect/tabcol.h
index fe643e075c3..fdee653207e 100644
--- a/storage/connect/tabcol.h
+++ b/storage/connect/tabcol.h
@@ -85,8 +85,6 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block.
virtual bool Compare(PXOB) {assert(false); return false;}
virtual bool SetFormat(PGLOBAL, FORMAT&);
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:
// Members
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 15215dc0f01..ef38fe2692f 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -1,11 +1,11 @@
/************* TabDos C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABDOS */
/* ------------- */
-/* Version 4.8 */
+/* Version 4.9 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -58,27 +58,12 @@
#include "tabfix.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. */
/***********************************************************************/
int num_read, num_there, num_eq[2]; // Statistics
-extern "C" char plgini[_MAX_PATH];
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 -------------------------- */
/***********************************************************************/
@@ -96,7 +81,6 @@ DOSDEF::DOSDEF(void)
Huge = false;
Accept = false;
Eof = false;
- To_Pos = NULL;
Compressed = 0;
Lrecl = 0;
AvgLen = 0;
@@ -110,6 +94,50 @@ DOSDEF::DOSDEF(void)
} // 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. */
/* If the table file is protected (declared as read/only) we still */
/* erase the the eventual optimize and index files but return true. */
@@ -147,6 +175,7 @@ bool DOSDEF::Erase(char *filename)
return rc; // Return true if error
} // end of Erase
+#endif // 0
/***********************************************************************/
/* DeleteIndexFile: Delete DOS/UNIX index file(s) using platform API. */
@@ -222,49 +251,6 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
} // 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. */
/***********************************************************************/
bool DOSDEF::InvalidateIndex(PGLOBAL g)
@@ -311,28 +297,31 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
txfp = new(g) BGXFAM(this);
else if (map)
txfp = new(g) MPXFAM(this);
+ else if (Compressed) {
#if defined(ZIP_SUPPORT)
- else if (Compressed)
txfp = new(g) ZIXFAM(this);
-#endif // ZIP_SUPPORT
- else
+#else // !ZIP_SUPPORT
+ sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
+ return NULL;
+#endif // !ZIP_SUPPORT
+ } else
txfp = new(g) FIXFAM(this);
tdbp = new(g) TDBFIX(this, txfp);
} else {
-#if defined(ZIP_SUPPORT)
if (Compressed) {
+#if defined(ZIP_SUPPORT)
if (Compressed == 1)
txfp = new(g) ZIPFAM(this);
else {
strcpy(g->Message, "Compress 2 not supported yet");
-// txfp = new(g) ZLBFAM(defp);
return NULL;
} // endelse
-
- } else
-#endif // ZIP_SUPPORT
- if (map)
+#else // !ZIP_SUPPORT
+ sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
+ return NULL;
+#endif // !ZIP_SUPPORT
+ } else if (map)
txfp = new(g) MAPFAM(this);
else
txfp = new(g) DOSFAM(this);
@@ -730,10 +719,17 @@ bool TDBDOS::OpenDB(PGLOBAL g)
/*******************************************************************/
/* 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))
- return true;
+ if (SkipHeader(g))
+ return TRUE;
+
+ } else
+ /*****************************************************************/
+ /* Table is to be accessed through a sorted index table. */
+ /*****************************************************************/
+ To_Kindex->Reset();
return false;
} // endif use
@@ -927,7 +923,6 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
Deplac = cdp->GetOffset();
Long = cdp->GetLong();
To_Val = NULL;
-
OldVal = NULL; // Currently used only in MinMax
Ldz = false;
Nod = false;
@@ -972,28 +967,6 @@ DOSCOL::DOSCOL(DOSCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
} // 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. */
/***********************************************************************/
bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
@@ -1151,6 +1124,13 @@ void DOSCOL::WriteColumn(PGLOBAL g)
htrc("Lrecl=%d deplac=%d int=%d\n", tdbp->Lrecl, Deplac, 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) {
len = (signed)strlen(tdbp->To_Line);
diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h
index 5f67ffad92f..a213dd142bf 100644
--- a/storage/connect/tabdos.h
+++ b/storage/connect/tabdos.h
@@ -1,7 +1,7 @@
/*************** 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. */
/***********************************************************************/
@@ -34,6 +34,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
virtual const char *GetType(void) {return "DOS";}
virtual PIXDEF GetIndx(void) {return To_Indx;}
virtual void SetIndx(PIXDEF xdp) {To_Indx = xdp;}
+ virtual bool IsHuge(void) {return Huge;}
PSZ GetFn(void) {return Fn;}
PSZ GetOfn(void) {return Ofn;}
void SetBlock(int block) {Block = block;}
@@ -46,11 +47,8 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
bool GetEof(void) {return Eof;}
int GetBlksize(void) {return Blksize;}
int GetEnding(void) {return Ending;}
- int *GetTo_Pos(void) {return To_Pos;}
- virtual bool IsHuge(void) {return Huge;}
// Methods
- virtual bool DeleteTableFile(PGLOBAL g);
virtual bool Indexable(void) {return Compressed != 1;}
virtual bool DeleteIndexFile(PGLOBAL g, PIXDEF pxdf);
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);
protected:
- virtual bool Erase(char *filename);
+//virtual bool Erase(char *filename);
// Members
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 Accept; /* true if wrong lines are accepted (DBF)*/
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 Lrecl; /* Size of biggest record */
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. */
/***********************************************************************/
class DllExport TDBDOS : public TDBASE {
-//friend class KINDEX;
friend class XINDEX;
friend class DOSCOL;
friend class MAPCOL;
friend class TXTFAM;
friend class DOSFAM;
friend class VCTCOL;
-//friend class TDBMUL;
friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool);
public:
// Constructors
@@ -111,7 +106,6 @@ class DllExport TDBDOS : public TDBASE {
inline void IncLine(int inc) {To_Line += inc;}
inline bool IsRead(void) {return Txfp->IsRead;}
inline PXOB *GetLink(void) {return To_Link;}
-//inline PCOL *GetKeyCol(void) {return To_Key_Col;}
// Implementation
virtual AMT GetAmType(void) {return Txfp->GetAmType();}
@@ -127,15 +121,8 @@ class DllExport TDBDOS : public TDBASE {
virtual PTDB CopyOne(PTABS t);
virtual void ResetDB(void) {Txfp->Reset();}
virtual bool IsUsingTemp(PGLOBAL g);
-//virtual bool NeedIndexing(PGLOBAL g);
virtual void ResetSize(void) {MaxSize = Cardinal = -1;}
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);
// Database routines
@@ -162,25 +149,16 @@ class DllExport TDBDOS : public TDBASE {
virtual int EstimatedLength(PGLOBAL g);
// Optimization routines
-// void ResetBlockFilter(PGLOBAL g);
- int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
-// bool GetDistinctColumnValues(PGLOBAL g, int nrec);
+ int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
protected:
-// PBF CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv);
-
// Members
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
int Cardinal; // Table Cardinality
RECFM Ftype; // File type: 0-var 1-fixed 2-binary (VCT)
int Lrecl; // Logical Record Length
int AvgLen; // Logical Record Average Length
-//int Xeval; // BlockTest return value
-//int Beval; // BlockEval return value
}; // end of class TDBDOS
/***********************************************************************/
@@ -198,50 +176,27 @@ class DllExport DOSCOL : public COLBLK {
// Implementation
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 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
- virtual bool VarSize(void);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
virtual void Print(PGLOBAL g, FILE *, uint);
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
DOSCOL(void) {}
// 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 OldVal; // The previous value of the object.
char *Buf; // Buffer used in write operations
bool Ldz; // True if field contains leading zeros
bool Nod; // True if no decimal point
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 Ndv; // Number of distinct values
-//int Nbm; // Number of uint in bitmap
}; // end of class DOSCOL
#endif // __TABDOS_H
diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp
index 99063e86b57..cda08b7e3a6 100644
--- a/storage/connect/tabfix.cpp
+++ b/storage/connect/tabfix.cpp
@@ -1,11 +1,11 @@
/************* TabFix C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABFIX */
/* ------------- */
-/* Version 4.8 */
+/* Version 4.9 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 9a121b9ab9a..7ee0b77ee1e 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -460,7 +460,6 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
txfp = new(g) ZIPFAM(this);
else {
strcpy(g->Message, "Compress 2 not supported yet");
-// txfp = new(g) ZLBFAM(defp);
return NULL;
} // endelse
#else // !ZIP_SUPPORT
@@ -1273,25 +1272,6 @@ CSVCOL::CSVCOL(CSVCOL *col1, PTDB tdbp) : DOSCOL(col1, tdbp)
} // 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 */
/* and length of the field to read as calculated by TDBCSV::ReadDB. */
/***********************************************************************/
diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h
index d4a7f4105d6..5efa824c2e2 100644
--- a/storage/connect/tabfmt.h
+++ b/storage/connect/tabfmt.h
@@ -8,7 +8,6 @@
#include "xtable.h" // Base class declares
#include "tabdos.h"
-//pedef struct _tabdesc *PTABD; // For friend setting
typedef class TDBFMT *PTDBFMT;
/***********************************************************************/
@@ -90,8 +89,8 @@ class TDBCSV : public TDBDOS {
int Nerr; // Number of bad records
int Maxerr; // Maximum number of bad records
int Quoted; // Quoting level for quoted fields
- bool Accept; // true if bad lines are accepted
- bool Header; // true if first line contains column headers
+ bool Accept; // true if bad lines are accepted
+ bool Header; // true if first line contains column headers
char Sep; // Separator
char Qot; // Quoting character
}; // end of class TDBCSV
@@ -112,10 +111,8 @@ class CSVCOL : public DOSCOL {
virtual int GetAmType() {return TYPE_AM_CSV;}
// Methods
- virtual bool VarSize(void);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
-// void Print(FILE *, uint);
protected:
// Default constructor not to be used
diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp
index 37035ed752d..9749673ad71 100644
--- a/storage/connect/table.cpp
+++ b/storage/connect/table.cpp
@@ -36,27 +36,6 @@ extern "C" int trace; // The general trace value
void NewPointer(PTABS, void *, 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 ---------------------------- */
/***********************************************************************/
@@ -64,6 +43,9 @@ TBX::TBX(PTBX txp)
/***********************************************************************/
TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
{
+ Use = USE_NO;
+ To_Orig = NULL;
+ To_CondFil = NULL;
Next = NULL;
Name = (tdp) ? tdp->GetName() : NULL;
To_Table = NULL;
@@ -72,8 +54,11 @@ TDB::TDB(PTABDEF tdp) : Tdb_No(++Tnum)
Mode = MODE_READ;
} // 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;
Name = tdbp->Name;
To_Table = tdbp->To_Table;
@@ -82,92 +67,6 @@ TDB::TDB(PTDB tdbp) : TBX(tdbp), Tdb_No(++Tnum)
Mode = tdbp->Mode;
} // 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
/***********************************************************************/
@@ -179,7 +78,7 @@ int TDB::RowNumber(PGLOBAL g, bool b)
return 0;
} // end of RowNumber
-PTBX TDB::Copy(PTABS t)
+PTDB TDB::Copy(PTABS t)
{
PTDB tp, tdb1, tdb2 = NULL, outp = NULL;
//PGLOBAL g = t->G; // Is this really useful ???
diff --git a/storage/connect/tabmac.h b/storage/connect/tabmac.h
index cfdf842cdc8..eb115b18049 100644
--- a/storage/connect/tabmac.h
+++ b/storage/connect/tabmac.h
@@ -31,7 +31,7 @@ class DllExport MACDEF : public TABDEF { /* Logical table description */
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
- virtual bool DeleteTableFile(PGLOBAL g) {return true;}
+//virtual bool DeleteTableFile(PGLOBAL g) {return true;}
protected:
// Members
diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h
index 052b4e7d33e..379e8f88e93 100644
--- a/storage/connect/tabmul.h
+++ b/storage/connect/tabmul.h
@@ -38,7 +38,7 @@ class DllExport TDBMUL : public TDBASE {
// Methods
virtual void ResetDB(void);
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 int GetRecpos(void) {return 0;}
virtual PCOL ColDB(PGLOBAL g, PSZ name, int num);
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 9b4f0dbe3ce..6acbc09bbf3 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -527,8 +527,8 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g)
strcat(strcat(strcat(strcat(Query, " FROM "), tk), Tabname), tk);
- if (To_Filter)
- strcat(strcat(Query, " WHERE "), To_Filter->Body);
+ if (To_CondFil)
+ strcat(strcat(Query, " WHERE "), To_CondFil->Body);
if (trace)
htrc("Query=%s\n", Query);
@@ -1135,7 +1135,6 @@ MYSQLCOL::MYSQLCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PSZ am)
: COLBLK(NULL, tdbp, i)
{
Name = fld->name;
- Opt = 0;
Precision = Long = fld->length;
Buf_Type = MYSQLtoPLG(fld->type);
strcpy(Format.Type, GetFormatType(Buf_Type));
@@ -1395,11 +1394,11 @@ PCMD TDBMYEXC::MakeCMD(PGLOBAL g)
{
PCMD xcmd = NULL;
- if (To_Filter) {
+ if (To_CondFil) {
if (Cmdcol) {
- if (!stricmp(Cmdcol, To_Filter->Body) &&
- (To_Filter->Op == OP_EQ || To_Filter->Op == OP_IN)) {
- xcmd = To_Filter->Cmds;
+ if (!stricmp(Cmdcol, To_CondFil->Body) &&
+ (To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
+ xcmd = To_CondFil->Cmds;
} else
strcpy(g->Message, "Invalid command specification filter");
diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h
index 74b1d49e227..2ecfe800f88 100644
--- a/storage/connect/tabmysql.h
+++ b/storage/connect/tabmysql.h
@@ -185,14 +185,7 @@ class TDBMYEXC : public TDBMYSQL {
// Methods
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 PSZ GetServer(void) {return Server;}
-// void SetDatabase(LPCSTR db) {Database = (char*)db;}
// Database routines
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 int ReadDB(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:
// Internal functions
PCMD MakeCMD(PGLOBAL g);
-//bool MakeSelect(PGLOBAL g);
-//bool MakeInsert(PGLOBAL g);
-//int BindColumns(PGLOBAL g);
// Members
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(MYXCOL *colp, PTDB tdbp); // Constructor used in copy process
- // Implementation
-//virtual int GetAmType(void) {return TYPE_AM_MYSQL;}
-// void InitBind(PGLOBAL g);
-
// Methods
-//virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
-// bool FindRank(PGLOBAL g);
protected:
// Default constructor not to be used
diff --git a/storage/connect/taboccur.h b/storage/connect/taboccur.h
index 0bee074234c..4538d3d71f2 100644
--- a/storage/connect/taboccur.h
+++ b/storage/connect/taboccur.h
@@ -68,7 +68,6 @@ class TDBOCCUR : public TDBPRX {
protected:
// Members
-//PTDBASE Tdbp; // To the source table or view
LPCSTR Tabname; // Name of source table
char *Colist; // Source column list
char *Xcolumn; // Occurence column name
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 1fb71e33646..c7513601979 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -408,7 +408,7 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
// Below 14 is length of 'select ' + length of ' from ' + 1
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)
catp = Catalog;
@@ -441,8 +441,8 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
strcat(sql, tabname);
- if (To_Filter)
- strcat(strcat(sql, " WHERE "), To_Filter->Body);
+ if (To_CondFil)
+ strcat(strcat(sql, " WHERE "), To_CondFil->Body);
return sql;
} // end of MakeSQL
@@ -1229,11 +1229,11 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g)
{
PCMD xcmd = NULL;
- if (To_Filter) {
+ if (To_CondFil) {
if (Cmdcol) {
- if (!stricmp(Cmdcol, To_Filter->Body) &&
- (To_Filter->Op == OP_EQ || To_Filter->Op == OP_IN)) {
- xcmd = To_Filter->Cmds;
+ if (!stricmp(Cmdcol, To_CondFil->Body) &&
+ (To_CondFil->Op == OP_EQ || To_CondFil->Op == OP_IN)) {
+ xcmd = To_CondFil->Cmds;
} else
strcpy(g->Message, "Invalid command specification filter");
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index 35864bab5ef..34c2bb8cfc7 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -158,7 +158,6 @@ class ODBCCOL : public COLBLK {
// PVBLK GetBlkp(void) {return Blkp;}
// Methods
-//virtual bool CheckLocal(PTDB tdbp);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp
index 2bb5532cea0..409352fdee6 100644
--- a/storage/connect/tabsys.cpp
+++ b/storage/connect/tabsys.cpp
@@ -113,6 +113,7 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
return tdbp;
} // end of GetTable
+#if 0
/***********************************************************************/
/* DeleteTableFile: Delete INI table files using platform API. */
/***********************************************************************/
@@ -134,6 +135,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
return rc; // Return true if error
} // end of DeleteTableFile
+#endif // 0
/* ------------------------------------------------------------------- */
diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h
index 2780eb3ca98..38b71d62ac4 100644
--- a/storage/connect/tabsys.h
+++ b/storage/connect/tabsys.h
@@ -32,7 +32,6 @@ class DllExport INIDEF : public TABDEF { /* INI table description */
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
- virtual bool DeleteTableFile(PGLOBAL g);
protected:
// Members
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 56305871c69..c78c62af9cc 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -1,11 +1,11 @@
/************* TabTbl C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABTBL */
/* ------------- */
-/* Version 1.6 */
+/* Version 1.7 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2008-2013 */
+/* (C) Copyright to PlugDB Software Development 2008-2014 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
@@ -66,7 +66,6 @@
#include "global.h" // global declarations
#include "plgdbsem.h" // DB application declarations
#include "reldef.h" // DB definition declares
-//#include "filter.h" // FILTER classes dcls
#include "filamtxt.h"
#include "tabcol.h"
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
@@ -245,7 +244,7 @@ bool TDBTBL::InitTableList(PGLOBAL g)
// PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath());
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);
if (tabp->GetSrc()) {
@@ -286,14 +285,14 @@ bool TDBTBL::InitTableList(PGLOBAL g)
hc->get_table()->s->connect_string.length = sln;
//NumTables = n;
- To_Filter = NULL; // To avoid doing it several times
+ To_CondFil = NULL; // To avoid doing it several times
return FALSE;
} // end of InitTableList
/***********************************************************************/
/* 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];
bool neg;
@@ -421,12 +420,12 @@ bool TDBTBL::OpenDB(PGLOBAL g)
} // 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;
Nbc = 0;
- } // endif To_Filter
+ } // endif To_CondFil
/*********************************************************************/
/* Open the first table of the list. */
@@ -661,12 +660,12 @@ bool TDBTBM::OpenDB(PGLOBAL g)
#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;
Nbc = 0;
- } // endif To_Filter
+ } // endif To_CondFil
#endif // 0
/*********************************************************************/
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index 48371e40ade..fc35179f2ea 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -87,7 +87,7 @@ class DllExport TDBTBL : public TDBPRX {
protected:
// Internal functions
bool InitTableList(PGLOBAL g);
- bool TestFil(PGLOBAL g, PFIL filp, PTABLE tabp);
+ bool TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp);
// Members
PTABLE Tablist; // Points to the table list
@@ -133,26 +133,17 @@ class DllExport TDBTBM : public TDBTBL {
// Constructor
TDBTBM(PTBLDEF tdp = NULL);
- // Implementation
-//virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
-
// Methods
virtual void ResetDB(void);
-//virtual int GetRecpos(void) {return Rows;}
-//virtual int GetBadLines(void) {return (int)Nbc;}
// Database routines
-//virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
-//virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
protected:
// Internal functions
-//bool InitTableList(PGLOBAL g);
-//bool TestFil(PGLOBAL g, PFIL filp, PTABLE tabp);
bool OpenTables(PGLOBAL g);
int ReadNextRemote(PGLOBAL g);
@@ -165,5 +156,4 @@ class DllExport TDBTBM : public TDBTBL {
int Nlc; // Number of local connections
}; // end of class TDBTBM
-
pthread_handler_t ThreadOpen(void *p);
diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h
index 7b2161a4b8b..c87065befba 100644
--- a/storage/connect/tabutil.h
+++ b/storage/connect/tabutil.h
@@ -54,7 +54,6 @@ class DllExport PRXDEF : public TABDEF { /* Logical table description */
/* This is the class declaration for the XCSV table. */
/***********************************************************************/
class DllExport TDBPRX : public TDBASE {
-//friend class MULINDX;
friend class PRXDEF;
friend class PRXCOL;
public:
@@ -126,8 +125,6 @@ class TDBTBC : public TDBCAT {
public:
// Constructors
TDBTBC(PPRXDEF tdp);
-//TDBTBC(PTBLDEF tdp);
-//TDBTBC(PXCLDEF tdp);
protected:
// Specific routines
diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp
index 8b7d8ba91eb..d58a5b2fa27 100644
--- a/storage/connect/tabvct.cpp
+++ b/storage/connect/tabvct.cpp
@@ -1,11 +1,11 @@
/************* TabVct C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABVCT */
/* ------------- */
-/* Version 3.7 */
+/* Version 3.8 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1999-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -118,6 +118,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return false;
} // end of DefineAM
+#if 0
/***********************************************************************/
/* Erase: This was made a separate routine because a strange thing */
/* happened when DeleteTablefile was defined for the VCTDEF class: */
@@ -157,6 +158,7 @@ bool VCTDEF::Erase(char *filename)
return rc; // Return true if error
} // end of Erase
+#endif // 0
/***********************************************************************/
/* 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 (tdbp->GetBlockValues(g))
- return NULL;
+ PushWarning(g, (PTDBASE)tdbp);
+// return NULL; // causes a crash when deleting index
return tdbp;
} // end of GetTable
diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h
index 4049b4f7683..7dc416a5779 100644
--- a/storage/connect/tabvct.h
+++ b/storage/connect/tabvct.h
@@ -36,8 +36,6 @@ class DllExport VCTDEF : public DOSDEF { /* Logical table description */
virtual PTDB GetTable(PGLOBAL g, MODE mode);
protected:
- // Specific file erase routine for vertical tables
- virtual bool Erase(char *filename);
int MakeFnPattern(char *fpat);
// Members
diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp
index 8f91d9b3ed8..5052268b9e2 100644
--- a/storage/connect/tabwmi.cpp
+++ b/storage/connect/tabwmi.cpp
@@ -14,7 +14,7 @@
#include "reldef.h"
#include "xtable.h"
#include "colblk.h"
-#include "filter.h"
+//#include "filter.h"
//#include "xindex.h"
#include "tabwmi.h"
#include "valblk.h"
@@ -480,8 +480,8 @@ bool TDBWMI::Initialize(PGLOBAL g)
/***********************************************************************/
void TDBWMI::DoubleSlash(PGLOBAL g)
{
- if (To_Filter && strchr(To_Filter->Body, '\\')) {
- char *body = To_Filter->Body;
+ if (To_CondFil && strchr(To_CondFil->Body, '\\')) {
+ char *body = To_CondFil->Body;
char *buf = (char*)PlugSubAlloc(g, NULL, strlen(body) * 2);
int i = 0, k = 0;
@@ -492,8 +492,8 @@ void TDBWMI::DoubleSlash(PGLOBAL g)
buf[k++] = body[i];
} while (body[i++]);
- To_Filter->Body = buf;
- } // endif To_Filter
+ To_CondFil->Body = buf;
+ } // endif To_CondFil
} // end of DoubleSlash
@@ -540,13 +540,13 @@ char *TDBWMI::MakeWQL(PGLOBAL g)
// Below 14 is length of 'select ' + length of ' from ' + 1
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);
strcat(strcat(strcpy(wql, "SELECT "), colist), " FROM ");
strcat(wql, Wclass);
- if (To_Filter)
- strcat(strcat(wql, " WHERE "), To_Filter->Body);
+ if (To_CondFil)
+ strcat(strcat(wql, " WHERE "), To_CondFil->Body);
return wql;
} // end of MakeWQL
@@ -659,8 +659,8 @@ bool TDBWMI::OpenDB(PGLOBAL g)
return true;
} // endif Mode
- if (!To_Filter && !stricmp(Wclass, "CIM_Datafile")
- && !stricmp(Nspace, "root\\cimv2")) {
+ if (!To_CondFil && !stricmp(Wclass, "CIM_Datafile")
+ && !stricmp(Nspace, "root\\cimv2")) {
strcpy(g->Message,
"Would last forever when not filtered, use DIR table instead");
return true;
diff --git a/storage/connect/tabwmi.h b/storage/connect/tabwmi.h
index 9df57e7c579..8ff5262941e 100644
--- a/storage/connect/tabwmi.h
+++ b/storage/connect/tabwmi.h
@@ -48,7 +48,6 @@ class WMIDEF : public TABDEF { /* Logical table description */
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
- virtual bool DeleteTableFile(PGLOBAL g) {return true;}
protected:
// Members
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 7e4ee3453ae..7a2c0169c2b 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -187,6 +187,7 @@ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
return tdbp;
} // end of GetTable
+#if 0
/***********************************************************************/
/* DeleteTableFile: Delete XML table files using platform API. */
/***********************************************************************/
@@ -208,6 +209,7 @@ bool XMLDEF::DeleteTableFile(PGLOBAL g)
return rc; // Return true if error
} // end of DeleteTableFile
+#endif // 0
/* ------------------------- TDBXML Class ---------------------------- */
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index 817bea45b3b..1284cf6197f 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -10,9 +10,6 @@ typedef class XMLDEF *PXMLDEF;
typedef class TDBXML *PTDBXML;
typedef class XMLCOL *PXMLCOL;
-// These functions are exported from the Extended.dll
-//PTABDEF __stdcall GetXML(PGLOBAL g, void *memp);
-
/* --------------------------- XML classes --------------------------- */
/***********************************************************************/
@@ -30,7 +27,6 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
- virtual bool DeleteTableFile(PGLOBAL g);
protected:
// Members
@@ -53,7 +49,6 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
}; // end of XMLDEF
#if defined(INCLUDE_TDBXML)
-
/***********************************************************************/
/* 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 WriteColumn(PGLOBAL g);
}; // end of class XPOSCOL
-
#endif // INCLUDE_TDBXML
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 3a48c491cb8..b778d3f0883 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -147,9 +147,6 @@ bool user_connect::CheckCleanup(void)
g->Xchk = NULL;
g->Createas = 0;
g->Alchecked = 0;
-#if defined(MRRBKA_SUPPORT)
- g->Mrr = 0;
-#endif // MRRBKA_SUPPORT
last_query_id= thdp->query_id;
if (xtrace)
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index ef17a958824..44e4e94fa8a 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -63,11 +63,10 @@ public:
PCONNECT next; // Next user in chain
PCONNECT previous; // Previous user in chain
PGLOBAL g; // The common handle to CONNECT
-//char dbname[32]; // The DBCONNECT database
query_id_t last_query_id; // the latest user query id
int count; // if used by several handlers
// Statistics
ulong nrd, fnd, nfd;
- ulonglong tb1;
+ ulonglong tb1;
}; // end of user_connect class definition
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index c0127072896..dd2c991d2a8 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -40,7 +40,8 @@
#include "plgdbsem.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. */
diff --git a/storage/connect/valblk.h b/storage/connect/valblk.h
index 1edfe7f76b4..6da36d3b517 100644
--- a/storage/connect/valblk.h
+++ b/storage/connect/valblk.h
@@ -26,7 +26,6 @@ const char *GetFmt(int type, bool un = false);
/* Class VALBLK represent a base class for variable blocks. */
/***********************************************************************/
class VALBLK : public BLOCK {
-//friend void SemColData(PGLOBAL g, PSEM semp);
public:
// Constructors
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(PVAL valp, int n) = 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 int CompVal(PVAL vp, int n) = 0;
virtual int CompVal(int i1, int i2) = 0;
@@ -119,12 +112,10 @@ class TYPBLK : public VALBLK {
public:
// Constructors
TYPBLK(void *mp, int size, int type, int prec = 0, bool un = false);
-//TYPBLK(void *mp, int size, int prec, int type);
// Implementation
virtual void Init(PGLOBAL g, bool check);
virtual int GetVlen(void) {return sizeof(TYPE);}
-//virtual PSZ GetCharValue(int n);
virtual char GetTinyValue(int n) {return (char)Typp[n];}
virtual uchar GetUTinyValue(int n) {return (uchar)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);}
virtual void SetValue(PVAL valp, int n);
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 int CompVal(PVAL vp, int n);
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(PVAL valp, int n);
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 int CompVal(PVAL vp, int n);
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(PVAL valp, int n);
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 int CompVal(PVAL vp, int n);
virtual int CompVal(int i1, int i2);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index c818070b970..2f284a06319 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -83,6 +83,7 @@ int DTVAL::Shift = 0;
/* Routines called externally. */
/***********************************************************************/
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
+
#if !defined(WIN32)
extern "C" {
PSZ strupr(PSZ s);
@@ -277,55 +278,6 @@ const char *GetFmt(int type, bool un)
return fmt;
} // 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. */
/***********************************************************************/
@@ -422,76 +374,6 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec,
return valp;
} // 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 ---------------------------- */
/***********************************************************************/
diff --git a/storage/connect/value.h b/storage/connect/value.h
index f8e89ba55fd..a5eb2c886cf 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -46,8 +46,6 @@ DllExport char *GetFormatType(int);
DllExport int GetFormatType(char);
DllExport bool IsTypeChar(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,
bool uns = false, PSZ fmt = NULL);
DllExport ulonglong CharToNumber(char *, int, ulonglong, bool,
@@ -271,17 +269,9 @@ class DllExport DECVAL: public TYPVAL<PSZ> {
virtual int GetValPrec() {return Prec;}
// 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 char *ShowValue(char *buf, int);
-//virtual char *GetCharString(char *p);
virtual bool IsEqual(PVAL vp, bool chktype);
-//virtual bool FormatValue(PVAL vp, char *fmt);
-//virtual bool SetConstFormat(PGLOBAL, FORMAT&);
// Members
}; // 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, PVAL valp);
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);
static void SetTimeShift(void);
static int GetShift(void) {return Shift;}
// Methods
bool MakeDate(PGLOBAL g, int *val, int nval);
-// bool WeekNum(PGLOBAL g, int& nval);
struct tm *GetGmTime(struct tm *);
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 601374ef5d7..53656d8d84b 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -1792,7 +1792,8 @@ int XINDEX::FastFind(int nv)
XINDXS::XINDXS(PTDBDOS tdbp, PIXDEF xdp, PXLOAD pxp, PCOL *cp, PXOB *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
/***********************************************************************/
@@ -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
if (Asc)
- IsSorted = colp->GetOpt() < 0;
+// IsSorted = colp->GetOpt() < 0;
+ IsSorted = false;
//SetNulls(colp->IsNullable()); for when null columns will be indexable
return false;
diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h
index b7e597b9e6d..ac886673b68 100644
--- a/storage/connect/xindex.h
+++ b/storage/connect/xindex.h
@@ -98,12 +98,6 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */
void SetNParts(uint np) {Nparts = (signed)np;}
void SetMaxSame(int mxs) {MaxSame = mxs;}
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;}
bool Define(PGLOBAL g, void *memp, PTABDEF dfp, LPCSTR p);
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 */
int Nparts; /* Number of key parts */
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 */
}; // end of INDEXDEF
@@ -253,9 +244,6 @@ class DllExport XINDEX : public XXBASE {
virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;}
virtual void SetNval(int n) {Nval = n;}
int GetMaxSame(void) {return MaxSame;}
-// int GetDefoff(void) {return Defoff;}
-// int GetDefhigh(void) {return Defhigh;}
-// int GetSize(void) {return Size;}
// Methods
virtual void Reset(void);
@@ -288,9 +276,6 @@ class DllExport XINDEX : public XXBASE {
int Nk; // The number of indexed columns
int Nval; // The number of used columns
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
}; // end of class XINDEX
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index aa87517bd2e..05b408da2d2 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -109,19 +109,6 @@ int CONSTANT::GetLengthEx(void)
return Value->GetValLen();
} // 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. */
/***********************************************************************/
diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h
index b7869be96b2..15ba6d99f33 100644
--- a/storage/connect/xobject.h
+++ b/storage/connect/xobject.h
@@ -60,17 +60,6 @@ class DllExport XOBJECT : public BLOCK {
virtual bool Init(PGLOBAL) {return false;}
virtual bool Eval(PGLOBAL) {return false;}
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:
PVAL Value; // The current value of the object.
@@ -97,7 +86,6 @@ class DllExport XVOID : public XOBJECT {
// Methods
virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;}
virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;}
- virtual int CheckSpcCol(PTDB, int) {return 0;}
}; // end of class XVOID
@@ -122,12 +110,7 @@ class DllExport CONSTANT : public XOBJECT {
virtual bool Compare(PXOB xp);
virtual bool SetFormat(PGLOBAL g, FORMAT& 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;}
- 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, char *, uint);
}; // end of class CONSTANT
diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h
index 8884860cb5b..74c0b986d82 100644
--- a/storage/connect/xtable.h
+++ b/storage/connect/xtable.h
@@ -33,58 +33,20 @@ class CMD : public BLOCK {
char *Cmd;
}; // end of class CMD
-// Filter passed all tables
-typedef struct _filter {
+// Condition filter structure
+typedef struct _cond_filter {
char *Body;
OPVAL Op;
PCMD Cmds;
-} FILTER, *PFIL;
+} CONDFIL, *PCFIL;
typedef class TDBCAT *PTDBCAT;
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. */
/***********************************************************************/
-class DllExport TDB: public TBX { // Table Descriptor Block.
+class DllExport TDB: public BLOCK { // Table Descriptor Block.
public:
// Constructors
TDB(PTABDEF tdp = NULL);
@@ -92,11 +54,17 @@ class DllExport TDB: public TBX { // Table Descriptor Block.
// Implementation
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 PTABLE GetTable(void) {return To_Table;}
inline PCOL GetColumns(void) {return Columns;}
inline int GetDegree(void) {return Degree;}
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 SetName(LPCSTR name) {Name = name;}
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;}
//Properties
+ virtual AMT GetAmType(void) {return TYPE_AM_ERROR;}
virtual int GetTdb_No(void) {return Tdb_No;}
virtual PTDB GetNext(void) {return Next;}
virtual PCATLG GetCat(void) {return NULL;}
// 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 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 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 CopyOne(PTABS t) {return this;}
- virtual PTBX Copy(PTABS t);
+ virtual PTDB Copy(PTABS t);
virtual void PrintAM(FILE *f, char *m)
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
virtual PSZ GetServer(void) = 0;
+ virtual int GetBadLines(void) {return 0;}
// Database pure virtual routines
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 int CheckWrite(PGLOBAL g) {return 0;}
- // Database routines
- bool OpenTable(PGLOBAL g, PSQL sqlp, MODE mode);
- void CloseTable(PGLOBAL g);
-
protected:
// 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
const int Tdb_No; // GetTdb_No() is always 0 for OPJOIN
PTDB Next; // Next in linearized queries