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 {
virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy
// Implementation
void *GetDescp(void) {return Descp;}
//PRELDEF GetTo_Desc(void) {return To_Desc;}
//PSZ GetDescFile(void) {return DescFile;}
int GetCblen(void) {return Cblen;}
bool GetDefHuge(void) {return DefHuge;}
void SetDefHuge(bool b) {DefHuge = b;}
//bool GetSepIndex(void) {return SepIndex;}
//void SetSepIndex(bool b) {SepIndex = b;}
char *GetCbuf(void) {return Cbuf;}
char *GetDataPath(void) {return (char*)DataPath;}
......@@ -115,15 +110,10 @@ class DllExport CATALOG {
virtual PRELDEF MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;}
// 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 */
int Cblen; /* Length of suballoc. buffer */
CURTAB Ctb; /* Used to enumerate tables */
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 */
}; // end of class CATALOG
......
......@@ -159,19 +159,6 @@ bool COLBLK::CheckSort(PTDB tdbp)
return (tdbp == To_Tdb);
} // 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. */
/* Now we use Format.Length for the len parameter to avoid strings */
......
......@@ -64,7 +64,6 @@ class DllExport COLBLK : public XOBJECT {
virtual bool IsSpecial(void) {return false;}
virtual int CheckSpcCol(PTDB tdbp, int n) {return 2;}
virtual bool CheckSort(PTDB tdbp);
virtual void MarkCol(ushort bits);
virtual bool Eval(PGLOBAL g);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void SetTo_Val(PVAL valp) {}
......
......@@ -256,15 +256,11 @@ uint GetFuncID(const char *func)
/***********************************************************************/
CATALOG::CATALOG(void)
{
//To_Desc= NULL;
//*DescFile= '\0';
#if defined(WIN32)
DataPath= ".\\";
#else // !WIN32
DataPath= "./";
#endif // !WIN32
Descp= NULL;
//memset(&DescArea, 0, sizeof(AREADEF));
memset(&Ctb, 0, sizeof(CURTAB));
Cbuf= NULL;
Cblen= 0;
......@@ -279,17 +275,14 @@ CATALOG::CATALOG(void)
MYCAT::MYCAT(PHC hc) : CATALOG()
{
Hc= hc;
//To_Desc= NULL;
DefHuge= false;
//SepIndex= true; // Temporay until we can store offet and size
} // end of MYCAT constructor
/***********************************************************************/
/* When using volatile storage, reset values pointing to Sarea. */
/* Nothing to do for CONNECT. */
/***********************************************************************/
void MYCAT::Reset(void)
{
//To_Desc= NULL;
} // end of Reset
/***********************************************************************/
......@@ -597,10 +590,6 @@ PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name,
if (xtrace)
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 (!type && !(type= Hc->GetStringOption("Type")))
type= (Hc->GetStringOption("Tabname")) ? "PROXY" : "DOS";
......@@ -708,7 +697,6 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
/***********************************************************************/
void MYCAT::ClearDB(PGLOBAL g)
{
//To_Desc= NULL;
} // end of ClearDB
/* ------------------------ End of MYCAT --------------------------- */
......@@ -90,11 +90,9 @@ TABDEF::TABDEF(void)
/***********************************************************************/
bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
{
//char buf[8];
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);
Cat = cat;
Catfunc = GetFuncID(Cat->GetStringCatInfo(g, "Catfunc", NULL));
......@@ -127,7 +125,6 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
PTABDEF xdefp;
XGETDEF getdef = NULL;
PCATLG cat = Cat;
void *memp = cat->Descp;
#if defined(WIN32)
// Is the DLL already loaded?
......@@ -189,7 +186,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
sprintf(g->Message, MSG(DEF_ALLOC_ERROR), Subtype);
// Get the table definition block
if (!(xdefp = getdef(g, memp)))
if (!(xdefp = getdef(g, NULL)))
return NULL;
// Have the external class do its complete definition
......@@ -223,15 +220,13 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
/***********************************************************************/
bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
void *memp = Cat->Descp;
Module = Cat->GetStringCatInfo(g, "Module", "");
Subtype = Cat->GetStringCatInfo(g, "Subtype", Module);
if (!*Module)
Module = Subtype;
Desc = (char*)PlugSubAlloc(g, memp, strlen(Module)
Desc = (char*)PlugSubAlloc(g, NULL, strlen(Module)
+ strlen(Subtype) + 3);
sprintf(Desc, "%s(%s)", Module, Subtype);
return false;
......
......@@ -86,7 +86,6 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block.
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;}
virtual void MarkCol(ushort) {assert(false);}
private:
// Members
......
......@@ -65,7 +65,6 @@ INIDEF::INIDEF(void)
Pseudo = 3;
Fn = NULL;
Xname = NULL;
Subtype = '?';
Layout = '?';
Ln = 0;
} // end of INIDEF constructor
......@@ -75,48 +74,14 @@ INIDEF::INIDEF(void)
/***********************************************************************/
bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
char buf[8], ds[2];
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)
char buf[8];
Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Cat->GetCharCatInfo("Subtype", ds, buf, sizeof(buf));
Subtype = toupper(*buf);
Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf));
Layout = toupper(*buf);
switch (Subtype) {
#if 0
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);
if (Fn) {
char *p = (char*)PlugSubAlloc(g, NULL, _MAX_PATH);
PlugSetPath(p, Fn, GetPath());
Fn = p;
......@@ -126,12 +91,6 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endif Fn
Ln = Cat->GetSizeCatInfo("Secsize", "8K");
break;
default:
sprintf(g->Message, MSG(INV_SUBTYPE), buf);
return true;
} // endswitch Subtype
Desc = Fn;
return false;
} // end of DefineAM
......@@ -143,18 +102,11 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
{
PTDBASE tdbp;
switch (Subtype) {
case 'I':
if (Layout == 'C')
tdbp = new(g) TDBINI(this);
else
tdbp = new(g) TDBXIN(this);
break;
default:
return NULL;
} // endswitch Subtype
if (Multiple)
tdbp = new(g) TDBMUL(tdbp); // No block optimization yet
......@@ -163,7 +115,6 @@ PTDB INIDEF::GetTable(PGLOBAL g, MODE m)
/***********************************************************************/
/* DeleteTableFile: Delete INI table files using platform API. */
/* SysTable and SysColumn tables are readonly and not erasable. */
/***********************************************************************/
bool INIDEF::DeleteTableFile(PGLOBAL g)
{
......@@ -171,7 +122,7 @@ bool INIDEF::DeleteTableFile(PGLOBAL g)
bool rc;
// Delete the INI table file if not protected
if (Subtype == 'I' && !IsReadOnly()) {
if (!IsReadOnly()) {
PlugSetPath(filename, Fn, GetPath());
#if defined(WIN32)
rc = !DeleteFile(filename);
......
......@@ -38,7 +38,6 @@ class DllExport INIDEF : public TABDEF { /* INI table description */
// Members
char *Fn; /* Path/Name of corresponding file */
char *Xname; /* The eventual table name */
char Subtype; /* I: INI, T: Table, C: Column */
char Layout; /* R: Row, C: Column */
int Ln; /* Length of section list buffer */
}; // end of INIDEF
......
......@@ -71,7 +71,6 @@ class DllExport XOBJECT : public BLOCK {
virtual bool VerifyColumn(PTBX txp) {return false;}
virtual bool VerifyTdb(PTDB& tdbp) {return false;}
virtual bool IsColInside(PCOL colp) {return false;}
virtual void MarkCol(ushort) {}
protected:
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