Commit 24a79483 authored by Olivier Bertrand's avatar Olivier Bertrand

- Code cleaning. Eliminating unused code, functions, and variables.

modified:
  storage/connect/catalog.h
  storage/connect/colblk.cpp
  storage/connect/colblk.h
  storage/connect/mycat.cc
  storage/connect/reldef.cpp
  storage/connect/tabcol.h
  storage/connect/tabsys.cpp
  storage/connect/tabsys.h
  storage/connect/xobject.h
parent dee955bd
...@@ -62,14 +62,9 @@ class DllExport CATALOG { ...@@ -62,14 +62,9 @@ class DllExport CATALOG {
virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy
// Implementation // Implementation
void *GetDescp(void) {return Descp;}
//PRELDEF GetTo_Desc(void) {return To_Desc;}
//PSZ GetDescFile(void) {return DescFile;}
int GetCblen(void) {return Cblen;} int GetCblen(void) {return Cblen;}
bool GetDefHuge(void) {return DefHuge;} bool GetDefHuge(void) {return DefHuge;}
void SetDefHuge(bool b) {DefHuge = b;} void SetDefHuge(bool b) {DefHuge = b;}
//bool GetSepIndex(void) {return SepIndex;}
//void SetSepIndex(bool b) {SepIndex = b;}
char *GetCbuf(void) {return Cbuf;} char *GetCbuf(void) {return Cbuf;}
char *GetDataPath(void) {return (char*)DataPath;} char *GetDataPath(void) {return (char*)DataPath;}
...@@ -115,15 +110,10 @@ class DllExport CATALOG { ...@@ -115,15 +110,10 @@ class DllExport CATALOG {
virtual PRELDEF MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;} virtual PRELDEF MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;}
// Members // Members
//PRELDEF To_Desc; /* To chain of relation desc. */
void *Descp; /* To DB description area */
//AREADEF DescArea; /* Table desc. area size */
char *Cbuf; /* Buffer used for col section */ char *Cbuf; /* Buffer used for col section */
int Cblen; /* Length of suballoc. buffer */ int Cblen; /* Length of suballoc. buffer */
CURTAB Ctb; /* Used to enumerate tables */ CURTAB Ctb; /* Used to enumerate tables */
bool DefHuge; /* true: tables default to huge */ bool DefHuge; /* true: tables default to huge */
//bool SepIndex; /* true: separate index files */
//char DescFile[_MAX_PATH]; /* DB description filename */
LPCSTR DataPath; /* Is the Path of DB data dir */ LPCSTR DataPath; /* Is the Path of DB data dir */
}; // end of class CATALOG }; // end of class CATALOG
......
...@@ -159,19 +159,6 @@ bool COLBLK::CheckSort(PTDB tdbp) ...@@ -159,19 +159,6 @@ bool COLBLK::CheckSort(PTDB tdbp)
return (tdbp == To_Tdb); return (tdbp == To_Tdb);
} // end of CheckSort } // end of CheckSort
/***********************************************************************/
/* MarkCol: see PlugMarkCol for column references to mark. */
/***********************************************************************/
void COLBLK::MarkCol(ushort bits)
{
ColUse |= bits;
#ifdef DEBTRACE
htrc(" column R%d.%s marked as %04X\n",
To_Tdb->GetTdb_No(), Name, ColUse);
#endif
} // end of MarkCol
/***********************************************************************/ /***********************************************************************/
/* InitValue: prepare a column block for read operation. */ /* InitValue: prepare a column block for read operation. */
/* Now we use Format.Length for the len parameter to avoid strings */ /* Now we use Format.Length for the len parameter to avoid strings */
......
...@@ -64,7 +64,6 @@ class DllExport COLBLK : public XOBJECT { ...@@ -64,7 +64,6 @@ class DllExport COLBLK : public XOBJECT {
virtual bool IsSpecial(void) {return false;} virtual bool IsSpecial(void) {return false;}
virtual int CheckSpcCol(PTDB tdbp, int n) {return 2;} virtual int CheckSpcCol(PTDB tdbp, int n) {return 2;}
virtual bool CheckSort(PTDB tdbp); virtual bool CheckSort(PTDB tdbp);
virtual void MarkCol(ushort bits);
virtual bool Eval(PGLOBAL g); virtual bool Eval(PGLOBAL g);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void SetTo_Val(PVAL valp) {} virtual void SetTo_Val(PVAL valp) {}
......
...@@ -256,15 +256,11 @@ uint GetFuncID(const char *func) ...@@ -256,15 +256,11 @@ uint GetFuncID(const char *func)
/***********************************************************************/ /***********************************************************************/
CATALOG::CATALOG(void) CATALOG::CATALOG(void)
{ {
//To_Desc= NULL;
//*DescFile= '\0';
#if defined(WIN32) #if defined(WIN32)
DataPath= ".\\"; DataPath= ".\\";
#else // !WIN32 #else // !WIN32
DataPath= "./"; DataPath= "./";
#endif // !WIN32 #endif // !WIN32
Descp= NULL;
//memset(&DescArea, 0, sizeof(AREADEF));
memset(&Ctb, 0, sizeof(CURTAB)); memset(&Ctb, 0, sizeof(CURTAB));
Cbuf= NULL; Cbuf= NULL;
Cblen= 0; Cblen= 0;
...@@ -279,17 +275,14 @@ CATALOG::CATALOG(void) ...@@ -279,17 +275,14 @@ CATALOG::CATALOG(void)
MYCAT::MYCAT(PHC hc) : CATALOG() MYCAT::MYCAT(PHC hc) : CATALOG()
{ {
Hc= hc; Hc= hc;
//To_Desc= NULL;
DefHuge= false; DefHuge= false;
//SepIndex= true; // Temporay until we can store offet and size
} // end of MYCAT constructor } // end of MYCAT constructor
/***********************************************************************/ /***********************************************************************/
/* When using volatile storage, reset values pointing to Sarea. */ /* Nothing to do for CONNECT. */
/***********************************************************************/ /***********************************************************************/
void MYCAT::Reset(void) void MYCAT::Reset(void)
{ {
//To_Desc= NULL;
} // end of Reset } // end of Reset
/***********************************************************************/ /***********************************************************************/
...@@ -597,10 +590,6 @@ PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name, ...@@ -597,10 +590,6 @@ PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name,
if (xtrace) if (xtrace)
printf("GetTableDesc: name=%s am=%s\n", name, SVP(type)); printf("GetTableDesc: name=%s am=%s\n", name, SVP(type));
// Firstly check whether this table descriptor is in memory
//if (To_Desc)
// return To_Desc;
// If not specified get the type of this table // If not specified get the type of this table
if (!type && !(type= Hc->GetStringOption("Type"))) if (!type && !(type= Hc->GetStringOption("Type")))
type= (Hc->GetStringOption("Tabname")) ? "PROXY" : "DOS"; type= (Hc->GetStringOption("Tabname")) ? "PROXY" : "DOS";
...@@ -708,7 +697,6 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type) ...@@ -708,7 +697,6 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
/***********************************************************************/ /***********************************************************************/
void MYCAT::ClearDB(PGLOBAL g) void MYCAT::ClearDB(PGLOBAL g)
{ {
//To_Desc= NULL;
} // end of ClearDB } // end of ClearDB
/* ------------------------ End of MYCAT --------------------------- */ /* ------------------------ End of MYCAT --------------------------- */
...@@ -90,11 +90,9 @@ TABDEF::TABDEF(void) ...@@ -90,11 +90,9 @@ TABDEF::TABDEF(void)
/***********************************************************************/ /***********************************************************************/
bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
{ {
//char buf[8];
int poff = 0; int poff = 0;
void *memp = cat->Descp;
Name = (PSZ)PlugSubAlloc(g, memp, strlen(name) + 1); Name = (PSZ)PlugSubAlloc(g, NULL, strlen(name) + 1);
strcpy(Name, name); strcpy(Name, name);
Cat = cat; Cat = cat;
Catfunc = GetFuncID(Cat->GetStringCatInfo(g, "Catfunc", NULL)); Catfunc = GetFuncID(Cat->GetStringCatInfo(g, "Catfunc", NULL));
...@@ -127,7 +125,6 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) ...@@ -127,7 +125,6 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
PTABDEF xdefp; PTABDEF xdefp;
XGETDEF getdef = NULL; XGETDEF getdef = NULL;
PCATLG cat = Cat; PCATLG cat = Cat;
void *memp = cat->Descp;
#if defined(WIN32) #if defined(WIN32)
// Is the DLL already loaded? // Is the DLL already loaded?
...@@ -189,7 +186,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) ...@@ -189,7 +186,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype); sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype);
// Get the table definition block // Get the table definition block
if (!(xdefp = getdef(g, memp))) if (!(xdefp = getdef(g, NULL)))
return NULL; return NULL;
// Have the external class do its complete definition // Have the external class do its complete definition
...@@ -223,15 +220,13 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g) ...@@ -223,15 +220,13 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
void *memp = Cat->Descp;
Module = Cat->GetStringCatInfo(g, "Module", ""); Module = Cat->GetStringCatInfo(g, "Module", "");
Subtype = Cat->GetStringCatInfo(g, "Subtype", Module); Subtype = Cat->GetStringCatInfo(g, "Subtype", Module);
if (!*Module) if (!*Module)
Module = Subtype; Module = Subtype;
Desc = (char*)PlugSubAlloc(g, memp, strlen(Module) Desc = (char*)PlugSubAlloc(g, NULL, strlen(Module)
+ strlen(Subtype) + 3); + strlen(Subtype) + 3);
sprintf(Desc, "%s(%s)", Module, Subtype); sprintf(Desc, "%s(%s)", Module, Subtype);
return false; return false;
......
...@@ -86,7 +86,6 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block. ...@@ -86,7 +86,6 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block.
virtual bool Eval(PGLOBAL) {assert(false); return true;} virtual bool Eval(PGLOBAL) {assert(false); return true;}
virtual int CheckSpcCol(PTDB, int) {assert(false); return 2;} virtual int CheckSpcCol(PTDB, int) {assert(false); return 2;}
virtual bool CheckSort(PTDB) {assert(false); return false;} virtual bool CheckSort(PTDB) {assert(false); return false;}
virtual void MarkCol(ushort) {assert(false);}
private: private:
// Members // Members
......
...@@ -65,7 +65,6 @@ INIDEF::INIDEF(void) ...@@ -65,7 +65,6 @@ INIDEF::INIDEF(void)
Pseudo = 3; Pseudo = 3;
Fn = NULL; Fn = NULL;
Xname = NULL; Xname = NULL;
Subtype = '?';
Layout = '?'; Layout = '?';
Ln = 0; Ln = 0;
} // end of INIDEF constructor } // end of INIDEF constructor
...@@ -75,48 +74,14 @@ INIDEF::INIDEF(void) ...@@ -75,48 +74,14 @@ INIDEF::INIDEF(void)
/***********************************************************************/ /***********************************************************************/
bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
char buf[8], ds[2]; char buf[8];
void *memp = Cat->GetDescp();
if (!stricmp(am, "SYS"))
strcpy(ds, "T"); // SYS tables default to T(able)
else
strcpy(ds, "I"); // INI tables default to I(ni)
Fn = Cat->GetStringCatInfo(g, "Filename", NULL); Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Cat->GetCharCatInfo("Subtype", ds, buf, sizeof(buf));
Subtype = toupper(*buf);
Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf)); Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf));
Layout = toupper(*buf); Layout = toupper(*buf);
switch (Subtype) { if (Fn) {
#if 0 char *p = (char*)PlugSubAlloc(g, NULL, _MAX_PATH);
case 'C':
case 'T':
// Restricted table
Xname = Cat->GetStringCatInfo(g, "Name", "?");
if (!strcmp(Xname, "?"))
Xname = NULL;
if (*Fn == '?')
Fn = Cat->GetStringCatInfo(g, "Database", "?");
if (*Fn != '?') {
char *p = (char*)PlugSubAlloc(g, memp, _MAX_PATH);
if (!PlgSetXdbPath(g, Fn, NULL, p, _MAX_PATH, NULL, 0))
Fn = p;
} else
Fn = Cat->GetDescFile();
Ln = GetIniSize("Database", "Tabsize", "2K", Fn);
break;
#endif // 0
case 'I':
if (*Fn != '?') {
char *p = (char*)PlugSubAlloc(g, memp, _MAX_PATH);
PlugSetPath(p, Fn, GetPath()); PlugSetPath(p, Fn, GetPath());
Fn = p; Fn = p;
...@@ -126,12 +91,6 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -126,12 +91,6 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endif Fn } // endif Fn
Ln = Cat->GetSizeCatInfo("Secsize", "8K"); Ln = Cat->GetSizeCatInfo("Secsize", "8K");
break;
default:
sprintf(g->Message, MSG(INV_SUBTYPE), buf);
return true;
} // endswitch Subtype
Desc = Fn; Desc = Fn;
return false; return false;
} // end of DefineAM } // end of DefineAM
...@@ -143,18 +102,11 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m) ...@@ -143,18 +102,11 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
{ {
PTDBASE tdbp; PTDBASE tdbp;
switch (Subtype) {
case 'I':
if (Layout == 'C') if (Layout == 'C')
tdbp = new(g) TDBINI(this); tdbp = new(g) TDBINI(this);
else else
tdbp = new(g) TDBXIN(this); tdbp = new(g) TDBXIN(this);
break;
default:
return NULL;
} // endswitch Subtype
if (Multiple) if (Multiple)
tdbp = new(g) TDBMUL(tdbp); // No block optimization yet tdbp = new(g) TDBMUL(tdbp); // No block optimization yet
...@@ -163,7 +115,6 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m) ...@@ -163,7 +115,6 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
/***********************************************************************/ /***********************************************************************/
/* DeleteTableFile: Delete INI table files using platform API. */ /* DeleteTableFile: Delete INI table files using platform API. */
/* SysTable and SysColumn tables are readonly and not erasable. */
/***********************************************************************/ /***********************************************************************/
bool INIDEF::DeleteTableFile(PGLOBAL g) bool INIDEF::DeleteTableFile(PGLOBAL g)
{ {
...@@ -171,7 +122,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g) ...@@ -171,7 +122,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
bool rc; bool rc;
// Delete the INI table file if not protected // Delete the INI table file if not protected
if (Subtype == 'I' && !IsReadOnly()) { if (!IsReadOnly()) {
PlugSetPath(filename, Fn, GetPath()); PlugSetPath(filename, Fn, GetPath());
#if defined(WIN32) #if defined(WIN32)
rc = !DeleteFile(filename); rc = !DeleteFile(filename);
......
...@@ -38,7 +38,6 @@ class DllExport INIDEF : public TABDEF { /* INI table description */ ...@@ -38,7 +38,6 @@ class DllExport INIDEF : public TABDEF { /* INI table description */
// Members // Members
char *Fn; /* Path/Name of corresponding file */ char *Fn; /* Path/Name of corresponding file */
char *Xname; /* The eventual table name */ char *Xname; /* The eventual table name */
char Subtype; /* I: INI, T: Table, C: Column */
char Layout; /* R: Row, C: Column */ char Layout; /* R: Row, C: Column */
int Ln; /* Length of section list buffer */ int Ln; /* Length of section list buffer */
}; // end of INIDEF }; // end of INIDEF
......
...@@ -71,7 +71,6 @@ class DllExport XOBJECT : public BLOCK { ...@@ -71,7 +71,6 @@ class DllExport XOBJECT : public BLOCK {
virtual bool VerifyColumn(PTBX txp) {return false;} virtual bool VerifyColumn(PTBX txp) {return false;}
virtual bool VerifyTdb(PTDB& tdbp) {return false;} virtual bool VerifyTdb(PTDB& tdbp) {return false;}
virtual bool IsColInside(PCOL colp) {return false;} virtual bool IsColInside(PCOL colp) {return false;}
virtual void MarkCol(ushort) {}
protected: protected:
PVAL Value; // The current value of the object. PVAL Value; // The current value of the object.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment