Commit cd9e1938 authored by Olivier Bertrand's avatar Olivier Bertrand

- Add a new table option SEPINDEX (not used yet) and remove an unused

  parameter to all catalog info functions.

modified:
  storage/connect/catalog.h
  storage/connect/filamvct.cpp
  storage/connect/filamzip.cpp
  storage/connect/ha_connect.cc
  storage/connect/mycat.cc
  storage/connect/mycat.h
  storage/connect/reldef.cpp
  storage/connect/reldef.h
  storage/connect/tabdos.cpp
  storage/connect/tabfmt.cpp
  storage/connect/tabmul.cpp
  storage/connect/tabmysql.cpp
  storage/connect/tabodbc.cpp
  storage/connect/tabsys.cpp
  storage/connect/tabtbl.cpp
  storage/connect/tabvct.cpp
  storage/connect/tabwmi.cpp
  storage/connect/tabxml.cpp
  storage/connect/xindex.cpp
parent 8f0ae632
...@@ -68,21 +68,21 @@ class DllExport CATALOG { ...@@ -68,21 +68,21 @@ class DllExport CATALOG {
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;} //bool GetSepIndex(void) {return SepIndex;}
void SetSepIndex(bool b) {SepIndex = b;} //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;}
// Methods // Methods
virtual void Reset(void) {} virtual void Reset(void) {}
virtual void SetDataPath(PGLOBAL g, const char *path) {} virtual void SetDataPath(PGLOBAL g, const char *path) {}
virtual bool GetBoolCatInfo(LPCSTR name, PSZ what, bool bdef) {return bdef;} virtual bool GetBoolCatInfo(PSZ what, bool bdef) {return bdef;}
virtual bool SetIntCatInfo(LPCSTR name, PSZ what, int ival) {return false;} virtual bool SetIntCatInfo(PSZ what, int ival) {return false;}
virtual int GetIntCatInfo(LPCSTR name, PSZ what, int idef) {return idef;} virtual int GetIntCatInfo(PSZ what, int idef) {return idef;}
virtual int GetSizeCatInfo(LPCSTR name, PSZ what, PSZ sdef) {return 0;} virtual int GetSizeCatInfo(PSZ what, PSZ sdef) {return 0;}
virtual int GetCharCatInfo(LPCSTR name, PSZ what, PSZ sdef, char *buf, int size) virtual int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size)
{strncpy(buf, sdef, size); return size;} {strncpy(buf, sdef, size); return size;}
virtual char *GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef) virtual char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
{return sdef;} {return sdef;}
virtual int GetColCatInfo(PGLOBAL g, PTABDEF defp) {return -1;} virtual int GetColCatInfo(PGLOBAL g, PTABDEF defp) {return -1;}
virtual bool GetIndexInfo(PGLOBAL g, PTABDEF defp) {return true;} virtual bool GetIndexInfo(PGLOBAL g, PTABDEF defp) {return true;}
...@@ -119,7 +119,7 @@ class DllExport CATALOG { ...@@ -119,7 +119,7 @@ class DllExport CATALOG {
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 */ //bool SepIndex; /* true: separate index files */
//char DescFile[_MAX_PATH]; /* DB description filename */ //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
......
...@@ -1118,8 +1118,8 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last) ...@@ -1118,8 +1118,8 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last)
defp->SetBlock(Block); defp->SetBlock(Block);
defp->SetLast(Last); defp->SetLast(Last);
if (!cat->SetIntCatInfo(name, "Blocks", Block) || if (!cat->SetIntCatInfo("Blocks", Block) ||
!cat->SetIntCatInfo(name, "Last", Last)) { !cat->SetIntCatInfo("Last", Last)) {
sprintf(g->Message, MSG(UPDATE_ERROR), "Header"); sprintf(g->Message, MSG(UPDATE_ERROR), "Header");
rc = true; rc = true;
} // endif } // endif
......
...@@ -614,8 +614,8 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -614,8 +614,8 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
defp->SetBlock(0); defp->SetBlock(0);
defp->SetLast(Nrec); defp->SetLast(Nrec);
if (!cat->SetIntCatInfo(name, "Blocks", 0) || if (!cat->SetIntCatInfo("Blocks", 0) ||
!cat->SetIntCatInfo(name, "Last", 0)) { !cat->SetIntCatInfo("Last", 0)) {
sprintf(g->Message, MSG(UPDATE_ERROR), "Header"); sprintf(g->Message, MSG(UPDATE_ERROR), "Header");
return RC_FX; return RC_FX;
} else } else
...@@ -653,8 +653,8 @@ void ZBKFAM::CloseTableFile(PGLOBAL g) ...@@ -653,8 +653,8 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
if (rc != RC_FX) { if (rc != RC_FX) {
defp->SetBlock(Block); defp->SetBlock(Block);
defp->SetLast(Last); defp->SetLast(Last);
cat->SetIntCatInfo(name, "Blocks", Block); cat->SetIntCatInfo("Blocks", Block);
cat->SetIntCatInfo(name, "Last", Last); cat->SetIntCatInfo("Last", Last);
} // endif } // endif
gzclose(Zfile); gzclose(Zfile);
......
...@@ -224,6 +224,7 @@ struct ha_table_option_struct { ...@@ -224,6 +224,7 @@ struct ha_table_option_struct {
bool huge; bool huge;
bool split; bool split;
bool readonly; bool readonly;
bool sepindex;
}; };
#if defined(MARIADB) #if defined(MARIADB)
...@@ -257,6 +258,7 @@ ha_create_table_option connect_table_option_list[]= ...@@ -257,6 +258,7 @@ ha_create_table_option connect_table_option_list[]=
HA_TOPTION_BOOL("HUGE", huge, 0), HA_TOPTION_BOOL("HUGE", huge, 0),
HA_TOPTION_BOOL("SPLIT", split, 0), HA_TOPTION_BOOL("SPLIT", split, 0),
HA_TOPTION_BOOL("READONLY", readonly, 0), HA_TOPTION_BOOL("READONLY", readonly, 0),
HA_TOPTION_BOOL("SEPINDEX", sepindex, 0),
HA_TOPTION_END HA_TOPTION_END
}; };
#endif // MARIADB #endif // MARIADB
...@@ -870,6 +872,8 @@ bool ha_connect::GetBooleanOption(char *opname, bool bdef) ...@@ -870,6 +872,8 @@ bool ha_connect::GetBooleanOption(char *opname, bool bdef)
opval= options->split; opval= options->split;
else if (!stricmp(opname, "Readonly")) else if (!stricmp(opname, "Readonly"))
opval= options->readonly; opval= options->readonly;
else if (!stricmp(opname, "SepIndex"))
opval= options->sepindex;
else if (options->oplist) else if (options->oplist)
if ((pv= GetListOption(opname, options->oplist))) if ((pv= GetListOption(opname, options->oplist)))
opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0); opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
...@@ -4035,9 +4039,11 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -4035,9 +4039,11 @@ int ha_connect::create(const char *name, TABLE *table_arg,
if (IsFileType(type)) { if (IsFileType(type)) {
table= table_arg; // Used by called functions table= table_arg; // Used by called functions
if (!options->filename) { if (!options->filename && type != TAB_XML) {
// The file name is not specified, create a default file in // The file name is not specified, create a default file in
// the database directory named table_name.table_type. // the database directory named table_name.table_type.
// (temporarily not done for XML because a void file causes
// the XML parsers to report an error on the first Insert)
char buf[256], fn[_MAX_PATH], dbpath[128]; char buf[256], fn[_MAX_PATH], dbpath[128];
int h; int h;
......
...@@ -235,7 +235,7 @@ MYCAT::MYCAT(PHC hc) : CATALOG() ...@@ -235,7 +235,7 @@ MYCAT::MYCAT(PHC hc) : CATALOG()
Hc= hc; Hc= hc;
To_Desc= NULL; To_Desc= NULL;
DefHuge= false; DefHuge= false;
SepIndex= true; // Temporay until we can store offet and size //SepIndex= true; // Temporay until we can store offet and size
} // end of MYCAT constructor } // end of MYCAT constructor
/***********************************************************************/ /***********************************************************************/
...@@ -273,7 +273,7 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path) ...@@ -273,7 +273,7 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
/***********************************************************************/ /***********************************************************************/
/* This function sets an integer MYCAT information. */ /* This function sets an integer MYCAT information. */
/***********************************************************************/ /***********************************************************************/
bool MYCAT::SetIntCatInfo(LPCSTR name, PSZ what, int n) bool MYCAT::SetIntCatInfo(PSZ what, int n)
{ {
return Hc->SetIntegerOption(what, n); return Hc->SetIntegerOption(what, n);
} // end of SetIntCatInfo } // end of SetIntCatInfo
...@@ -281,7 +281,7 @@ bool MYCAT::SetIntCatInfo(LPCSTR name, PSZ what, int n) ...@@ -281,7 +281,7 @@ bool MYCAT::SetIntCatInfo(LPCSTR name, PSZ what, int n)
/***********************************************************************/ /***********************************************************************/
/* This function returns integer MYCAT information. */ /* This function returns integer MYCAT information. */
/***********************************************************************/ /***********************************************************************/
int MYCAT::GetIntCatInfo(LPCSTR name, PSZ what, int idef) int MYCAT::GetIntCatInfo(PSZ what, int idef)
{ {
int n= Hc->GetIntegerOption(what); int n= Hc->GetIntegerOption(what);
...@@ -291,7 +291,7 @@ int MYCAT::GetIntCatInfo(LPCSTR name, PSZ what, int idef) ...@@ -291,7 +291,7 @@ int MYCAT::GetIntCatInfo(LPCSTR name, PSZ what, int idef)
/***********************************************************************/ /***********************************************************************/
/* This function returns Boolean MYCAT information. */ /* This function returns Boolean MYCAT information. */
/***********************************************************************/ /***********************************************************************/
bool MYCAT::GetBoolCatInfo(LPCSTR name, PSZ what, bool bdef) bool MYCAT::GetBoolCatInfo(PSZ what, bool bdef)
{ {
bool b= Hc->GetBooleanOption(what, bdef); bool b= Hc->GetBooleanOption(what, bdef);
...@@ -301,7 +301,7 @@ bool MYCAT::GetBoolCatInfo(LPCSTR name, PSZ what, bool bdef) ...@@ -301,7 +301,7 @@ bool MYCAT::GetBoolCatInfo(LPCSTR name, PSZ what, bool bdef)
/***********************************************************************/ /***********************************************************************/
/* This function returns size catalog information. */ /* This function returns size catalog information. */
/***********************************************************************/ /***********************************************************************/
int MYCAT::GetSizeCatInfo(LPCSTR name, PSZ what, PSZ sdef) int MYCAT::GetSizeCatInfo(PSZ what, PSZ sdef)
{ {
char * s, c; char * s, c;
int i, n= 0; int i, n= 0;
...@@ -323,8 +323,7 @@ int MYCAT::GetSizeCatInfo(LPCSTR name, PSZ what, PSZ sdef) ...@@ -323,8 +323,7 @@ int MYCAT::GetSizeCatInfo(LPCSTR name, PSZ what, PSZ sdef)
/***********************************************************************/ /***********************************************************************/
/* This function sets char MYCAT information in buf. */ /* This function sets char MYCAT information in buf. */
/***********************************************************************/ /***********************************************************************/
int MYCAT::GetCharCatInfo(LPCSTR name, PSZ what, int MYCAT::GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size)
PSZ sdef, char *buf, int size)
{ {
char *s= Hc->GetStringOption(what); char *s= Hc->GetStringOption(what);
...@@ -336,7 +335,7 @@ int MYCAT::GetCharCatInfo(LPCSTR name, PSZ what, ...@@ -336,7 +335,7 @@ int MYCAT::GetCharCatInfo(LPCSTR name, PSZ what,
/* This function returns string MYCAT information. */ /* This function returns string MYCAT information. */
/* Default parameter is "*" to get the handler default. */ /* Default parameter is "*" to get the handler default. */
/***********************************************************************/ /***********************************************************************/
char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef) char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
{ {
char *sval, *s= Hc->GetStringOption(what, sdef); char *sval, *s= Hc->GetStringOption(what, sdef);
...@@ -359,7 +358,7 @@ char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef) ...@@ -359,7 +358,7 @@ char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef)
/***********************************************************************/ /***********************************************************************/
int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp)
{ {
char *type= GetStringCatInfo(g, NULL, "Type", "DOS"); char *type= GetStringCatInfo(g, "Type", "DOS");
int i, loff, poff, nof, nlg; int i, loff, poff, nof, nlg;
void *field= NULL; void *field= NULL;
TABTYPE tc; TABTYPE tc;
......
...@@ -54,12 +54,12 @@ class MYCAT : public CATALOG { ...@@ -54,12 +54,12 @@ class MYCAT : public CATALOG {
void Reset(void); void Reset(void);
void SetDataPath(PGLOBAL g, const char *path) void SetDataPath(PGLOBAL g, const char *path)
{SetPath(g, &DataPath, path);} {SetPath(g, &DataPath, path);}
bool GetBoolCatInfo(LPCSTR name, PSZ what, bool bdef); bool GetBoolCatInfo(PSZ what, bool bdef);
bool SetIntCatInfo(LPCSTR name, PSZ what, int ival); bool SetIntCatInfo(PSZ what, int ival);
int GetIntCatInfo(LPCSTR name, PSZ what, int idef); int GetIntCatInfo(PSZ what, int idef);
int GetSizeCatInfo(LPCSTR name, PSZ what, PSZ sdef); int GetSizeCatInfo(PSZ what, PSZ sdef);
int GetCharCatInfo(LPCSTR name, PSZ what, PSZ sdef, char *buf, int size); int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size);
char *GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef); char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef);
int GetColCatInfo(PGLOBAL g, PTABDEF defp); int GetColCatInfo(PGLOBAL g, PTABDEF defp);
bool GetIndexInfo(PGLOBAL g, PTABDEF defp); bool GetIndexInfo(PGLOBAL g, PTABDEF defp);
bool StoreIndex(PGLOBAL g, PTABDEF defp) {return false;} // Temporary bool StoreIndex(PGLOBAL g, PTABDEF defp) {return false;} // Temporary
......
...@@ -97,12 +97,12 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) ...@@ -97,12 +97,12 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
Name = (PSZ)PlugSubAlloc(g, memp, strlen(name) + 1); Name = (PSZ)PlugSubAlloc(g, memp, strlen(name) + 1);
strcpy(Name, name); strcpy(Name, name);
Cat = cat; Cat = cat;
Catfunc = GetFuncID(Cat->GetStringCatInfo(g, Name, "Catfunc", NULL)); Catfunc = GetFuncID(Cat->GetStringCatInfo(g, "Catfunc", NULL));
Elemt = cat->GetIntCatInfo(name, "Elements", 0); Elemt = cat->GetIntCatInfo("Elements", 0);
Multiple = cat->GetIntCatInfo(name, "Multiple", 0); Multiple = cat->GetIntCatInfo("Multiple", 0);
Degree = cat->GetIntCatInfo(name, "Degree", 0); Degree = cat->GetIntCatInfo("Degree", 0);
Read_Only = cat->GetBoolCatInfo(name, "ReadOnly", false); Read_Only = cat->GetBoolCatInfo("ReadOnly", false);
const char *data_charset_name= cat->GetStringCatInfo(g, Name, "Data_charset", NULL); const char *data_charset_name= cat->GetStringCatInfo(g, "Data_charset", NULL);
m_data_charset= data_charset_name ? m_data_charset= data_charset_name ?
get_charset_by_csname(data_charset_name, MY_CS_PRIMARY, 0): get_charset_by_csname(data_charset_name, MY_CS_PRIMARY, 0):
NULL; NULL;
...@@ -195,7 +195,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) ...@@ -195,7 +195,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
// Have the external class do its complete definition // Have the external class do its complete definition
if (!cat->Cbuf) { if (!cat->Cbuf) {
// Suballocate a temporary buffer for the entire column section // Suballocate a temporary buffer for the entire column section
cat->Cblen = cat->GetSizeCatInfo("Database", "Colsize", "8K"); cat->Cblen = cat->GetSizeCatInfo("Colsize", "8K");
cat->Cbuf = (char*)PlugSubAlloc(g, NULL, cat->Cblen); cat->Cbuf = (char*)PlugSubAlloc(g, NULL, cat->Cblen);
} // endif Cbuf } // endif Cbuf
...@@ -225,8 +225,8 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -225,8 +225,8 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
void *memp = Cat->Descp; void *memp = Cat->Descp;
Module = Cat->GetStringCatInfo(g, Name, "Module", ""); Module = Cat->GetStringCatInfo(g, "Module", "");
Subtype = Cat->GetStringCatInfo(g, Name, "Subtype", Module); Subtype = Cat->GetStringCatInfo(g, "Subtype", Module);
if (!*Module) if (!*Module)
Module = Subtype; Module = Subtype;
......
...@@ -70,7 +70,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */ ...@@ -70,7 +70,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
int GetPseudo(void) {return Pseudo;} int GetPseudo(void) {return Pseudo;}
PSZ GetPath(void) PSZ GetPath(void)
{return (Database) ? (PSZ)Database : Cat->GetDataPath();} {return (Database) ? (PSZ)Database : Cat->GetDataPath();}
bool SepIndex(void) {return Cat->GetSepIndex();} bool SepIndex(void) {return Cat->GetBoolCatInfo("SepIndex", false);}
bool IsReadOnly(void) {return Read_Only;} bool IsReadOnly(void) {return Read_Only;}
virtual AMT GetDefType(void) {return TYPE_AM_TAB;} virtual AMT GetDefType(void) {return TYPE_AM_TAB;}
virtual PIXDEF GetIndx(void) {return NULL;} virtual PIXDEF GetIndx(void) {return NULL;}
......
...@@ -160,7 +160,8 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) ...@@ -160,7 +160,8 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
if (!pxdf) if (!pxdf)
return false; // No index return false; // No index
sep = Cat->GetSepIndex(); // If true indexes are in separate files // If true indexes are in separate files
sep = Cat->GetBoolCatInfo("SepIndex", false);
if (!sep && To_Indx) { if (!sep && To_Indx) {
strcpy(g->Message, MSG(NO_RECOV_SPACE)); strcpy(g->Message, MSG(NO_RECOV_SPACE));
...@@ -231,35 +232,35 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -231,35 +232,35 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
: (am && (*am == 'B' || *am == 'b')) ? "B" : (am && (*am == 'B' || *am == 'b')) ? "B"
: (am && !stricmp(am, "DBF")) ? "D" : "V"; : (am && !stricmp(am, "DBF")) ? "D" : "V";
Desc = Fn = Cat->GetStringCatInfo(g, Name, "Filename", NULL); Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Ofn = Cat->GetStringCatInfo(g, Name, "Optname", Fn); Ofn = Cat->GetStringCatInfo(g, "Optname", Fn);
Cat->GetCharCatInfo(Name, "Recfm", (PSZ)dfm, buf, sizeof(buf)); Cat->GetCharCatInfo("Recfm", (PSZ)dfm, buf, sizeof(buf));
Recfm = (toupper(*buf) == 'F') ? RECFM_FIX : Recfm = (toupper(*buf) == 'F') ? RECFM_FIX :
(toupper(*buf) == 'B') ? RECFM_BIN : (toupper(*buf) == 'B') ? RECFM_BIN :
(toupper(*buf) == 'D') ? RECFM_DBF : RECFM_VAR; (toupper(*buf) == 'D') ? RECFM_DBF : RECFM_VAR;
Lrecl = Cat->GetIntCatInfo(Name, "Lrecl", 0); Lrecl = Cat->GetIntCatInfo("Lrecl", 0);
if (Recfm != RECFM_DBF) if (Recfm != RECFM_DBF)
Compressed = Cat->GetIntCatInfo(Name, "Compressed", 0); Compressed = Cat->GetIntCatInfo("Compressed", 0);
Mapped = Cat->GetBoolCatInfo(Name, "Mapped", map); Mapped = Cat->GetBoolCatInfo("Mapped", map);
Block = Cat->GetIntCatInfo(Name, "Blocks", 0); Block = Cat->GetIntCatInfo("Blocks", 0);
Last = Cat->GetIntCatInfo(Name, "Last", 0); Last = Cat->GetIntCatInfo("Last", 0);
Ending = Cat->GetIntCatInfo(Name, "Ending", CRLF); Ending = Cat->GetIntCatInfo("Ending", CRLF);
if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) { if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) {
int defhuge = (Cat->GetDefHuge()) ? 1 : 0; int defhuge = (Cat->GetDefHuge()) ? 1 : 0;
Huge = (Cat->GetIntCatInfo(Name, "Huge", defhuge) != 0); Huge = (Cat->GetIntCatInfo("Huge", defhuge) != 0);
Padded = (Cat->GetIntCatInfo(Name, "Padded", 0) != 0); Padded = (Cat->GetIntCatInfo("Padded", 0) != 0);
Blksize = Cat->GetIntCatInfo(Name, "Blksize", 0); Blksize = Cat->GetIntCatInfo("Blksize", 0);
Eof = (Cat->GetIntCatInfo(Name, "EOF", 0) != 0); Eof = (Cat->GetIntCatInfo("EOF", 0) != 0);
} else if (Recfm == RECFM_DBF) { } else if (Recfm == RECFM_DBF) {
Maxerr = Cat->GetIntCatInfo(Name, "Maxerr", 0); Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Accept = (Cat->GetIntCatInfo(Name, "Accept", 0) != 0); Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
ReadMode = Cat->GetIntCatInfo(Name, "Readmode", 0); ReadMode = Cat->GetIntCatInfo("Readmode", 0);
} else // (Recfm == RECFM_VAR) } else // (Recfm == RECFM_VAR)
AvgLen = Cat->GetIntCatInfo(Name, "Avglen", 0); AvgLen = Cat->GetIntCatInfo("Avglen", 0);
// Ignore wrong Index definitions for catalog commands // Ignore wrong Index definitions for catalog commands
return (Cat->GetIndexInfo(g, this) /*&& !Cat->GetCatFnc()*/); return (Cat->GetIndexInfo(g, this) /*&& !Cat->GetCatFnc()*/);
......
...@@ -417,10 +417,10 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -417,10 +417,10 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (DOSDEF::DefineAM(g, "CSV", poff)) if (DOSDEF::DefineAM(g, "CSV", poff))
return true; return true;
Cat->GetCharCatInfo(Name, "Separator", ",", buf, sizeof(buf)); Cat->GetCharCatInfo("Separator", ",", buf, sizeof(buf));
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf; Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
Quoted = Cat->GetIntCatInfo(Name, "Quoted", -1); Quoted = Cat->GetIntCatInfo("Quoted", -1);
Cat->GetCharCatInfo(Name, "Qchar", "", buf, sizeof(buf)); Cat->GetCharCatInfo("Qchar", "", buf, sizeof(buf));
Qot = *buf; Qot = *buf;
if (Qot && Quoted < 0) if (Qot && Quoted < 0)
...@@ -429,9 +429,9 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -429,9 +429,9 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Qot = '"'; Qot = '"';
Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f'))); Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f')));
Header = (Cat->GetIntCatInfo(Name, "Header", 0) != 0); Header = (Cat->GetIntCatInfo("Header", 0) != 0);
Maxerr = Cat->GetIntCatInfo(Name, "Maxerr", 0); Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Accept = (Cat->GetIntCatInfo(Name, "Accept", 0) != 0); Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
return false; return false;
} // end of DefineAM } // end of DefineAM
......
...@@ -560,9 +560,9 @@ void TDBMUL::CloseDB(PGLOBAL g) ...@@ -560,9 +560,9 @@ void TDBMUL::CloseDB(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
Desc = Fn = Cat->GetStringCatInfo(g, Name, "Filename", NULL); Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Incl = (Cat->GetIntCatInfo(Name, "Subdir", 0) != 0); Incl = (Cat->GetIntCatInfo("Subdir", 0) != 0);
Huge = (Cat->GetIntCatInfo(Name, "Huge", 0) != 0); Huge = (Cat->GetIntCatInfo("Huge", 0) != 0);
return false; return false;
} // end of DefineAM } // end of DefineAM
......
...@@ -249,7 +249,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url) ...@@ -249,7 +249,7 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url)
Hostname = "localhost"; Hostname = "localhost";
if (!Database || !*Database) if (!Database || !*Database)
Database = Cat->GetStringCatInfo(g, Name, "Database", "*"); Database = Cat->GetStringCatInfo(g, "Database", "*");
if (!Tabname || !*Tabname) if (!Tabname || !*Tabname)
Tabname = Name; Tabname = Name;
...@@ -272,24 +272,24 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url) ...@@ -272,24 +272,24 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url)
/***********************************************************************/ /***********************************************************************/
bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
char *url = Cat->GetStringCatInfo(g, Name, "Connect", NULL); char *url = Cat->GetStringCatInfo(g, "Connect", NULL);
Desc = "MySQL Table"; Desc = "MySQL Table";
if (!url || !*url) { if (!url || !*url) {
// Not using the connection URL // Not using the connection URL
Hostname = Cat->GetStringCatInfo(g, Name, "Host", "localhost"); Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
Database = Cat->GetStringCatInfo(g, Name, "Database", "*"); Database = Cat->GetStringCatInfo(g, "Database", "*");
Tabname = Cat->GetStringCatInfo(g, Name, "Name", Name); // Deprecated Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = Cat->GetStringCatInfo(g, Name, "Tabname", Tabname); Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Username = Cat->GetStringCatInfo(g, Name, "User", "root"); Username = Cat->GetStringCatInfo(g, "User", "root");
Password = Cat->GetStringCatInfo(g, Name, "Password", NULL); Password = Cat->GetStringCatInfo(g, "Password", NULL);
Portnumber = Cat->GetIntCatInfo(Name, "Port", MYSQL_PORT); Portnumber = Cat->GetIntCatInfo("Port", MYSQL_PORT);
} else if (ParseURL(g, url)) } else if (ParseURL(g, url))
return TRUE; return TRUE;
Bind = !!Cat->GetIntCatInfo(Name, "Bind", 0); Bind = !!Cat->GetIntCatInfo("Bind", 0);
Delayed = !!Cat->GetIntCatInfo(Name, "Delayed", 0); Delayed = !!Cat->GetIntCatInfo("Delayed", 0);
return FALSE; return FALSE;
} // end of DefineAM } // end of DefineAM
......
...@@ -102,15 +102,15 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -102,15 +102,15 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
int dop = ODBConn::noOdbcDialog; // Default for options int dop = ODBConn::noOdbcDialog; // Default for options
Desc = Connect = Cat->GetStringCatInfo(g, Name, "Connect", ""); Desc = Connect = Cat->GetStringCatInfo(g, "Connect", "");
Tabname = Cat->GetStringCatInfo(g, Name, "Name", Tabname = Cat->GetStringCatInfo(g, "Name",
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name); (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
Tabname = Cat->GetStringCatInfo(g, Name, "Tabname", Tabname); Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Tabowner = Cat->GetStringCatInfo(g, Name, "Owner", ""); Tabowner = Cat->GetStringCatInfo(g, "Owner", "");
Tabqual = Cat->GetStringCatInfo(g, Name, "Qualifier", ""); Tabqual = Cat->GetStringCatInfo(g, "Qualifier", "");
Qchar = Cat->GetStringCatInfo(g, Name, "Qchar", ""); Qchar = Cat->GetStringCatInfo(g, "Qchar", "");
Catver = Cat->GetIntCatInfo(Name, "Catver", 2); Catver = Cat->GetIntCatInfo("Catver", 2);
Options = Cat->GetIntCatInfo(Name, "Options", dop); Options = Cat->GetIntCatInfo("Options", dop);
Pseudo = 2; // FILID is Ok but not ROWID Pseudo = 2; // FILID is Ok but not ROWID
return false; return false;
} // end of DefineAM } // end of DefineAM
......
...@@ -83,10 +83,10 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -83,10 +83,10 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
else else
strcpy(ds, "I"); // INI tables default to I(ni) strcpy(ds, "I"); // INI tables default to I(ni)
Fn = Cat->GetStringCatInfo(g, Name, "Filename", NULL); Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Cat->GetCharCatInfo(Name, "Subtype", ds, buf, sizeof(buf)); Cat->GetCharCatInfo("Subtype", ds, buf, sizeof(buf));
Subtype = toupper(*buf); Subtype = toupper(*buf);
Cat->GetCharCatInfo(Name, "Layout", "C", buf, sizeof(buf)); Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf));
Layout = toupper(*buf); Layout = toupper(*buf);
switch (Subtype) { switch (Subtype) {
...@@ -94,13 +94,13 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -94,13 +94,13 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
case 'C': case 'C':
case 'T': case 'T':
// Restricted table // Restricted table
Xname = Cat->GetStringCatInfo(g, Name, "Name", "?"); Xname = Cat->GetStringCatInfo(g, "Name", "?");
if (!strcmp(Xname, "?")) if (!strcmp(Xname, "?"))
Xname = NULL; Xname = NULL;
if (*Fn == '?') if (*Fn == '?')
Fn = Cat->GetStringCatInfo(g, Name, "Database", "?"); Fn = Cat->GetStringCatInfo(g, "Database", "?");
if (*Fn != '?') { if (*Fn != '?') {
char *p = (char*)PlugSubAlloc(g, memp, _MAX_PATH); char *p = (char*)PlugSubAlloc(g, memp, _MAX_PATH);
...@@ -125,7 +125,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -125,7 +125,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true; return true;
} // endif Fn } // endif Fn
Ln = Cat->GetSizeCatInfo((char*)Name, "Secsize", "8K"); Ln = Cat->GetSizeCatInfo("Secsize", "8K");
break; break;
default: default:
sprintf(g->Message, MSG(INV_SUBTYPE), buf); sprintf(g->Message, MSG(INV_SUBTYPE), buf);
......
...@@ -98,8 +98,8 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -98,8 +98,8 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
char *tablist, *dbname; char *tablist, *dbname;
Desc = "Table list table"; Desc = "Table list table";
tablist = Cat->GetStringCatInfo(g, Name, "Tablist", ""); tablist = Cat->GetStringCatInfo(g, "Tablist", "");
dbname = Cat->GetStringCatInfo(g, Name, "Database", NULL); dbname = Cat->GetStringCatInfo(g, "Database", NULL);
Ntables = 0; Ntables = 0;
if (*tablist) { if (*tablist) {
...@@ -140,8 +140,8 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -140,8 +140,8 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endfor pdb } // endfor pdb
Maxerr = Cat->GetIntCatInfo(Name, "Maxerr", 0); Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
Accept = (Cat->GetBoolCatInfo(Name, "Accept", 0) != 0); Accept = (Cat->GetBoolCatInfo("Accept", 0) != 0);
} // endif fsec || tablist } // endif fsec || tablist
return FALSE; return FALSE;
......
...@@ -94,9 +94,9 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -94,9 +94,9 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
DOSDEF::DefineAM(g, "BIN", poff); DOSDEF::DefineAM(g, "BIN", poff);
Estimate = Cat->GetIntCatInfo(Name, "Estimate", 0); Estimate = Cat->GetIntCatInfo("Estimate", 0);
Split = Cat->GetIntCatInfo(Name, "Split", (Estimate) ? 0 : 1); Split = Cat->GetIntCatInfo("Split", (Estimate) ? 0 : 1);
Header = Cat->GetIntCatInfo(Name, "Header", 0); Header = Cat->GetIntCatInfo("Header", 0);
// CONNECT must have Block/Last info for VEC tables // CONNECT must have Block/Last info for VEC tables
if (Estimate && !Split && !Header) if (Estimate && !Split && !Header)
...@@ -107,7 +107,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -107,7 +107,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
// For packed files the logical record length is calculated in poff // For packed files the logical record length is calculated in poff
if (poff != Lrecl) { if (poff != Lrecl) {
Lrecl = poff; Lrecl = poff;
Cat->SetIntCatInfo(Name, "Lrecl", poff); Cat->SetIntCatInfo("Lrecl", poff);
} // endif poff } // endif poff
Padded = false; Padded = false;
......
...@@ -337,8 +337,8 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info) ...@@ -337,8 +337,8 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info)
/***********************************************************************/ /***********************************************************************/
bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{ {
Nspace = Cat->GetStringCatInfo(g, Name, "Namespace", "Root\\CimV2"); Nspace = Cat->GetStringCatInfo(g, "Namespace", "Root\\CimV2");
Wclass = Cat->GetStringCatInfo(g, Name, "Class", Wclass = Cat->GetStringCatInfo(g, "Class",
(!stricmp(Nspace, "root\\cimv2") ? "ComputerSystemProduct" : (!stricmp(Nspace, "root\\cimv2") ? "ComputerSystemProduct" :
!stricmp(Nspace, "root\\cli") ? "Msft_CliAlias" : "")); !stricmp(Nspace, "root\\cli") ? "Msft_CliAlias" : ""));
...@@ -351,7 +351,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -351,7 +351,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endif Wclass } // endif Wclass
if (Catfunc == FNC_NO) if (Catfunc == FNC_NO)
Ems = Cat->GetIntCatInfo(Name, "Estimate", 100); Ems = Cat->GetIntCatInfo("Estimate", 100);
return false; return false;
} // end of DefineAM } // end of DefineAM
......
...@@ -92,21 +92,21 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -92,21 +92,21 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
//void *memp = Cat->GetDescp(); //void *memp = Cat->GetDescp();
//PSZ dbfile = Cat->GetDescFile(); //PSZ dbfile = Cat->GetDescFile();
Fn = Cat->GetStringCatInfo(g, Name, "Filename", NULL); Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
Encoding = Cat->GetStringCatInfo(g, Name, "Encoding", "UTF-8"); Encoding = Cat->GetStringCatInfo(g, "Encoding", "UTF-8");
if (*Fn == '?') { if (*Fn == '?') {
strcpy(g->Message, MSG(MISSING_FNAME)); strcpy(g->Message, MSG(MISSING_FNAME));
return true; return true;
} // endif fn } // endif fn
if ((signed)Cat->GetIntCatInfo(Name, "Flag", -1) != -1) { if ((signed)Cat->GetIntCatInfo("Flag", -1) != -1) {
strcpy(g->Message, MSG(DEPREC_FLAG)); strcpy(g->Message, MSG(DEPREC_FLAG));
return true; return true;
} // endif flag } // endif flag
defrow = defcol = ""; defrow = defcol = "";
Cat->GetCharCatInfo(Name, "Coltype", "", buf, sizeof(buf)); Cat->GetCharCatInfo("Coltype", "", buf, sizeof(buf));
switch (toupper(*buf)) { switch (toupper(*buf)) {
case 'A': // Attribute case 'A': // Attribute
...@@ -133,32 +133,39 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -133,32 +133,39 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true; return true;
} // endswitch typname } // endswitch typname
Tabname = Cat->GetStringCatInfo(g, Name, "Name", Name); // Deprecated Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = Cat->GetStringCatInfo(g, Name, "Table_name", Tabname); Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname);
Rowname = Cat->GetStringCatInfo(g, Name, "Rownode", defrow); Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow);
Colname = Cat->GetStringCatInfo(g, Name, "Colnode", defcol); Colname = Cat->GetStringCatInfo(g, "Colnode", defcol);
Mulnode = Cat->GetStringCatInfo(g, Name, "Mulnode", ""); Mulnode = Cat->GetStringCatInfo(g, "Mulnode", "");
XmlDB = Cat->GetStringCatInfo(g, Name, "XmlDB", ""); XmlDB = Cat->GetStringCatInfo(g, "XmlDB", "");
Nslist = Cat->GetStringCatInfo(g, Name, "Nslist", ""); Nslist = Cat->GetStringCatInfo(g, "Nslist", "");
DefNs = Cat->GetStringCatInfo(g, Name, "DefNs", ""); DefNs = Cat->GetStringCatInfo(g, "DefNs", "");
Limit = Cat->GetIntCatInfo(Name, "Limit", 2); Limit = Cat->GetIntCatInfo("Limit", 2);
Xpand = (Cat->GetIntCatInfo(Name, "Expand", 0) != 0); Xpand = (Cat->GetIntCatInfo("Expand", 0) != 0);
Header = Cat->GetIntCatInfo(Name, "Header", 0); Header = Cat->GetIntCatInfo("Header", 0);
Cat->GetCharCatInfo(Name, "Xmlsup", "*", buf, sizeof(buf)); Cat->GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
if (*buf == '*') // Try the old (deprecated) option //if (*buf == '*') // Try the old (deprecated) option
Cat->GetCharCatInfo(Name, "Method", "*", buf, sizeof(buf)); // Cat->GetCharCatInfo("Method", "*", buf, sizeof(buf));
if (*buf == '*') // Is there a default for the database? //if (*buf == '*') // Is there a default for the database?
Cat->GetCharCatInfo("Database", "Defxml", XMLSUP, // Cat->GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
buf, sizeof(buf));
// Note that if no support is specified, the default is MS-DOM // Note that if no support is specified, the default is MS-DOM
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D'); // on Windows and libxml2 otherwise
if (*buf == '*')
#if defined(WIN32)
Usedom = true;
#else // !WIN32
Usedom = false;
#endif // !WIN32
else
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D');
// Get eventual table node attribute // Get eventual table node attribute
Attrib = Cat->GetStringCatInfo(g, Name, "Attribute", ""); Attrib = Cat->GetStringCatInfo(g, "Attribute", "");
Hdattr = Cat->GetStringCatInfo(g, Name, "HeadAttr", ""); Hdattr = Cat->GetStringCatInfo(g, "HeadAttr", "");
return false; return false;
} // end of DefineAM } // end of DefineAM
......
...@@ -723,7 +723,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp) ...@@ -723,7 +723,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
return true; return true;
} // endswitch Ftype } // endswitch Ftype
if (dup->Catalog->GetSepIndex()) { if (dup->Catalog->GetBoolCatInfo("SepIndex", false)) {
// Index is saved in a separate file // Index is saved in a separate file
#if !defined(UNIX) #if !defined(UNIX)
char drive[_MAX_DRIVE]; char drive[_MAX_DRIVE];
......
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