mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
- In info, the file length sometimes could not be caculated because the
catalog data path had not been set. This was added into ha_connect::info. modified: storage/connect/ha_connect.cc - All the functions querying table options could return information from the wrong table when several CONNECT tables were used in the same query (for instance joined together) This was because they belonged to the catalog class that is shared between all tables in the same query. They have been moved from the catalog class to the TABDEF/RELDEF class that is attached to each table. This was a major potential bug. modified: storage/connect/catalog.h storage/connect/filamvct.cpp storage/connect/filamzip.cpp 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/taboccur.cpp storage/connect/tabodbc.cpp storage/connect/tabpivot.cpp storage/connect/tabsys.cpp storage/connect/tabtbl.cpp storage/connect/tabutil.cpp storage/connect/tabvct.cpp storage/connect/tabwmi.cpp storage/connect/tabxcl.cpp storage/connect/tabxml.cpp storage/connect/xindex.cpp - Prepare indexing of MYSQL/ODBC tables (as does FEDERATED) (Not implemented yet) modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/mycat.cc storage/connect/mycat.h - Typo modified: storage/connect/plgdbutl.cpp
This commit is contained in:
@ -71,16 +71,6 @@ class DllExport CATALOG {
|
||||
// Methods
|
||||
virtual void Reset(void) {}
|
||||
virtual void SetDataPath(PGLOBAL g, const char *path) {}
|
||||
virtual bool GetBoolCatInfo(PSZ what, bool bdef) {return bdef;}
|
||||
virtual bool SetIntCatInfo(PSZ what, int ival) {return false;}
|
||||
virtual int GetIntCatInfo(PSZ what, int idef) {return idef;}
|
||||
virtual int GetSizeCatInfo(PSZ what, PSZ sdef) {return 0;}
|
||||
virtual int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size)
|
||||
{strncpy(buf, sdef, size); return size;}
|
||||
virtual char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
|
||||
{return sdef;}
|
||||
virtual int GetColCatInfo(PGLOBAL g, PTABDEF defp) {return -1;}
|
||||
virtual bool GetIndexInfo(PGLOBAL g, PTABDEF defp) {return true;}
|
||||
virtual bool CheckName(PGLOBAL g, char *name) {return true;}
|
||||
virtual bool ClearName(PGLOBAL g, PSZ name) {return true;}
|
||||
virtual PRELDEF MakeOneTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) {return NULL;}
|
||||
|
@ -1093,13 +1093,12 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last)
|
||||
// Update catalog values for Block and Last
|
||||
PVCTDEF defp = (PVCTDEF)Tdbp->GetDef();
|
||||
LPCSTR name = Tdbp->GetName();
|
||||
PCATLG cat = PlgGetCatalog(g);
|
||||
|
||||
defp->SetBlock(Block);
|
||||
defp->SetLast(Last);
|
||||
|
||||
if (!cat->SetIntCatInfo("Blocks", Block) ||
|
||||
!cat->SetIntCatInfo("Last", Last)) {
|
||||
if (!defp->SetIntCatInfo("Blocks", Block) ||
|
||||
!defp->SetIntCatInfo("Last", Last)) {
|
||||
sprintf(g->Message, MSG(UPDATE_ERROR), "Header");
|
||||
rc = true;
|
||||
} // endif
|
||||
|
@ -543,13 +543,12 @@ int ZBKFAM::DeleteRecords(PGLOBAL g, int irc)
|
||||
if (irc == RC_EF) {
|
||||
LPCSTR name = Tdbp->GetName();
|
||||
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
|
||||
PCATLG cat = PlgGetCatalog(g);
|
||||
|
||||
defp->SetBlock(0);
|
||||
defp->SetLast(Nrec);
|
||||
|
||||
if (!cat->SetIntCatInfo("Blocks", 0) ||
|
||||
!cat->SetIntCatInfo("Last", 0)) {
|
||||
if (!defp->SetIntCatInfo("Blocks", 0) ||
|
||||
!defp->SetIntCatInfo("Last", 0)) {
|
||||
sprintf(g->Message, MSG(UPDATE_ERROR), "Header");
|
||||
return RC_FX;
|
||||
} else
|
||||
@ -568,7 +567,6 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
|
||||
int rc = RC_OK;
|
||||
|
||||
if (Tdbp->GetMode() == MODE_INSERT) {
|
||||
PCATLG cat = PlgGetCatalog(g);
|
||||
LPCSTR name = Tdbp->GetName();
|
||||
PDOSDEF defp = (PDOSDEF)Tdbp->GetDef();
|
||||
|
||||
@ -587,8 +585,8 @@ void ZBKFAM::CloseTableFile(PGLOBAL g)
|
||||
if (rc != RC_FX) {
|
||||
defp->SetBlock(Block);
|
||||
defp->SetLast(Last);
|
||||
cat->SetIntCatInfo("Blocks", Block);
|
||||
cat->SetIntCatInfo("Last", Last);
|
||||
defp->SetIntCatInfo("Blocks", Block);
|
||||
defp->SetIntCatInfo("Last", Last);
|
||||
} // endif
|
||||
|
||||
gzclose(Zfile);
|
||||
|
@ -619,10 +619,16 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
|
||||
/****************************************************************************/
|
||||
TABTYPE ha_connect::GetRealType(PTOS pos)
|
||||
{
|
||||
TABTYPE type= GetTypeID(pos->type);
|
||||
TABTYPE type;
|
||||
|
||||
if (pos || (pos= GetTableOptionStruct(table))) {
|
||||
type= GetTypeID(pos->type);
|
||||
|
||||
if (type == TAB_UNDEF)
|
||||
type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS;
|
||||
if (type == TAB_UNDEF)
|
||||
type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS;
|
||||
|
||||
} else
|
||||
type= TAB_UNDEF;
|
||||
|
||||
return type;
|
||||
} // end of GetRealType
|
||||
@ -2802,12 +2808,21 @@ int ha_connect::info(uint flag)
|
||||
if (!valid_info) {
|
||||
// tdbp must be available to get updated info
|
||||
if (xp->CheckQuery(valid_query_id) || !tdbp) {
|
||||
PDBUSER dup= PlgGetUser(g);
|
||||
PCATLG cat= (dup) ? dup->Catalog : NULL;
|
||||
|
||||
if (xmod == MODE_ANY || xmod == MODE_ALTER) {
|
||||
// Pure info, not a query
|
||||
pure= true;
|
||||
xp->CheckCleanup();
|
||||
} // endif xmod
|
||||
|
||||
// This is necessary for getting file length
|
||||
if (cat && table)
|
||||
cat->SetDataPath(g, table->s->db.str);
|
||||
else
|
||||
return HA_ERR_INTERNAL_ERROR; // Should never happen
|
||||
|
||||
tdbp= GetTDB(g);
|
||||
} // endif tdbp
|
||||
|
||||
@ -4796,7 +4811,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
||||
|
||||
// Get the index definitions
|
||||
if (xdp= GetIndexInfo()) {
|
||||
if (IsTypeIndexable(type)) {
|
||||
if (GetIndexType(type) == 1) {
|
||||
PDBUSER dup= PlgGetUser(g);
|
||||
PCATLG cat= (dup) ? dup->Catalog : NULL;
|
||||
|
||||
@ -4812,7 +4827,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
||||
|
||||
} // endif cat
|
||||
|
||||
} else {
|
||||
} else if (!GetIndexType(type)) {
|
||||
sprintf(g->Message, "Table type %s is not indexable", options->type);
|
||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||
rc= HA_ERR_UNSUPPORTED;
|
||||
@ -5106,35 +5121,36 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table,
|
||||
if (ha_alter_info->handler_flags & index_operations ||
|
||||
!SameString(altered_table, "optname") ||
|
||||
!SameBool(altered_table, "sepindex")) {
|
||||
if (!IsTypeIndexable(type)) {
|
||||
if (GetIndexType(type) == 1) {
|
||||
g->Xchk= new(g) XCHK;
|
||||
PCHK xcp= (PCHK)g->Xchk;
|
||||
|
||||
xcp->oldpix= GetIndexInfo(table->s);
|
||||
xcp->newpix= GetIndexInfo(altered_table->s);
|
||||
xcp->oldsep= GetBooleanOption("sepindex", false);
|
||||
xcp->oldsep= xcp->SetName(g, GetStringOption("optname"));
|
||||
tshp= altered_table->s;
|
||||
xcp->newsep= GetBooleanOption("sepindex", false);
|
||||
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
|
||||
tshp= NULL;
|
||||
|
||||
if (xtrace && g->Xchk)
|
||||
htrc(
|
||||
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
||||
xcp->oldsep, xcp->newsep,
|
||||
SVP(xcp->oldopn), SVP(xcp->newopn),
|
||||
xcp->oldpix, xcp->newpix);
|
||||
|
||||
if (sqlcom == SQLCOM_ALTER_TABLE)
|
||||
idx= true;
|
||||
else
|
||||
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
|
||||
|
||||
} else if (!GetIndexType(type)) {
|
||||
sprintf(g->Message, "Table type %s is not indexable", oldopt->type);
|
||||
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
|
||||
DBUG_RETURN(HA_ALTER_ERROR);
|
||||
} // endif Indexable
|
||||
|
||||
g->Xchk= new(g) XCHK;
|
||||
PCHK xcp= (PCHK)g->Xchk;
|
||||
|
||||
xcp->oldpix= GetIndexInfo(table->s);
|
||||
xcp->newpix= GetIndexInfo(altered_table->s);
|
||||
xcp->oldsep= GetBooleanOption("sepindex", false);
|
||||
xcp->oldsep= xcp->SetName(g, GetStringOption("optname"));
|
||||
tshp= altered_table->s;
|
||||
xcp->newsep= GetBooleanOption("sepindex", false);
|
||||
xcp->newsep= xcp->SetName(g, GetStringOption("optname"));
|
||||
tshp= NULL;
|
||||
|
||||
if (xtrace && g->Xchk)
|
||||
htrc(
|
||||
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n",
|
||||
xcp->oldsep, xcp->newsep,
|
||||
SVP(xcp->oldopn), SVP(xcp->newopn),
|
||||
xcp->oldpix, xcp->newpix);
|
||||
|
||||
if (sqlcom == SQLCOM_ALTER_TABLE)
|
||||
idx= true;
|
||||
else
|
||||
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
|
||||
} // endif index type
|
||||
|
||||
} // endif index operation
|
||||
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
// CONNECT Implementation
|
||||
static bool connect_init(void);
|
||||
static bool connect_end(void);
|
||||
TABTYPE GetRealType(PTOS pos);
|
||||
TABTYPE GetRealType(PTOS pos= NULL);
|
||||
char *GetStringOption(char *opname, char *sdef= NULL);
|
||||
PTOS GetTableOptionStruct(TABLE *table_arg);
|
||||
bool GetBooleanOption(char *opname, bool bdef);
|
||||
|
@ -211,7 +211,7 @@ bool IsTypeNullable(TABTYPE type)
|
||||
} // end of IsTypeNullable
|
||||
|
||||
/***********************************************************************/
|
||||
/* Return true for table types with fix length records. */
|
||||
/* Return true for indexable table by XINDEX. */
|
||||
/***********************************************************************/
|
||||
bool IsTypeFixed(TABTYPE type)
|
||||
{
|
||||
@ -233,7 +233,7 @@ bool IsTypeFixed(TABTYPE type)
|
||||
} // end of IsTypeFixed
|
||||
|
||||
/***********************************************************************/
|
||||
/* Return true for table types with fix length records. */
|
||||
/* Return true for table indexable by XINDEX. */
|
||||
/***********************************************************************/
|
||||
bool IsTypeIndexable(TABTYPE type)
|
||||
{
|
||||
@ -257,6 +257,35 @@ bool IsTypeIndexable(TABTYPE type)
|
||||
return idx;
|
||||
} // end of IsTypeIndexable
|
||||
|
||||
/***********************************************************************/
|
||||
/* Return index type: 0 NO, 1 XINDEX, 2 REMOTE. */
|
||||
/***********************************************************************/
|
||||
int GetIndexType(TABTYPE type)
|
||||
{
|
||||
int xtyp;
|
||||
|
||||
switch (type) {
|
||||
case TAB_DOS:
|
||||
case TAB_CSV:
|
||||
case TAB_FMT:
|
||||
case TAB_FIX:
|
||||
case TAB_BIN:
|
||||
case TAB_VEC:
|
||||
case TAB_DBF:
|
||||
xtyp= 1;
|
||||
break;
|
||||
case TAB_MYSQL:
|
||||
case TAB_ODBC:
|
||||
// xtyp= 2; Remote indexes not implemented yet
|
||||
// break;
|
||||
default:
|
||||
xtyp= 0;
|
||||
break;
|
||||
} // endswitch type
|
||||
|
||||
return xtyp;
|
||||
} // end of GetIndexType
|
||||
|
||||
/***********************************************************************/
|
||||
/* Get a unique enum catalog function ID. */
|
||||
/***********************************************************************/
|
||||
@ -434,281 +463,6 @@ void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
|
||||
|
||||
} // end of SetDataPath
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function sets an integer MYCAT information. */
|
||||
/***********************************************************************/
|
||||
bool MYCAT::SetIntCatInfo(PSZ what, int n)
|
||||
{
|
||||
return Hc->SetIntegerOption(what, n);
|
||||
} // end of SetIntCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns integer MYCAT information. */
|
||||
/***********************************************************************/
|
||||
int MYCAT::GetIntCatInfo(PSZ what, int idef)
|
||||
{
|
||||
int n= Hc->GetIntegerOption(what);
|
||||
|
||||
return (n == NO_IVAL) ? idef : n;
|
||||
} // end of GetIntCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns Boolean MYCAT information. */
|
||||
/***********************************************************************/
|
||||
bool MYCAT::GetBoolCatInfo(PSZ what, bool bdef)
|
||||
{
|
||||
bool b= Hc->GetBooleanOption(what, bdef);
|
||||
|
||||
return b;
|
||||
} // end of GetBoolCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns size catalog information. */
|
||||
/***********************************************************************/
|
||||
int MYCAT::GetSizeCatInfo(PSZ what, PSZ sdef)
|
||||
{
|
||||
char * s, c;
|
||||
int i, n= 0;
|
||||
|
||||
if (!(s= Hc->GetStringOption(what)))
|
||||
s= sdef;
|
||||
|
||||
if ((i= sscanf(s, " %d %c ", &n, &c)) == 2)
|
||||
switch (toupper(c)) {
|
||||
case 'M':
|
||||
n *= 1024;
|
||||
case 'K':
|
||||
n *= 1024;
|
||||
} // endswitch c
|
||||
|
||||
return n;
|
||||
} // end of GetSizeCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function sets char MYCAT information in buf. */
|
||||
/***********************************************************************/
|
||||
int MYCAT::GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size)
|
||||
{
|
||||
char *s= Hc->GetStringOption(what);
|
||||
|
||||
strncpy(buf, ((s) ? s : sdef), size);
|
||||
return size;
|
||||
} // end of GetCharCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns string MYCAT information. */
|
||||
/* Default parameter is "*" to get the handler default. */
|
||||
/***********************************************************************/
|
||||
char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
|
||||
{
|
||||
char *sval= NULL, *s= Hc->GetStringOption(what, sdef);
|
||||
|
||||
if (s) {
|
||||
sval= (char*)PlugSubAlloc(g, NULL, strlen(s) + 1);
|
||||
strcpy(sval, s);
|
||||
} else if (!stricmp(what, "filename")) {
|
||||
// Return default file name
|
||||
char *ftype= Hc->GetStringOption("Type", "*");
|
||||
int i, n;
|
||||
|
||||
if (IsFileType(GetTypeID(ftype))) {
|
||||
sval= (char*)PlugSubAlloc(g, NULL, strlen(Hc->GetTableName()) + 12);
|
||||
strcat(strcpy(sval, Hc->GetTableName()), ".");
|
||||
n= strlen(sval);
|
||||
|
||||
// Fold ftype to lower case
|
||||
for (i= 0; i < 12; i++)
|
||||
if (!ftype[i]) {
|
||||
sval[n+i]= 0;
|
||||
break;
|
||||
} else
|
||||
sval[n+i]= tolower(ftype[i]);
|
||||
|
||||
} // endif FileType
|
||||
|
||||
} // endif s
|
||||
|
||||
return sval;
|
||||
} // end of GetStringCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns column MYCAT information. */
|
||||
/***********************************************************************/
|
||||
int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp)
|
||||
{
|
||||
char *type= GetStringCatInfo(g, "Type", "*");
|
||||
int i, loff, poff, nof, nlg;
|
||||
void *field= NULL;
|
||||
TABTYPE tc;
|
||||
PCOLDEF cdp, lcdp= NULL, tocols= NULL;
|
||||
PCOLINFO pcf= (PCOLINFO)PlugSubAlloc(g, NULL, sizeof(COLINFO));
|
||||
|
||||
memset(pcf, 0, sizeof(COLINFO));
|
||||
|
||||
// Get a unique char identifier for type
|
||||
tc= (defp->Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX;
|
||||
|
||||
// Take care of the column definitions
|
||||
i= poff= nof= nlg= 0;
|
||||
|
||||
// Offsets of HTML and DIR tables start from 0, DBF at 1
|
||||
loff= (tc == TAB_DBF) ? 1 : (tc == TAB_XML || tc == TAB_DIR) ? -1 : 0;
|
||||
|
||||
while (true) {
|
||||
// Default Offset depends on table type
|
||||
switch (tc) {
|
||||
case TAB_DOS:
|
||||
case TAB_FIX:
|
||||
case TAB_BIN:
|
||||
case TAB_VEC:
|
||||
case TAB_DBF:
|
||||
poff= loff + nof; // Default next offset
|
||||
nlg= max(nlg, poff); // Default lrecl
|
||||
break;
|
||||
case TAB_CSV:
|
||||
case TAB_FMT:
|
||||
nlg+= nof;
|
||||
case TAB_DIR:
|
||||
case TAB_XML:
|
||||
poff= loff + 1;
|
||||
break;
|
||||
case TAB_INI:
|
||||
case TAB_MAC:
|
||||
case TAB_TBL:
|
||||
case TAB_XCL:
|
||||
case TAB_OCCUR:
|
||||
case TAB_PRX:
|
||||
case TAB_OEM:
|
||||
poff = 0; // Offset represents an independant flag
|
||||
break;
|
||||
default: // VCT PLG ODBC MYSQL WMI...
|
||||
poff = 0; // NA
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
// do {
|
||||
field= Hc->GetColumnOption(g, field, pcf);
|
||||
// } while (field && (*pcf->Name =='*' /*|| pcf->Flags & U_VIRTUAL*/));
|
||||
|
||||
if (tc == TAB_DBF && pcf->Type == TYPE_DATE && !pcf->Datefmt) {
|
||||
// DBF date format defaults to 'YYYMMDD'
|
||||
pcf->Datefmt= "YYYYMMDD";
|
||||
pcf->Length= 8;
|
||||
} // endif tc
|
||||
|
||||
if (!field)
|
||||
break;
|
||||
|
||||
// Allocate the column description block
|
||||
cdp= new(g) COLDEF;
|
||||
|
||||
if ((nof= cdp->Define(g, NULL, pcf, poff)) < 0)
|
||||
return -1; // Error, probably unhandled type
|
||||
else if (nof)
|
||||
loff= cdp->GetOffset();
|
||||
|
||||
switch (tc) {
|
||||
case TAB_VEC:
|
||||
cdp->SetOffset(0); // Not to have shift
|
||||
case TAB_BIN:
|
||||
// BIN/VEC are packed by default
|
||||
if (nof)
|
||||
// Field width is the internal representation width
|
||||
// that can also depend on the column format
|
||||
switch (cdp->Fmt ? *cdp->Fmt : 'X') {
|
||||
case 'C': break;
|
||||
case 'R':
|
||||
case 'F':
|
||||
case 'L':
|
||||
case 'I': nof= 4; break;
|
||||
case 'D': nof= 8; break;
|
||||
case 'S': nof= 2; break;
|
||||
case 'T': nof= 1; break;
|
||||
default: nof= cdp->Clen;
|
||||
} // endswitch Fmt
|
||||
|
||||
default:
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
if (lcdp)
|
||||
lcdp->SetNext(cdp);
|
||||
else
|
||||
tocols= cdp;
|
||||
|
||||
lcdp= cdp;
|
||||
i++;
|
||||
} // endwhile
|
||||
|
||||
// Degree is the the number of defined columns (informational)
|
||||
if (i != defp->GetDegree())
|
||||
defp->SetDegree(i);
|
||||
|
||||
if (defp->GetDefType() == TYPE_AM_DOS) {
|
||||
int ending, recln= 0;
|
||||
PDOSDEF ddp= (PDOSDEF)defp;
|
||||
|
||||
// Was commented because sometimes ending is 0 even when
|
||||
// not specified (for instance if quoted is specified)
|
||||
// if ((ending= Hc->GetIntegerOption("Ending")) < 0) {
|
||||
if ((ending= Hc->GetIntegerOption("Ending")) <= 0) {
|
||||
#if defined(WIN32)
|
||||
ending= 2;
|
||||
#else
|
||||
ending= 1;
|
||||
#endif
|
||||
Hc->SetIntegerOption("Ending", ending);
|
||||
} // endif ending
|
||||
|
||||
// Calculate the default record size
|
||||
switch (tc) {
|
||||
case TAB_FIX:
|
||||
recln= nlg + ending; // + length of line ending
|
||||
break;
|
||||
case TAB_BIN:
|
||||
case TAB_VEC:
|
||||
recln= nlg;
|
||||
|
||||
// if ((k= (pak < 0) ? 8 : pak) > 1)
|
||||
// See above for detailed comment
|
||||
// Round up lrecl to multiple of 8 or pak
|
||||
// recln= ((recln + k - 1) / k) * k;
|
||||
|
||||
break;
|
||||
case TAB_DOS:
|
||||
case TAB_DBF:
|
||||
recln= nlg;
|
||||
break;
|
||||
case TAB_CSV:
|
||||
case TAB_FMT:
|
||||
// The number of separators (assuming an extra one can exist)
|
||||
// recln= poff * ((qotd) ? 3 : 1); to be investigated
|
||||
recln= nlg + poff * 3; // To be safe
|
||||
default:
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
// lrecl must be at least recln to avoid buffer overflow
|
||||
recln= max(recln, Hc->GetIntegerOption("Lrecl"));
|
||||
Hc->SetIntegerOption("Lrecl", recln);
|
||||
ddp->SetLrecl(recln);
|
||||
} // endif Lrecl
|
||||
|
||||
// Attach the column definition to the tabdef
|
||||
defp->SetCols(tocols);
|
||||
return poff;
|
||||
} // end of GetColCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetIndexInfo: retrieve index description from the table structure. */
|
||||
/***********************************************************************/
|
||||
bool MYCAT::GetIndexInfo(PGLOBAL g, PTABDEF defp)
|
||||
{
|
||||
// Attach new index(es)
|
||||
defp->SetIndx(Hc->GetIndexInfo());
|
||||
return false;
|
||||
} // end of GetIndexInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetTableDesc: retrieve a table descriptor. */
|
||||
/* Look for a table descriptor matching the name and type. */
|
||||
|
@ -40,6 +40,7 @@ bool IsExactType(TABTYPE type);
|
||||
bool IsTypeNullable(TABTYPE type);
|
||||
bool IsTypeFixed(TABTYPE type);
|
||||
bool IsTypeIndexable(TABTYPE type);
|
||||
int GetIndexType(TABTYPE type);
|
||||
uint GetFuncID(const char *func);
|
||||
|
||||
/***********************************************************************/
|
||||
@ -57,14 +58,6 @@ class MYCAT : public CATALOG {
|
||||
void Reset(void);
|
||||
void SetDataPath(PGLOBAL g, const char *path)
|
||||
{SetPath(g, &DataPath, path);}
|
||||
bool GetBoolCatInfo(PSZ what, bool bdef);
|
||||
bool SetIntCatInfo(PSZ what, int ival);
|
||||
int GetIntCatInfo(PSZ what, int idef);
|
||||
int GetSizeCatInfo(PSZ what, PSZ sdef);
|
||||
int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size);
|
||||
char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef);
|
||||
int GetColCatInfo(PGLOBAL g, PTABDEF defp);
|
||||
bool GetIndexInfo(PGLOBAL g, PTABDEF defp);
|
||||
bool StoreIndex(PGLOBAL g, PTABDEF defp) {return false;} // Temporary
|
||||
PRELDEF GetTableDesc(PGLOBAL g, LPCSTR name,
|
||||
LPCSTR type, PRELDEF *prp = NULL);
|
||||
|
@ -383,7 +383,7 @@ PCATLG PlgGetCatalog(PGLOBAL g, bool jump)
|
||||
} // end of PlgGetCatalog
|
||||
|
||||
/***********************************************************************/
|
||||
/* PlgGetCatalog: returns CATALOG class pointer. */
|
||||
/* PlgGetDataPath: returns the default data path. */
|
||||
/***********************************************************************/
|
||||
char *PlgGetDataPath(PGLOBAL g)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "osutil.h"
|
||||
//#include "sqlext.h"
|
||||
#endif
|
||||
#include "handler.h"
|
||||
|
||||
/***********************************************************************/
|
||||
/* Include application header files */
|
||||
@ -46,6 +47,7 @@
|
||||
#include "tabdos.h"
|
||||
#include "valblk.h"
|
||||
#include "tabmul.h"
|
||||
#include "ha_connect.h"
|
||||
|
||||
|
||||
/* --------------------------- Class RELDEF -------------------------- */
|
||||
@ -60,8 +62,106 @@ RELDEF::RELDEF(void)
|
||||
Name = NULL;
|
||||
Database = NULL;
|
||||
Cat = NULL;
|
||||
Hc = NULL;
|
||||
} // end of RELDEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function sets an integer table information. */
|
||||
/***********************************************************************/
|
||||
bool RELDEF::SetIntCatInfo(PSZ what, int n)
|
||||
{
|
||||
return Hc->SetIntegerOption(what, n);
|
||||
} // end of SetIntCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns integer table information. */
|
||||
/***********************************************************************/
|
||||
int RELDEF::GetIntCatInfo(PSZ what, int idef)
|
||||
{
|
||||
int n= Hc->GetIntegerOption(what);
|
||||
|
||||
return (n == NO_IVAL) ? idef : n;
|
||||
} // end of GetIntCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns Boolean table information. */
|
||||
/***********************************************************************/
|
||||
bool RELDEF::GetBoolCatInfo(PSZ what, bool bdef)
|
||||
{
|
||||
bool b= Hc->GetBooleanOption(what, bdef);
|
||||
|
||||
return b;
|
||||
} // end of GetBoolCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns size catalog information. */
|
||||
/***********************************************************************/
|
||||
int RELDEF::GetSizeCatInfo(PSZ what, PSZ sdef)
|
||||
{
|
||||
char * s, c;
|
||||
int i, n= 0;
|
||||
|
||||
if (!(s= Hc->GetStringOption(what)))
|
||||
s= sdef;
|
||||
|
||||
if ((i= sscanf(s, " %d %c ", &n, &c)) == 2)
|
||||
switch (toupper(c)) {
|
||||
case 'M':
|
||||
n *= 1024;
|
||||
case 'K':
|
||||
n *= 1024;
|
||||
} // endswitch c
|
||||
|
||||
return n;
|
||||
} // end of GetSizeCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function sets char table information in buf. */
|
||||
/***********************************************************************/
|
||||
int RELDEF::GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size)
|
||||
{
|
||||
char *s= Hc->GetStringOption(what);
|
||||
|
||||
strncpy(buf, ((s) ? s : sdef), size);
|
||||
return size;
|
||||
} // end of GetCharCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns string table information. */
|
||||
/* Default parameter is "*" to get the handler default. */
|
||||
/***********************************************************************/
|
||||
char *RELDEF::GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
|
||||
{
|
||||
char *sval= NULL, *s= Hc->GetStringOption(what, sdef);
|
||||
|
||||
if (s) {
|
||||
sval= (char*)PlugSubAlloc(g, NULL, strlen(s) + 1);
|
||||
strcpy(sval, s);
|
||||
} else if (!stricmp(what, "filename")) {
|
||||
// Return default file name
|
||||
char *ftype= Hc->GetStringOption("Type", "*");
|
||||
int i, n;
|
||||
|
||||
if (IsFileType(GetTypeID(ftype))) {
|
||||
sval= (char*)PlugSubAlloc(g, NULL, strlen(Hc->GetTableName()) + 12);
|
||||
strcat(strcpy(sval, Hc->GetTableName()), ".");
|
||||
n= strlen(sval);
|
||||
|
||||
// Fold ftype to lower case
|
||||
for (i= 0; i < 12; i++)
|
||||
if (!ftype[i]) {
|
||||
sval[n+i]= 0;
|
||||
break;
|
||||
} else
|
||||
sval[n+i]= tolower(ftype[i]);
|
||||
|
||||
} // endif FileType
|
||||
|
||||
} // endif s
|
||||
|
||||
return sval;
|
||||
} // end of GetStringCatInfo
|
||||
|
||||
/* --------------------------- Class TABDEF -------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
@ -91,24 +191,201 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
|
||||
Name = (PSZ)PlugSubAlloc(g, NULL, strlen(name) + 1);
|
||||
strcpy(Name, name);
|
||||
Cat = cat;
|
||||
Catfunc = GetFuncID(Cat->GetStringCatInfo(g, "Catfunc", NULL));
|
||||
Elemt = cat->GetIntCatInfo("Elements", 0);
|
||||
Multiple = cat->GetIntCatInfo("Multiple", 0);
|
||||
Degree = cat->GetIntCatInfo("Degree", 0);
|
||||
Read_Only = cat->GetBoolCatInfo("ReadOnly", false);
|
||||
const char *data_charset_name= cat->GetStringCatInfo(g, "Data_charset", NULL);
|
||||
Hc = ((MYCAT*)cat)->GetHandler();
|
||||
Catfunc = GetFuncID(GetStringCatInfo(g, "Catfunc", NULL));
|
||||
Elemt = GetIntCatInfo("Elements", 0);
|
||||
Multiple = GetIntCatInfo("Multiple", 0);
|
||||
Degree = GetIntCatInfo("Degree", 0);
|
||||
Read_Only = GetBoolCatInfo("ReadOnly", false);
|
||||
const char *data_charset_name= GetStringCatInfo(g, "Data_charset", NULL);
|
||||
m_data_charset= data_charset_name ?
|
||||
get_charset_by_csname(data_charset_name, MY_CS_PRIMARY, 0):
|
||||
NULL;
|
||||
|
||||
// Get The column definitions
|
||||
if ((poff = cat->GetColCatInfo(g, this)) < 0)
|
||||
if ((poff = GetColCatInfo(g)) < 0)
|
||||
return true;
|
||||
|
||||
// Do the definition of AM specific fields
|
||||
return DefineAM(g, am, poff);
|
||||
} // end of Define
|
||||
|
||||
/***********************************************************************/
|
||||
/* This function returns column table information. */
|
||||
/***********************************************************************/
|
||||
int TABDEF::GetColCatInfo(PGLOBAL g)
|
||||
{
|
||||
char *type= GetStringCatInfo(g, "Type", "*");
|
||||
int i, loff, poff, nof, nlg;
|
||||
void *field= NULL;
|
||||
TABTYPE tc;
|
||||
PCOLDEF cdp, lcdp= NULL, tocols= NULL;
|
||||
PCOLINFO pcf= (PCOLINFO)PlugSubAlloc(g, NULL, sizeof(COLINFO));
|
||||
|
||||
memset(pcf, 0, sizeof(COLINFO));
|
||||
|
||||
// Get a unique char identifier for type
|
||||
tc= (Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX;
|
||||
|
||||
// Take care of the column definitions
|
||||
i= poff= nof= nlg= 0;
|
||||
|
||||
// Offsets of HTML and DIR tables start from 0, DBF at 1
|
||||
loff= (tc == TAB_DBF) ? 1 : (tc == TAB_XML || tc == TAB_DIR) ? -1 : 0;
|
||||
|
||||
while (true) {
|
||||
// Default Offset depends on table type
|
||||
switch (tc) {
|
||||
case TAB_DOS:
|
||||
case TAB_FIX:
|
||||
case TAB_BIN:
|
||||
case TAB_VEC:
|
||||
case TAB_DBF:
|
||||
poff= loff + nof; // Default next offset
|
||||
nlg= max(nlg, poff); // Default lrecl
|
||||
break;
|
||||
case TAB_CSV:
|
||||
case TAB_FMT:
|
||||
nlg+= nof;
|
||||
case TAB_DIR:
|
||||
case TAB_XML:
|
||||
poff= loff + 1;
|
||||
break;
|
||||
case TAB_INI:
|
||||
case TAB_MAC:
|
||||
case TAB_TBL:
|
||||
case TAB_XCL:
|
||||
case TAB_OCCUR:
|
||||
case TAB_PRX:
|
||||
case TAB_OEM:
|
||||
poff = 0; // Offset represents an independant flag
|
||||
break;
|
||||
default: // VCT PLG ODBC MYSQL WMI...
|
||||
poff = 0; // NA
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
// do {
|
||||
field= Hc->GetColumnOption(g, field, pcf);
|
||||
// } while (field && (*pcf->Name =='*' /*|| pcf->Flags & U_VIRTUAL*/));
|
||||
|
||||
if (tc == TAB_DBF && pcf->Type == TYPE_DATE && !pcf->Datefmt) {
|
||||
// DBF date format defaults to 'YYYMMDD'
|
||||
pcf->Datefmt= "YYYYMMDD";
|
||||
pcf->Length= 8;
|
||||
} // endif tc
|
||||
|
||||
if (!field)
|
||||
break;
|
||||
|
||||
// Allocate the column description block
|
||||
cdp= new(g) COLDEF;
|
||||
|
||||
if ((nof= cdp->Define(g, NULL, pcf, poff)) < 0)
|
||||
return -1; // Error, probably unhandled type
|
||||
else if (nof)
|
||||
loff= cdp->GetOffset();
|
||||
|
||||
switch (tc) {
|
||||
case TAB_VEC:
|
||||
cdp->SetOffset(0); // Not to have shift
|
||||
case TAB_BIN:
|
||||
// BIN/VEC are packed by default
|
||||
if (nof)
|
||||
// Field width is the internal representation width
|
||||
// that can also depend on the column format
|
||||
switch (cdp->Fmt ? *cdp->Fmt : 'X') {
|
||||
case 'C': break;
|
||||
case 'R':
|
||||
case 'F':
|
||||
case 'L':
|
||||
case 'I': nof= 4; break;
|
||||
case 'D': nof= 8; break;
|
||||
case 'S': nof= 2; break;
|
||||
case 'T': nof= 1; break;
|
||||
default: nof= cdp->Clen;
|
||||
} // endswitch Fmt
|
||||
|
||||
default:
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
if (lcdp)
|
||||
lcdp->SetNext(cdp);
|
||||
else
|
||||
tocols= cdp;
|
||||
|
||||
lcdp= cdp;
|
||||
i++;
|
||||
} // endwhile
|
||||
|
||||
// Degree is the the number of defined columns (informational)
|
||||
if (i != GetDegree())
|
||||
SetDegree(i);
|
||||
|
||||
if (GetDefType() == TYPE_AM_DOS) {
|
||||
int ending, recln= 0;
|
||||
|
||||
// Was commented because sometimes ending is 0 even when
|
||||
// not specified (for instance if quoted is specified)
|
||||
// if ((ending= Hc->GetIntegerOption("Ending")) < 0) {
|
||||
if ((ending= Hc->GetIntegerOption("Ending")) <= 0) {
|
||||
#if defined(WIN32)
|
||||
ending= 2;
|
||||
#else
|
||||
ending= 1;
|
||||
#endif
|
||||
Hc->SetIntegerOption("Ending", ending);
|
||||
} // endif ending
|
||||
|
||||
// Calculate the default record size
|
||||
switch (tc) {
|
||||
case TAB_FIX:
|
||||
recln= nlg + ending; // + length of line ending
|
||||
break;
|
||||
case TAB_BIN:
|
||||
case TAB_VEC:
|
||||
recln= nlg;
|
||||
|
||||
// if ((k= (pak < 0) ? 8 : pak) > 1)
|
||||
// See above for detailed comment
|
||||
// Round up lrecl to multiple of 8 or pak
|
||||
// recln= ((recln + k - 1) / k) * k;
|
||||
|
||||
break;
|
||||
case TAB_DOS:
|
||||
case TAB_DBF:
|
||||
recln= nlg;
|
||||
break;
|
||||
case TAB_CSV:
|
||||
case TAB_FMT:
|
||||
// The number of separators (assuming an extra one can exist)
|
||||
// recln= poff * ((qotd) ? 3 : 1); to be investigated
|
||||
recln= nlg + poff * 3; // To be safe
|
||||
default:
|
||||
break;
|
||||
} // endswitch tc
|
||||
|
||||
// lrecl must be at least recln to avoid buffer overflow
|
||||
recln= max(recln, Hc->GetIntegerOption("Lrecl"));
|
||||
Hc->SetIntegerOption("Lrecl", recln);
|
||||
((PDOSDEF)this)->SetLrecl(recln);
|
||||
} // endif Lrecl
|
||||
|
||||
// Attach the column definition to the tabdef
|
||||
SetCols(tocols);
|
||||
return poff;
|
||||
} // end of GetColCatInfo
|
||||
|
||||
/***********************************************************************/
|
||||
/* SetIndexInfo: retrieve index description from the table structure. */
|
||||
/***********************************************************************/
|
||||
void TABDEF::SetIndexInfo(void)
|
||||
{
|
||||
// Attach new index(es)
|
||||
SetIndx(Hc->GetIndexInfo());
|
||||
} // end of SetIndexInfo
|
||||
|
||||
/* --------------------------- Class OEMDEF -------------------------- */
|
||||
|
||||
/***********************************************************************/
|
||||
@ -188,7 +465,7 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
|
||||
// Have the external class do its complete definition
|
||||
if (!cat->Cbuf) {
|
||||
// Suballocate a temporary buffer for the entire column section
|
||||
cat->Cblen = cat->GetSizeCatInfo("Colsize", "8K");
|
||||
cat->Cblen = GetSizeCatInfo("Colsize", "8K");
|
||||
cat->Cbuf = (char*)PlugSubAlloc(g, NULL, cat->Cblen);
|
||||
} // endif Cbuf
|
||||
|
||||
@ -218,8 +495,8 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Module = Cat->GetStringCatInfo(g, "Module", "");
|
||||
Subtype = Cat->GetStringCatInfo(g, "Subtype", Module);
|
||||
Module = GetStringCatInfo(g, "Module", "");
|
||||
Subtype = GetStringCatInfo(g, "Subtype", Module);
|
||||
|
||||
if (!*Module)
|
||||
Module = Subtype;
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include "catalog.h"
|
||||
#include "my_sys.h"
|
||||
|
||||
typedef class INDEXDEF *PIXDEF;
|
||||
typedef class INDEXDEF *PIXDEF;
|
||||
typedef class ha_connect *PHC;
|
||||
|
||||
/***********************************************************************/
|
||||
/* Table or View (relation) definition block. */
|
||||
@ -38,6 +39,12 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
|
||||
void SetCat(PCATLG cat) { Cat=cat; }
|
||||
|
||||
// Methods
|
||||
bool GetBoolCatInfo(PSZ what, bool bdef);
|
||||
bool SetIntCatInfo(PSZ what, int ival);
|
||||
int GetIntCatInfo(PSZ what, int idef);
|
||||
int GetSizeCatInfo(PSZ what, PSZ sdef);
|
||||
int GetCharCatInfo(PSZ what, PSZ sdef, char *buf, int size);
|
||||
char *GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef);
|
||||
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;
|
||||
@ -48,6 +55,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
|
||||
LPCSTR Database; /* Table database */
|
||||
PCOLDEF To_Cols; /* To a list of column desc */
|
||||
PCATLG Cat; /* To DB catalog info */
|
||||
PHC Hc; /* The Connect handler */
|
||||
}; // end of RELDEF
|
||||
|
||||
/***********************************************************************/
|
||||
@ -71,7 +79,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
|
||||
int GetPseudo(void) {return Pseudo;}
|
||||
PSZ GetPath(void)
|
||||
{return (Database) ? (PSZ)Database : Cat->GetDataPath();}
|
||||
bool SepIndex(void) {return Cat->GetBoolCatInfo("SepIndex", false);}
|
||||
bool SepIndex(void) {return GetBoolCatInfo("SepIndex", false);}
|
||||
bool IsReadOnly(void) {return Read_Only;}
|
||||
virtual AMT GetDefType(void) {return TYPE_AM_TAB;}
|
||||
virtual PIXDEF GetIndx(void) {return NULL;}
|
||||
@ -80,6 +88,8 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
|
||||
const CHARSET_INFO *data_charset() {return m_data_charset;}
|
||||
|
||||
// Methods
|
||||
int GetColCatInfo(PGLOBAL g);
|
||||
void SetIndexInfo(void);
|
||||
bool DropTable(PGLOBAL g, PSZ name);
|
||||
virtual bool Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am);
|
||||
virtual bool DefineAM(PGLOBAL, LPCSTR, int) = 0;
|
||||
@ -168,9 +178,7 @@ class DllExport COLCRT : public BLOCK { /* Column description block
|
||||
/* Column definition block. */
|
||||
/***********************************************************************/
|
||||
class DllExport COLDEF : public COLCRT { /* Column description block */
|
||||
friend class CATALOG;
|
||||
friend class PLUGCAT;
|
||||
friend class MYCAT;
|
||||
friend class TABDEF;
|
||||
friend class COLBLK;
|
||||
friend class DBFFAM;
|
||||
friend class TDBASE;
|
||||
|
@ -104,36 +104,37 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
: (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));
|
||||
Desc = Fn = GetStringCatInfo(g, "Filename", NULL);
|
||||
Ofn = GetStringCatInfo(g, "Optname", Fn);
|
||||
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);
|
||||
Lrecl = GetIntCatInfo("Lrecl", 0);
|
||||
|
||||
if (Recfm != RECFM_DBF)
|
||||
Compressed = Cat->GetIntCatInfo("Compressed", 0);
|
||||
Compressed = GetIntCatInfo("Compressed", 0);
|
||||
|
||||
Mapped = Cat->GetBoolCatInfo("Mapped", map);
|
||||
Block = Cat->GetIntCatInfo("Blocks", 0);
|
||||
Last = Cat->GetIntCatInfo("Last", 0);
|
||||
Ending = Cat->GetIntCatInfo("Ending", CRLF);
|
||||
Mapped = GetBoolCatInfo("Mapped", map);
|
||||
Block = GetIntCatInfo("Blocks", 0);
|
||||
Last = GetIntCatInfo("Last", 0);
|
||||
Ending = 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);
|
||||
Huge = GetBoolCatInfo("Huge", Cat->GetDefHuge());
|
||||
Padded = GetBoolCatInfo("Padded", false);
|
||||
Blksize = GetIntCatInfo("Blksize", 0);
|
||||
Eof = (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);
|
||||
Maxerr = GetIntCatInfo("Maxerr", 0);
|
||||
Accept = (GetIntCatInfo("Accept", 0) != 0);
|
||||
ReadMode = GetIntCatInfo("Readmode", 0);
|
||||
} else // (Recfm == RECFM_VAR)
|
||||
AvgLen = Cat->GetIntCatInfo("Avglen", 0);
|
||||
AvgLen = GetIntCatInfo("Avglen", 0);
|
||||
|
||||
// Ignore wrong Index definitions for catalog commands
|
||||
return (Cat->GetIndexInfo(g, this) /*&& !Cat->GetCatFnc()*/);
|
||||
SetIndexInfo();
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
||||
#if 0
|
||||
@ -190,7 +191,7 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf)
|
||||
return false; // No index
|
||||
|
||||
// If true indexes are in separate files
|
||||
sep = Cat->GetBoolCatInfo("SepIndex", false);
|
||||
sep = GetBoolCatInfo("SepIndex", false);
|
||||
|
||||
if (!sep && pxdf) {
|
||||
strcpy(g->Message, MSG(NO_RECOV_SPACE));
|
||||
@ -449,7 +450,6 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
||||
//PCOLDEF cdp;
|
||||
PXINDEX x;
|
||||
PXLOAD pxp;
|
||||
PCATLG cat = PlgGetCatalog(g);
|
||||
|
||||
Mode = MODE_READ;
|
||||
Use = USE_READY;
|
||||
@ -498,7 +498,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
|
||||
} // endfor kdp
|
||||
|
||||
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
|
||||
sep = cat->GetBoolCatInfo("SepIndex", false);
|
||||
sep = dfp->GetBoolCatInfo("SepIndex", false);
|
||||
|
||||
/*********************************************************************/
|
||||
/* Construct and save the defined indexes. */
|
||||
|
@ -415,10 +415,10 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
if (DOSDEF::DefineAM(g, "CSV", poff))
|
||||
return true;
|
||||
|
||||
Cat->GetCharCatInfo("Separator", ",", buf, sizeof(buf));
|
||||
GetCharCatInfo("Separator", ",", buf, sizeof(buf));
|
||||
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
|
||||
Quoted = Cat->GetIntCatInfo("Quoted", -1);
|
||||
Cat->GetCharCatInfo("Qchar", "", buf, sizeof(buf));
|
||||
Quoted = GetIntCatInfo("Quoted", -1);
|
||||
GetCharCatInfo("Qchar", "", buf, sizeof(buf));
|
||||
Qot = *buf;
|
||||
|
||||
if (Qot && Quoted < 0)
|
||||
@ -427,9 +427,9 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
Qot = '"';
|
||||
|
||||
Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f')));
|
||||
Header = (Cat->GetIntCatInfo("Header", 0) != 0);
|
||||
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
|
||||
Accept = (Cat->GetIntCatInfo("Accept", 0) != 0);
|
||||
Header = (GetIntCatInfo("Header", 0) != 0);
|
||||
Maxerr = GetIntCatInfo("Maxerr", 0);
|
||||
Accept = (GetIntCatInfo("Accept", 0) != 0);
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
||||
|
@ -591,9 +591,9 @@ void TDBMUL::CloseDB(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
bool DIRDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Desc = Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
|
||||
Incl = (Cat->GetIntCatInfo("Subdir", 0) != 0);
|
||||
Huge = (Cat->GetIntCatInfo("Huge", 0) != 0);
|
||||
Desc = Fn = GetStringCatInfo(g, "Filename", NULL);
|
||||
Incl = (GetIntCatInfo("Subdir", 0) != 0);
|
||||
Huge = (GetIntCatInfo("Huge", 0) != 0);
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
||||
|
@ -268,22 +268,22 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b)
|
||||
// For unspecified values, get the values of old style options
|
||||
// but only if called from MYSQLDEF, else set them to NULL
|
||||
Portnumber = (sport && sport[0]) ? atoi(sport)
|
||||
: (b) ? Cat->GetIntCatInfo("Port", GetDefaultPort()) : 0;
|
||||
: (b) ? GetIntCatInfo("Port", GetDefaultPort()) : 0;
|
||||
|
||||
if (Username[0] == 0)
|
||||
Username = (b) ? Cat->GetStringCatInfo(g, "User", "*") : NULL;
|
||||
Username = (b) ? GetStringCatInfo(g, "User", "*") : NULL;
|
||||
|
||||
if (Hostname[0] == 0)
|
||||
Hostname = (b) ? Cat->GetStringCatInfo(g, "Host", "localhost") : NULL;
|
||||
Hostname = (b) ? GetStringCatInfo(g, "Host", "localhost") : NULL;
|
||||
|
||||
if (!Database || !*Database)
|
||||
Database = (b) ? Cat->GetStringCatInfo(g, "Database", "*") : NULL;
|
||||
Database = (b) ? GetStringCatInfo(g, "Database", "*") : NULL;
|
||||
|
||||
if (!Tabname || !*Tabname)
|
||||
Tabname = (b) ? Cat->GetStringCatInfo(g, "Tabname", Name) : NULL;
|
||||
Tabname = (b) ? GetStringCatInfo(g, "Tabname", Name) : NULL;
|
||||
|
||||
if (!Password)
|
||||
Password = (b) ? Cat->GetStringCatInfo(g, "Password", NULL) : NULL;
|
||||
Password = (b) ? GetStringCatInfo(g, "Password", NULL) : NULL;
|
||||
} // endif URL
|
||||
|
||||
#if 0
|
||||
@ -308,37 +308,37 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
|
||||
if (stricmp(am, "MYPRX")) {
|
||||
// Normal case of specific MYSQL table
|
||||
url = Cat->GetStringCatInfo(g, "Connect", NULL);
|
||||
url = GetStringCatInfo(g, "Connect", NULL);
|
||||
|
||||
if (!url || !*url) {
|
||||
// Not using the connection URL
|
||||
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
|
||||
Database = Cat->GetStringCatInfo(g, "Database", "*");
|
||||
Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
|
||||
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Username = Cat->GetStringCatInfo(g, "User", "*");
|
||||
Password = Cat->GetStringCatInfo(g, "Password", NULL);
|
||||
Portnumber = Cat->GetIntCatInfo("Port", GetDefaultPort());
|
||||
Hostname = GetStringCatInfo(g, "Host", "localhost");
|
||||
Database = GetStringCatInfo(g, "Database", "*");
|
||||
Tabname = GetStringCatInfo(g, "Name", Name); // Deprecated
|
||||
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Username = GetStringCatInfo(g, "User", "*");
|
||||
Password = GetStringCatInfo(g, "Password", NULL);
|
||||
Portnumber = GetIntCatInfo("Port", GetDefaultPort());
|
||||
Server = Hostname;
|
||||
} else if (ParseURL(g, url))
|
||||
return true;
|
||||
|
||||
Bind = !!Cat->GetIntCatInfo("Bind", 0);
|
||||
Delayed = !!Cat->GetIntCatInfo("Delayed", 0);
|
||||
Bind = !!GetIntCatInfo("Bind", 0);
|
||||
Delayed = !!GetIntCatInfo("Delayed", 0);
|
||||
} else {
|
||||
// MYSQL access from a PROXY table
|
||||
Database = Cat->GetStringCatInfo(g, "Database", "*");
|
||||
Isview = Cat->GetBoolCatInfo("View", FALSE);
|
||||
Database = GetStringCatInfo(g, "Database", "*");
|
||||
Isview = GetBoolCatInfo("View", FALSE);
|
||||
|
||||
// We must get other connection parms from the calling table
|
||||
Remove_tshp(Cat);
|
||||
url = Cat->GetStringCatInfo(g, "Connect", NULL);
|
||||
url = GetStringCatInfo(g, "Connect", NULL);
|
||||
|
||||
if (!url || !*url) {
|
||||
Hostname = Cat->GetStringCatInfo(g, "Host", "localhost");
|
||||
Username = Cat->GetStringCatInfo(g, "User", "*");
|
||||
Password = Cat->GetStringCatInfo(g, "Password", NULL);
|
||||
Portnumber = Cat->GetIntCatInfo("Port", GetDefaultPort());
|
||||
Hostname = GetStringCatInfo(g, "Host", "localhost");
|
||||
Username = GetStringCatInfo(g, "User", "*");
|
||||
Password = GetStringCatInfo(g, "Password", NULL);
|
||||
Portnumber = GetIntCatInfo("Port", GetDefaultPort());
|
||||
Server = Hostname;
|
||||
} else {
|
||||
char *locdb = Database;
|
||||
@ -352,16 +352,16 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
Tabname = Name;
|
||||
} // endif am
|
||||
|
||||
if ((Srcdef = Cat->GetStringCatInfo(g, "Srcdef", NULL)))
|
||||
if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL)))
|
||||
Isview = true;
|
||||
|
||||
// Used for Update and Delete
|
||||
Qrystr = Cat->GetStringCatInfo(g, "Query_String", "?");
|
||||
Quoted = Cat->GetIntCatInfo("Quoted", 0);
|
||||
Qrystr = GetStringCatInfo(g, "Query_String", "?");
|
||||
Quoted = GetIntCatInfo("Quoted", 0);
|
||||
|
||||
// Specific for command executing tables
|
||||
Xsrc = Cat->GetBoolCatInfo("Execsrc", false);
|
||||
Mxr = Cat->GetIntCatInfo("Maxerr", 0);
|
||||
Xsrc = GetBoolCatInfo("Execsrc", false);
|
||||
Mxr = GetIntCatInfo("Maxerr", 0);
|
||||
return FALSE;
|
||||
} // end of DefineAM
|
||||
|
||||
|
@ -264,9 +264,9 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
|
||||
/***********************************************************************/
|
||||
bool OCCURDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Rcol = Cat->GetStringCatInfo(g, "RankCol", "");
|
||||
Colist = Cat->GetStringCatInfo(g, "Colist", "");
|
||||
Xcol = Cat->GetStringCatInfo(g, "OccurCol", Colist);
|
||||
Rcol = GetStringCatInfo(g, "RankCol", "");
|
||||
Colist = GetStringCatInfo(g, "Colist", "");
|
||||
Xcol = GetStringCatInfo(g, "OccurCol", Colist);
|
||||
return PRXDEF::DefineAM(g, am, poff);
|
||||
} // end of DefineAM
|
||||
|
||||
|
@ -100,22 +100,22 @@ ODBCDEF::ODBCDEF(void)
|
||||
/***********************************************************************/
|
||||
bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Desc = Connect = Cat->GetStringCatInfo(g, "Connect", "");
|
||||
Tabname = Cat->GetStringCatInfo(g, "Name",
|
||||
Desc = Connect = GetStringCatInfo(g, "Connect", "");
|
||||
Tabname = GetStringCatInfo(g, "Name",
|
||||
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
|
||||
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Tabschema = Cat->GetStringCatInfo(g, "Dbname", NULL);
|
||||
Tabschema = Cat->GetStringCatInfo(g, "Schema", Tabschema);
|
||||
Tabcat = Cat->GetStringCatInfo(g, "Qualifier", NULL);
|
||||
Tabcat = Cat->GetStringCatInfo(g, "Catalog", Tabcat);
|
||||
Srcdef = Cat->GetStringCatInfo(g, "Srcdef", NULL);
|
||||
Qrystr = Cat->GetStringCatInfo(g, "Query_String", "?");
|
||||
Sep = Cat->GetStringCatInfo(g, "Separator", NULL);
|
||||
Catver = Cat->GetIntCatInfo("Catver", 2);
|
||||
Xsrc = Cat->GetBoolCatInfo("Execsrc", FALSE);
|
||||
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
|
||||
Maxres = Cat->GetIntCatInfo("Maxres", 0);
|
||||
Quoted = Cat->GetIntCatInfo("Quoted", 0);
|
||||
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Tabschema = GetStringCatInfo(g, "Dbname", NULL);
|
||||
Tabschema = GetStringCatInfo(g, "Schema", Tabschema);
|
||||
Tabcat = GetStringCatInfo(g, "Qualifier", NULL);
|
||||
Tabcat = GetStringCatInfo(g, "Catalog", Tabcat);
|
||||
Srcdef = GetStringCatInfo(g, "Srcdef", NULL);
|
||||
Qrystr = GetStringCatInfo(g, "Query_String", "?");
|
||||
Sep = GetStringCatInfo(g, "Separator", NULL);
|
||||
Catver = GetIntCatInfo("Catver", 2);
|
||||
Xsrc = GetBoolCatInfo("Execsrc", FALSE);
|
||||
Maxerr = GetIntCatInfo("Maxerr", 0);
|
||||
Maxres = GetIntCatInfo("Maxres", 0);
|
||||
Quoted = GetIntCatInfo("Quoted", 0);
|
||||
Options = ODBConn::noOdbcDialog;
|
||||
Pseudo = 2; // FILID is Ok but not ROWID
|
||||
return false;
|
||||
|
@ -344,11 +344,11 @@ bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
DB = (char*)Tablep->GetQualifier();
|
||||
Tabsrc = (char*)Tablep->GetSrc();
|
||||
|
||||
Host = Cat->GetStringCatInfo(g, "Host", "localhost");
|
||||
User = Cat->GetStringCatInfo(g, "User", "*");
|
||||
Pwd = Cat->GetStringCatInfo(g, "Password", NULL);
|
||||
Picol = Cat->GetStringCatInfo(g, "PivotCol", NULL);
|
||||
Fncol = Cat->GetStringCatInfo(g, "FncCol", NULL);
|
||||
Host = GetStringCatInfo(g, "Host", "localhost");
|
||||
User = GetStringCatInfo(g, "User", "*");
|
||||
Pwd = GetStringCatInfo(g, "Password", NULL);
|
||||
Picol = GetStringCatInfo(g, "PivotCol", NULL);
|
||||
Fncol = GetStringCatInfo(g, "FncCol", NULL);
|
||||
|
||||
// If fncol is like avg(colname), separate Fncol and Function
|
||||
if (Fncol && (p1 = strchr(Fncol, '(')) && (p2 = strchr(p1, ')')) &&
|
||||
@ -357,11 +357,11 @@ bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
Function = Fncol;
|
||||
Fncol = p1;
|
||||
} else
|
||||
Function = Cat->GetStringCatInfo(g, "Function", "SUM");
|
||||
Function = GetStringCatInfo(g, "Function", "SUM");
|
||||
|
||||
GBdone = Cat->GetBoolCatInfo("Groupby", false);
|
||||
Accept = Cat->GetBoolCatInfo("Accept", false);
|
||||
Port = Cat->GetIntCatInfo("Port", 3306);
|
||||
GBdone = GetBoolCatInfo("Groupby", false);
|
||||
Accept = GetBoolCatInfo("Accept", false);
|
||||
Port = GetIntCatInfo("Port", 3306);
|
||||
Desc = (Tabsrc) ? Tabsrc : Tabname;
|
||||
return FALSE;
|
||||
} // end of DefineAM
|
||||
|
@ -76,8 +76,8 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
char buf[8];
|
||||
|
||||
Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
|
||||
Cat->GetCharCatInfo("Layout", "C", buf, sizeof(buf));
|
||||
Fn = GetStringCatInfo(g, "Filename", NULL);
|
||||
GetCharCatInfo("Layout", "C", buf, sizeof(buf));
|
||||
Layout = toupper(*buf);
|
||||
|
||||
if (Fn) {
|
||||
@ -90,7 +90,7 @@ bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
return true;
|
||||
} // endif Fn
|
||||
|
||||
Ln = Cat->GetSizeCatInfo("Secsize", "8K");
|
||||
Ln = GetSizeCatInfo("Secsize", "8K");
|
||||
Desc = Fn;
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
@ -111,9 +111,9 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
char *tablist, *dbname, *def = NULL;
|
||||
|
||||
Desc = "Table list table";
|
||||
tablist = Cat->GetStringCatInfo(g, "Tablist", "");
|
||||
dbname = Cat->GetStringCatInfo(g, "Dbname", "*");
|
||||
def = Cat->GetStringCatInfo(g, "Srcdef", NULL);
|
||||
tablist = GetStringCatInfo(g, "Tablist", "");
|
||||
dbname = GetStringCatInfo(g, "Dbname", "*");
|
||||
def = GetStringCatInfo(g, "Srcdef", NULL);
|
||||
Ntables = 0;
|
||||
|
||||
if (*tablist) {
|
||||
@ -155,9 +155,9 @@ bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
|
||||
} // endfor pdb
|
||||
|
||||
Maxerr = Cat->GetIntCatInfo("Maxerr", 0);
|
||||
Accept = Cat->GetBoolCatInfo("Accept", false);
|
||||
Thread = Cat->GetBoolCatInfo("Thread", false);
|
||||
Maxerr = GetIntCatInfo("Maxerr", 0);
|
||||
Accept = GetBoolCatInfo("Accept", false);
|
||||
Thread = GetBoolCatInfo("Thread", false);
|
||||
} // endif tablist
|
||||
|
||||
return FALSE;
|
||||
|
@ -307,10 +307,10 @@ bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
char *pn, *db, *tab, *def = NULL;
|
||||
|
||||
db = Cat->GetStringCatInfo(g, "Dbname", "*");
|
||||
def = Cat->GetStringCatInfo(g, "Srcdef", NULL);
|
||||
db = GetStringCatInfo(g, "Dbname", "*");
|
||||
def = GetStringCatInfo(g, "Srcdef", NULL);
|
||||
|
||||
if (!(tab = Cat->GetStringCatInfo(g, "Tabname", NULL))) {
|
||||
if (!(tab = GetStringCatInfo(g, "Tabname", NULL))) {
|
||||
if (!def) {
|
||||
strcpy(g->Message, "Missing object table definition");
|
||||
return TRUE;
|
||||
|
@ -95,13 +95,13 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
DOSDEF::DefineAM(g, "BIN", poff);
|
||||
|
||||
Estimate = Cat->GetIntCatInfo("Estimate", 0);
|
||||
Split = Cat->GetIntCatInfo("Split", (Estimate) ? 0 : 1);
|
||||
Header = Cat->GetIntCatInfo("Header", 0);
|
||||
Estimate = GetIntCatInfo("Estimate", 0);
|
||||
Split = GetIntCatInfo("Split", (Estimate) ? 0 : 1);
|
||||
Header = GetIntCatInfo("Header", 0);
|
||||
|
||||
// CONNECT must have Block/Last info for VEC tables
|
||||
if (Estimate && !Split && !Header) {
|
||||
char *fn = Cat->GetStringCatInfo(g, "Filename", "?");
|
||||
char *fn = GetStringCatInfo(g, "Filename", "?");
|
||||
|
||||
// No separate header file fo urbi tables
|
||||
Header = (*fn == '?') ? 3 : 2;
|
||||
@ -112,7 +112,7 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
// For packed files the logical record length is calculated in poff
|
||||
if (poff != Lrecl) {
|
||||
Lrecl = poff;
|
||||
Cat->SetIntCatInfo("Lrecl", poff);
|
||||
SetIntCatInfo("Lrecl", poff);
|
||||
} // endif poff
|
||||
|
||||
Padded = false;
|
||||
|
@ -335,8 +335,8 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info)
|
||||
/***********************************************************************/
|
||||
bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
Nspace = Cat->GetStringCatInfo(g, "Namespace", "Root\\CimV2");
|
||||
Wclass = Cat->GetStringCatInfo(g, "Class",
|
||||
Nspace = GetStringCatInfo(g, "Namespace", "Root\\CimV2");
|
||||
Wclass = GetStringCatInfo(g, "Class",
|
||||
(!stricmp(Nspace, "root\\cimv2") ? "ComputerSystemProduct" :
|
||||
!stricmp(Nspace, "root\\cli") ? "Msft_CliAlias" : ""));
|
||||
|
||||
@ -349,7 +349,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
} // endif Wclass
|
||||
|
||||
if (Catfunc == FNC_NO)
|
||||
Ems = Cat->GetIntCatInfo("Estimate", 100);
|
||||
Ems = GetIntCatInfo("Estimate", 100);
|
||||
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
@ -78,10 +78,10 @@ bool XCLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
char buf[8];
|
||||
|
||||
Xcol = Cat->GetStringCatInfo(g, "Colname", "");
|
||||
Cat->GetCharCatInfo("Separator", ",", buf, sizeof(buf));
|
||||
Xcol = GetStringCatInfo(g, "Colname", "");
|
||||
GetCharCatInfo("Separator", ",", buf, sizeof(buf));
|
||||
Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
|
||||
Mult = Cat->GetIntCatInfo("Mult", 10);
|
||||
Mult = GetIntCatInfo("Mult", 10);
|
||||
return PRXDEF::DefineAM(g, am, poff);
|
||||
} // end of DefineAM
|
||||
|
||||
|
@ -95,21 +95,21 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
//void *memp = Cat->GetDescp();
|
||||
//PSZ dbfile = Cat->GetDescFile();
|
||||
|
||||
Fn = Cat->GetStringCatInfo(g, "Filename", NULL);
|
||||
Encoding = Cat->GetStringCatInfo(g, "Encoding", "UTF-8");
|
||||
Fn = GetStringCatInfo(g, "Filename", NULL);
|
||||
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
|
||||
|
||||
if (*Fn == '?') {
|
||||
strcpy(g->Message, MSG(MISSING_FNAME));
|
||||
return true;
|
||||
} // endif fn
|
||||
|
||||
if ((signed)Cat->GetIntCatInfo("Flag", -1) != -1) {
|
||||
if ((signed)GetIntCatInfo("Flag", -1) != -1) {
|
||||
strcpy(g->Message, MSG(DEPREC_FLAG));
|
||||
return true;
|
||||
} // endif flag
|
||||
|
||||
defrow = defcol = "";
|
||||
Cat->GetCharCatInfo("Coltype", "", buf, sizeof(buf));
|
||||
GetCharCatInfo("Coltype", "", buf, sizeof(buf));
|
||||
|
||||
switch (toupper(*buf)) {
|
||||
case 'A': // Attribute
|
||||
@ -136,25 +136,25 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
return true;
|
||||
} // endswitch typname
|
||||
|
||||
Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
|
||||
Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); // Deprecated
|
||||
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow);
|
||||
Colname = Cat->GetStringCatInfo(g, "Colnode", defcol);
|
||||
Mulnode = Cat->GetStringCatInfo(g, "Mulnode", "");
|
||||
XmlDB = Cat->GetStringCatInfo(g, "XmlDB", "");
|
||||
Nslist = Cat->GetStringCatInfo(g, "Nslist", "");
|
||||
DefNs = Cat->GetStringCatInfo(g, "DefNs", "");
|
||||
Limit = Cat->GetIntCatInfo("Limit", 2);
|
||||
Xpand = (Cat->GetIntCatInfo("Expand", 0) != 0);
|
||||
Header = Cat->GetIntCatInfo("Header", 0);
|
||||
Cat->GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
|
||||
Tabname = GetStringCatInfo(g, "Name", Name); // Deprecated
|
||||
Tabname = GetStringCatInfo(g, "Table_name", Tabname); // Deprecated
|
||||
Tabname = GetStringCatInfo(g, "Tabname", Tabname);
|
||||
Rowname = GetStringCatInfo(g, "Rownode", defrow);
|
||||
Colname = GetStringCatInfo(g, "Colnode", defcol);
|
||||
Mulnode = GetStringCatInfo(g, "Mulnode", "");
|
||||
XmlDB = GetStringCatInfo(g, "XmlDB", "");
|
||||
Nslist = GetStringCatInfo(g, "Nslist", "");
|
||||
DefNs = GetStringCatInfo(g, "DefNs", "");
|
||||
Limit = GetIntCatInfo("Limit", 2);
|
||||
Xpand = (GetIntCatInfo("Expand", 0) != 0);
|
||||
Header = GetIntCatInfo("Header", 0);
|
||||
GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf));
|
||||
|
||||
//if (*buf == '*') // Try the old (deprecated) option
|
||||
// Cat->GetCharCatInfo("Method", "*", buf, sizeof(buf));
|
||||
// GetCharCatInfo("Method", "*", buf, sizeof(buf));
|
||||
|
||||
//if (*buf == '*') // Is there a default for the database?
|
||||
// Cat->GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
|
||||
// GetCharCatInfo("Defxml", XMLSUP, buf, sizeof(buf));
|
||||
|
||||
// Note that if no support is specified, the default is MS-DOM
|
||||
// on Windows and libxml2 otherwise
|
||||
@ -168,8 +168,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
Usedom = (toupper(*buf) == 'M' || toupper(*buf) == 'D');
|
||||
|
||||
// Get eventual table node attribute
|
||||
Attrib = Cat->GetStringCatInfo(g, "Attribute", "");
|
||||
Hdattr = Cat->GetStringCatInfo(g, "HeadAttr", "");
|
||||
Attrib = GetStringCatInfo(g, "Attribute", "");
|
||||
Hdattr = GetStringCatInfo(g, "HeadAttr", "");
|
||||
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
@ -723,7 +723,7 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp)
|
||||
return true;
|
||||
} // endswitch Ftype
|
||||
|
||||
if ((sep = dup->Catalog->GetBoolCatInfo("SepIndex", false))) {
|
||||
if ((sep = defp->GetBoolCatInfo("SepIndex", false))) {
|
||||
// Index is saved in a separate file
|
||||
#if !defined(UNIX)
|
||||
char drive[_MAX_DRIVE];
|
||||
|
Reference in New Issue
Block a user