Commit 88c76f3b authored by Olivier Bertrand's avatar Olivier Bertrand

All use of a character to represent table types or

catalog functions have been changed:

Table_types are now internally represented be enum TABTYPE.
Catalog function names are internally translated to a uint.

The function GetTypeID was modified accordingly and a new
function GetFuncID was implemented in mycat.cc.

Modified:
ha_connect.cc
odbccat.h
odbconn.cpp
tabodbc.cpp
tabfmt.cpp
tabmysql.h
tabmysql.cpp
tabwmi.cpp
mycat.h
mycat.cc
plgdbsem.h
reldef.h
tabdos.cpp
rcmsg.h
parent b91386c2
...@@ -3256,24 +3256,25 @@ bool ha_connect::add_fields(THD *thd, void *alt_info, ...@@ -3256,24 +3256,25 @@ bool ha_connect::add_fields(THD *thd, void *alt_info,
*/ */
bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
{ {
char ttp= '?', spc= ',', qch= 0, fnc= '*'; char spc= ',', qch= 0;
const char *typn= "?"; const char *typn= "?";
const char *fncn= "?";
const char *user; const char *user;
char *fn, *dsn, *tab, *db, *host, *pwd, *prt, *sep, *csn; char *fn, *dsn, *tab, *db, *host, *pwd, *prt, *sep; // *csn;
#if defined(WIN32) #if defined(WIN32)
char *nsp= NULL, *cls= NULL; char *nsp= NULL, *cls= NULL;
#endif // WIN32 #endif // WIN32
char *supfnc = "*C"; int port= MYSQL_PORT, hdr= 0, mxr= 0;
int port= MYSQL_PORT, hdr= 0, mxr= 0; uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
uint tm; bool b= false, ok= false, dbf= false;
bool b= false, ok= false, dbf= false; TABTYPE ttp= TAB_UNDEF;
LEX_STRING *comment, *name; LEX_STRING *comment, *name;
HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info; HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info;
CHARSET_INFO *cs; CHARSET_INFO *cs;
engine_option_value *pov; engine_option_value *pov;
PQRYRES qrp; PQRYRES qrp;
PCOLRES crp; PCOLRES crp;
PGLOBAL g= GetPlug(thd); PGLOBAL g= GetPlug(thd);
if (!g) if (!g)
return true; return true;
...@@ -3294,7 +3295,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3294,7 +3295,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
} else if (!stricmp(pov->name.str, "db_name")) { } else if (!stricmp(pov->name.str, "db_name")) {
db= pov->value.str; db= pov->value.str;
} else if (!stricmp(pov->name.str, "catfunc")) { } else if (!stricmp(pov->name.str, "catfunc")) {
fnc= toupper(*pov->value.str); fncn= pov->value.str;
fnc= GetFuncID(fncn);
} else if (!stricmp(pov->name.str, "sep_char")) { } else if (!stricmp(pov->name.str, "sep_char")) {
sep= pov->value.str; sep= pov->value.str;
spc= (!strcmp(sep, "\\t")) ? '\t' : *sep; spc= (!strcmp(sep, "\\t")) ? '\t' : *sep;
...@@ -3319,25 +3321,25 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3319,25 +3321,25 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
mxr= atoi(GetListOption("maxerr", pov->value.str, "0")); mxr= atoi(GetListOption("maxerr", pov->value.str, "0"));
} // endelse option_list } // endelse option_list
if (!tab && fnc != 'T') if (!tab && !(fnc & (FNC_TABLE | FNC_COL)))
tab= (char*)create_info->alias; tab= (char*)create_info->alias;
switch (ttp) { switch (ttp) {
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case 'O': // ODBC case TAB_ODBC:
if (!(dsn= create_info->connect_string.str) if (!(dsn= create_info->connect_string.str)
&& fnc != 'S'&& fnc != 'D') && !(fnc & (FNC_DSN | FNC_DRIVER)))
sprintf(g->Message, "Missing %s connection string", typn); sprintf(g->Message, "Missing %s connection string", typn);
else else
ok= true; ok= true;
supfnc = "*CTSD"; supfnc |= (FNC_TABLE | FNC_DSN | FNC_DRIVER);
break; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
case 'A': // DBF case TAB_DBF:
dbf= true; dbf= true;
// Passthru // Passthru
case 'C': // CSV case TAB_CSV:
if (!fn) if (!fn)
sprintf(g->Message, "Missing %s file name", typn); sprintf(g->Message, "Missing %s file name", typn);
else else
...@@ -3345,7 +3347,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3345,7 +3347,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
break; break;
#if defined(MYSQL_SUPPORT) #if defined(MYSQL_SUPPORT)
case 'Y': // MYSQL case TAB_MYSQL:
if (!user) if (!user)
user= "root"; // Avoid crash user= "root"; // Avoid crash
...@@ -3353,7 +3355,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3353,7 +3355,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
break; break;
#endif // MYSQL_SUPPORT #endif // MYSQL_SUPPORT
#if defined(WIN32) #if defined(WIN32)
case 'W': // WMI case TAB_WMI:
ok= true; ok= true;
break; break;
#endif // WIN32 #endif // WIN32
...@@ -3362,9 +3364,9 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3362,9 +3364,9 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
} // endif ttp } // endif ttp
// Check for supported catalog function // Check for supported catalog function
if (ok && !strchr(supfnc, fnc)) { if (ok && !(supfnc & fnc)) {
sprintf(g->Message, "Unsupported catalog function %c for table type %s", sprintf(g->Message, "Unsupported catalog function %s for table type %s",
fnc, typn); fncn, typn);
ok= false; ok= false;
} // endif supfnc } // endif supfnc
...@@ -3381,45 +3383,48 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3381,45 +3383,48 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
return true; // Should never happen return true; // Should never happen
switch (ttp) { switch (ttp) {
case 'A': case TAB_DBF:
qrp= DBFColumns(g, fn, fnc == 'C'); qrp= DBFColumns(g, fn, fnc == FNC_COL);
break; break;
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case 'O': case TAB_ODBC:
switch (fnc) { switch (fnc) {
case 'C': case FNC_NO:
case '\0': case FNC_COL:
qrp= MyODBCCols(g, dsn, tab, fnc == 'C'); qrp= ODBCColumns(g, dsn, tab, NULL, fnc == FNC_COL);
break; break;
case 'T': case FNC_TABLE:
qrp= ODBCTables(g, dsn, tab, true); qrp= ODBCTables(g, dsn, tab, true);
break; break;
case 'S': case FNC_DSN:
qrp= ODBCDataSources(g, true); qrp= ODBCDataSources(g, true);
break; break;
case 'D': case FNC_DRIVER:
qrp= ODBCDrivers(g, true); qrp= ODBCDrivers(g, true);
break; break;
default: default:
sprintf(g->Message, "invalid catfunc %c", fnc); sprintf(g->Message, "invalid catfunc %c", fncn);
} // endswitch info } // endswitch info
break; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT) #if defined(MYSQL_SUPPORT)
case 'Y': case TAB_MYSQL:
qrp= MyColumns(g, host, db, user, pwd, tab, qrp= MyColumns(g, host, db, user, pwd, tab,
NULL, port, false, fnc == 'C'); NULL, port, false, fnc == FNC_COL);
break; break;
#endif // MYSQL_SUPPORT #endif // MYSQL_SUPPORT
case 'C': case TAB_CSV:
qrp= CSVColumns(g, fn, spc, qch, hdr, mxr, fnc == 'C'); qrp= CSVColumns(g, fn, spc, qch, hdr, mxr, fnc == FNC_COL);
break; break;
#if defined(WIN32) #if defined(WIN32)
case 'W': case TAB_WMI:
qrp= WMIColumns(g, nsp, cls, fnc == 'C'); qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL);
break; break;
#endif // WIN32 #endif // WIN32
default:
strcpy(g->Message, "System error in pre_create");
break;
} // endswitch ttp } // endswitch ttp
if (!qrp) { if (!qrp) {
...@@ -3427,7 +3432,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3427,7 +3432,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
return true; return true;
} // endif qrp } // endif qrp
if (fnc && fnc != '*') { if (fnc != FNC_NO) {
// Catalog table // Catalog table
for (crp=qrp->Colresp; !b && crp; crp= crp->Next) { for (crp=qrp->Colresp; !b && crp; crp= crp->Next) {
cnm= encode(g, crp->Name); cnm= encode(g, crp->Name);
...@@ -3488,6 +3493,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3488,6 +3493,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
// cs= get_charset_by_name(csn, 0); // cs= get_charset_by_name(csn, 0);
// break; // break;
default:
break; // Ignore
} // endswitch Fld } // endswitch Fld
comment= thd->make_lex_string(NULL, rem, strlen(rem), true); comment= thd->make_lex_string(NULL, rem, strlen(rem), true);
......
This diff is collapsed.
/* Copyright (C) Olivier Bertrand 2004 - 2011 /* Copyright (C) Olivier Bertrand 2004 - 2013
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -24,7 +24,18 @@ ...@@ -24,7 +24,18 @@
#include "block.h" #include "block.h"
#include "catalog.h" #include "catalog.h"
char GetTypeID(const char *type); // Possible value for catalog functions
#define FNC_NO (1 << 0) // Not a catalog table
#define FNC_COL (1 << 1) // Column catalog function
#define FNC_TABLE (1 << 2) // Table catalog function
#define FNC_DSN (1 << 3) // Data Source catalog function
#define FNC_DRIVER (1 << 4) // Column catalog function
#define FNC_NIY (1 << 5) // Catalog function NIY
typedef class ha_connect *PHC;
TABTYPE GetTypeID(const char *type);
uint GetFuncID(const char *func);
/***********************************************************************/ /***********************************************************************/
/* MYCAT: class for managing the CONNECT plugin DB items. */ /* MYCAT: class for managing the CONNECT plugin DB items. */
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* ODBC catalog function prototypes. */ /* ODBC catalog function prototypes. */
/***********************************************************************/ /***********************************************************************/
PQRYRES ODBCDataSources(PGLOBAL g, bool info); PQRYRES ODBCDataSources(PGLOBAL g, bool info);
PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info); PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
char *colpat, bool info);
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info); PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info);
PQRYRES ODBCDrivers(PGLOBAL g, bool info); PQRYRES ODBCDrivers(PGLOBAL g, bool info);
This diff is collapsed.
...@@ -52,6 +52,30 @@ enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Correl Block */ ...@@ -52,6 +52,30 @@ enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Correl Block */
TYPE_FB_XML = 21, /* DOM XML file block */ TYPE_FB_XML = 21, /* DOM XML file block */
TYPE_FB_XML2 = 27}; /* libxml2 XML file block */ TYPE_FB_XML2 = 27}; /* libxml2 XML file block */
enum TABTYPE {TAB_UNDEF = 0, /* Table of undefined type */
TAB_DOS = 1, /* Fixed column offset, variable LRECL */
TAB_FIX = 2, /* Fixed column offset, fixed LRECL */
TAB_BIN = 3, /* Like FIX but can have binary fields */
TAB_CSV = 4, /* DOS files with CSV records */
TAB_FMT = 5, /* DOS files with formatted recordss */
TAB_DBF = 6, /* DBF Dbase or Foxpro files */
TAB_XML = 7, /* XML or HTML files */
TAB_INI = 8, /* INI or CFG files */
TAB_VEC = 9, /* Vector column arrangement */
TAB_ODBC = 10, /* Table accessed via (unix)ODBC */
TAB_MYSQL = 11, /* MySQL table accessed via MySQL API */
TAB_DIR = 12, /* Returns a list of files */
TAB_MAC = 13, /* MAC address (Windows only) */
TAB_WMI = 14, /* WMI tables (Windows only) */
TAB_TBL = 15, /* Collection of CONNECT tables */
TAB_OEM = 16, /* OEM implemented table */
TAB_CATLG = 16, /* Catalog table */
TAB_PLG = 17, /* PLG NIY */
TAB_PIVOT = 18, /* PIVOT NIY */
TAB_JCT = 19, /* Junction tables NIY */
TAB_DMY = 20, /* DMY Dummy tables NIY */
TAB_NIY = 21}; /* Table not implemented yet */
enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */ enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */
TYPE_AM_ROWID = 1, /* ROWID type (special column) */ TYPE_AM_ROWID = 1, /* ROWID type (special column) */
TYPE_AM_FILID = 2, /* FILEID type (special column) */ TYPE_AM_FILID = 2, /* FILEID type (special column) */
......
...@@ -129,10 +129,10 @@ char *GetMsgid(int id) ...@@ -129,10 +129,10 @@ char *GetMsgid(int id)
case IDS_13: p = "%s: invalid connection key value %d"; break; case IDS_13: p = "%s: invalid connection key value %d"; break;
case IDS_14: p = "SafeDB: %s rc=%d"; break; case IDS_14: p = "SafeDB: %s rc=%d"; break;
case IDS_15: p = "Wrong communication Dll called for engine %s"; break; case IDS_15: p = "Wrong communication Dll called for engine %s"; break;
case IDS_TAB_01: p = "Qualifier"; break; case IDS_TAB_01: p = "Table_Qualifier"; break;
case IDS_TAB_02: p = "Owner"; break; case IDS_TAB_02: p = "Table_Owner"; break;
case IDS_TAB_03: p = "Name"; break; case IDS_TAB_03: p = "Table_Name"; break;
case IDS_TAB_04: p = "Type"; break; case IDS_TAB_04: p = "Table_Type"; break;
case IDS_TAB_05: p = "Remark"; break; case IDS_TAB_05: p = "Remark"; break;
case IDS_COL_01: p = "Table_Qualif"; break; case IDS_COL_01: p = "Table_Qualif"; break;
case IDS_COL_02: p = "Table_Owner"; break; case IDS_COL_02: p = "Table_Owner"; break;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "mycat.h"
#include "reldef.h" #include "reldef.h"
#include "colblk.h" #include "colblk.h"
#include "filamap.h" #include "filamap.h"
...@@ -74,7 +75,7 @@ TABDEF::TABDEF(void) ...@@ -74,7 +75,7 @@ TABDEF::TABDEF(void)
{ {
Owner = NULL; Owner = NULL;
Desc = NULL; Desc = NULL;
Catfunc = 0; Catfunc = FNC_NO;
Card = 0; Card = 0;
Elemt = 0; Elemt = 0;
Sort = 0; Sort = 0;
...@@ -96,7 +97,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) ...@@ -96,7 +97,7 @@ 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 = toupper(*Cat->GetStringCatInfo(g, Name, "Catfunc", "")); Catfunc = GetFuncID(Cat->GetStringCatInfo(g, Name, "Catfunc", NULL));
Elemt = cat->GetIntCatInfo(name, "Elements", 0); Elemt = cat->GetIntCatInfo(name, "Elements", 0);
Multiple = cat->GetIntCatInfo(name, "Multiple", 0); Multiple = cat->GetIntCatInfo(name, "Multiple", 0);
Degree = cat->GetIntCatInfo(name, "Degree", 0); Degree = cat->GetIntCatInfo(name, "Degree", 0);
......
...@@ -85,7 +85,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */ ...@@ -85,7 +85,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
// Members // Members
PSZ Owner; /* Table owner (for ODBC) */ PSZ Owner; /* Table owner (for ODBC) */
PSZ Desc; /* Table description */ PSZ Desc; /* Table description */
char Catfunc; /* Catalog function */ uint Catfunc; /* Catalog function ID */
int Card; /* (max) number of rows in table */ int Card; /* (max) number of rows in table */
int Elemt; /* Number of rows in blocks or rowset */ int Elemt; /* Number of rows in blocks or rowset */
int Sort; /* Table already sorted ??? */ int Sort; /* Table already sorted ??? */
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "osutil.h" #include "osutil.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "catalog.h" #include "catalog.h"
//#include "reldef.h" #include "mycat.h"
#include "xindex.h" #include "xindex.h"
#include "filamap.h" #include "filamap.h"
#include "filamfix.h" #include "filamfix.h"
...@@ -297,7 +297,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -297,7 +297,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
/* Column blocks will be allocated only when needed. */ /* Column blocks will be allocated only when needed. */
/*********************************************************************/ /*********************************************************************/
if (Recfm == RECFM_DBF) { if (Recfm == RECFM_DBF) {
if (!Catfunc) { if (Catfunc == FNC_NO) {
if (map) if (map)
txfp = new(g) DBMFAM(this); txfp = new(g) DBMFAM(this);
else else
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "mycat.h"
#include "filamap.h" #include "filamap.h"
#if defined(ZIP_SUPPORT) #if defined(ZIP_SUPPORT)
#include "filamzip.h" #include "filamzip.h"
...@@ -405,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -405,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
char buf[8]; char buf[8];
// Double check correctness of offset values // Double check correctness of offset values
if (!Catfunc) if (Catfunc == FNC_NO)
for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext()) for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext())
if (cdp->GetOffset() < 1) { if (cdp->GetOffset() < 1) {
strcpy(g->Message, MSG(BAD_OFFSET_VAL)); strcpy(g->Message, MSG(BAD_OFFSET_VAL));
...@@ -441,7 +442,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -441,7 +442,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
{ {
PTDBASE tdbp; PTDBASE tdbp;
if (Catfunc != 'C') { if (Catfunc != FNC_COL) {
USETEMP tmp = PlgGetUser(g)->UseTemp; USETEMP tmp = PlgGetUser(g)->UseTemp;
bool map = Mapped && mode != MODE_INSERT && bool map = Mapped && mode != MODE_INSERT &&
!(tmp != TMP_NO && mode == MODE_UPDATE) && !(tmp != TMP_NO && mode == MODE_UPDATE) &&
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "xtable.h" #include "xtable.h"
#include "tabcol.h" #include "tabcol.h"
#include "colblk.h" #include "colblk.h"
//#include "xindex.h" #include "mycat.h"
#include "reldef.h" #include "reldef.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "valblk.h" #include "valblk.h"
...@@ -105,7 +105,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -105,7 +105,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/ /***********************************************************************/
PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE m) PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE m)
{ {
if (Catfunc == 'C') if (Catfunc == FNC_COL)
return new(g) TDBMCL(this); return new(g) TDBMCL(this);
else else
return new(g) TDBMYSQL(this); return new(g) TDBMYSQL(this);
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "mycat.h"
#include "xtable.h" #include "xtable.h"
#include "tabodbc.h" #include "tabodbc.h"
#include "odbccat.h" #include "odbccat.h"
...@@ -102,7 +103,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -102,7 +103,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Desc = Connect = Cat->GetStringCatInfo(g, Name, "Connect", ""); Desc = Connect = Cat->GetStringCatInfo(g, Name, "Connect", "");
Tabname = Cat->GetStringCatInfo(g, Name, "Name", Tabname = Cat->GetStringCatInfo(g, Name, "Name",
Catfunc == 'T' ? NULL : Name); (Catfunc & (FNC_TABLE || FNC_COL)) ? NULL : Name);
Tabname = Cat->GetStringCatInfo(g, Name, "Tabname", Tabname); Tabname = Cat->GetStringCatInfo(g, Name, "Tabname", Tabname);
Tabowner = Cat->GetStringCatInfo(g, Name, "Owner", ""); Tabowner = Cat->GetStringCatInfo(g, Name, "Owner", "");
Tabqual = Cat->GetStringCatInfo(g, Name, "Qualifier", ""); Tabqual = Cat->GetStringCatInfo(g, Name, "Qualifier", "");
...@@ -125,16 +126,16 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m) ...@@ -125,16 +126,16 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m)
/* Column blocks will be allocated only when needed. */ /* Column blocks will be allocated only when needed. */
/*********************************************************************/ /*********************************************************************/
switch (Catfunc) { switch (Catfunc) {
case 'C': case FNC_COL:
tdbp = new(g) TDBOCL(this); tdbp = new(g) TDBOCL(this);
break; break;
case 'T': case FNC_TABLE:
tdbp = new(g) TDBOTB(this); tdbp = new(g) TDBOTB(this);
break; break;
case 'S': case FNC_DSN:
tdbp = new(g) TDBSRC(this); tdbp = new(g) TDBSRC(this);
break; break;
case 'D': case FNC_DRIVER:
tdbp = new(g) TDBDRV(this); tdbp = new(g) TDBDRV(this);
break; break;
default: default:
...@@ -950,7 +951,7 @@ PQRYRES TDBOTB::GetResult(PGLOBAL g) ...@@ -950,7 +951,7 @@ PQRYRES TDBOTB::GetResult(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
PQRYRES TDBOCL::GetResult(PGLOBAL g) PQRYRES TDBOCL::GetResult(PGLOBAL g)
{ {
return MyODBCCols(g, Dsn, Tab, false); return ODBCColumns(g, Dsn, Tab, NULL, false);
} // end of GetResult } // end of GetResult
/* ------------------------ End of Tabodbc --------------------------- */ /* ------------------------ End of Tabodbc --------------------------- */
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
//#include "catalog.h" #include "mycat.h"
#include "reldef.h" #include "reldef.h"
#include "xtable.h" #include "xtable.h"
#include "colblk.h" #include "colblk.h"
...@@ -344,7 +344,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -344,7 +344,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Wclass = strcat(strcpy(p, "Win32_"), Wclass); Wclass = strcat(strcpy(p, "Win32_"), Wclass);
} // endif Wclass } // endif Wclass
if (!Catfunc) if (Catfunc == FNC_NO)
Ems = Cat->GetIntCatInfo(Name, "Estimate", 100); Ems = Cat->GetIntCatInfo(Name, "Estimate", 100);
return false; return false;
...@@ -355,12 +355,12 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -355,12 +355,12 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/ /***********************************************************************/
PTDB WMIDEF::GetTable(PGLOBAL g, MODE m) PTDB WMIDEF::GetTable(PGLOBAL g, MODE m)
{ {
if (!Catfunc) if (Catfunc == FNC_NO)
return new(g) TDBWMI(this); return new(g) TDBWMI(this);
else if (Catfunc == 'C') else if (Catfunc == FNC_COL)
return new(g) TDBWCL(this); return new(g) TDBWCL(this);
sprintf(g->Message, "Bad catfunc %c for WMI", Catfunc); sprintf(g->Message, "Bad catfunc %ud for WMI", Catfunc);
return NULL; return NULL;
} // end of GetTable } // end of GetTable
......
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