diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-02-12 12:34:14 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-02-12 12:34:14 +0100 |
commit | 88c76f3b70def1a26f15c7ea23759369ba28392d (patch) | |
tree | 87b9e449177ddecf4a12f205da84ab40644e3c42 | |
parent | b91386c2f6964c03de353aa5155e06098055de09 (diff) | |
download | mariadb-git-88c76f3b70def1a26f15c7ea23759369ba28392d.tar.gz |
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
-rw-r--r-- | storage/connect/ha_connect.cc | 85 | ||||
-rw-r--r-- | storage/connect/mycat.cc | 173 | ||||
-rw-r--r-- | storage/connect/mycat.h | 15 | ||||
-rw-r--r-- | storage/connect/odbccat.h | 3 | ||||
-rw-r--r-- | storage/connect/odbconn.cpp | 188 | ||||
-rw-r--r-- | storage/connect/plgdbsem.h | 24 | ||||
-rw-r--r-- | storage/connect/rcmsg.c | 8 | ||||
-rw-r--r-- | storage/connect/reldef.cpp | 5 | ||||
-rw-r--r-- | storage/connect/reldef.h | 2 | ||||
-rw-r--r-- | storage/connect/tabdos.cpp | 4 | ||||
-rw-r--r-- | storage/connect/tabfmt.cpp | 5 | ||||
-rw-r--r-- | storage/connect/tabmysql.cpp | 4 | ||||
-rw-r--r-- | storage/connect/tabodbc.cpp | 13 | ||||
-rw-r--r-- | storage/connect/tabwmi.cpp | 10 |
14 files changed, 276 insertions, 263 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 542f5d070f5..9493c7cc12e 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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) { - char ttp= '?', spc= ',', qch= 0, fnc= '*'; + char spc= ',', qch= 0; const char *typn= "?"; + const char *fncn= "?"; 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) - char *nsp= NULL, *cls= NULL; + char *nsp= NULL, *cls= NULL; #endif // WIN32 - char *supfnc = "*C"; - int port= MYSQL_PORT, hdr= 0, mxr= 0; - uint tm; - bool b= false, ok= false, dbf= false; + int port= MYSQL_PORT, hdr= 0, mxr= 0; + uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL); + bool b= false, ok= false, dbf= false; + TABTYPE ttp= TAB_UNDEF; LEX_STRING *comment, *name; HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info; CHARSET_INFO *cs; engine_option_value *pov; - PQRYRES qrp; - PCOLRES crp; - PGLOBAL g= GetPlug(thd); + PQRYRES qrp; + PCOLRES crp; + PGLOBAL g= GetPlug(thd); if (!g) return true; @@ -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")) { db= pov->value.str; } 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")) { sep= pov->value.str; spc= (!strcmp(sep, "\\t")) ? '\t' : *sep; @@ -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")); } // endelse option_list - if (!tab && fnc != 'T') + if (!tab && !(fnc & (FNC_TABLE | FNC_COL))) tab= (char*)create_info->alias; switch (ttp) { #if defined(ODBC_SUPPORT) - case 'O': // ODBC + case TAB_ODBC: if (!(dsn= create_info->connect_string.str) - && fnc != 'S'&& fnc != 'D') + && !(fnc & (FNC_DSN | FNC_DRIVER))) sprintf(g->Message, "Missing %s connection string", typn); else ok= true; - supfnc = "*CTSD"; + supfnc |= (FNC_TABLE | FNC_DSN | FNC_DRIVER); break; #endif // ODBC_SUPPORT - case 'A': // DBF + case TAB_DBF: dbf= true; // Passthru - case 'C': // CSV + case TAB_CSV: if (!fn) sprintf(g->Message, "Missing %s file name", typn); else @@ -3345,7 +3347,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) break; #if defined(MYSQL_SUPPORT) - case 'Y': // MYSQL + case TAB_MYSQL: if (!user) user= "root"; // Avoid crash @@ -3353,7 +3355,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) break; #endif // MYSQL_SUPPORT #if defined(WIN32) - case 'W': // WMI + case TAB_WMI: ok= true; break; #endif // WIN32 @@ -3362,9 +3364,9 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) } // endif ttp // Check for supported catalog function - if (ok && !strchr(supfnc, fnc)) { - sprintf(g->Message, "Unsupported catalog function %c for table type %s", - fnc, typn); + if (ok && !(supfnc & fnc)) { + sprintf(g->Message, "Unsupported catalog function %s for table type %s", + fncn, typn); ok= false; } // endif supfnc @@ -3381,45 +3383,48 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) return true; // Should never happen switch (ttp) { - case 'A': - qrp= DBFColumns(g, fn, fnc == 'C'); + case TAB_DBF: + qrp= DBFColumns(g, fn, fnc == FNC_COL); break; #if defined(ODBC_SUPPORT) - case 'O': + case TAB_ODBC: switch (fnc) { - case 'C': - case '\0': - qrp= MyODBCCols(g, dsn, tab, fnc == 'C'); + case FNC_NO: + case FNC_COL: + qrp= ODBCColumns(g, dsn, tab, NULL, fnc == FNC_COL); break; - case 'T': + case FNC_TABLE: qrp= ODBCTables(g, dsn, tab, true); break; - case 'S': + case FNC_DSN: qrp= ODBCDataSources(g, true); break; - case 'D': + case FNC_DRIVER: qrp= ODBCDrivers(g, true); break; default: - sprintf(g->Message, "invalid catfunc %c", fnc); + sprintf(g->Message, "invalid catfunc %c", fncn); } // endswitch info break; #endif // ODBC_SUPPORT #if defined(MYSQL_SUPPORT) - case 'Y': + case TAB_MYSQL: qrp= MyColumns(g, host, db, user, pwd, tab, - NULL, port, false, fnc == 'C'); + NULL, port, false, fnc == FNC_COL); break; #endif // MYSQL_SUPPORT - case 'C': - qrp= CSVColumns(g, fn, spc, qch, hdr, mxr, fnc == 'C'); + case TAB_CSV: + qrp= CSVColumns(g, fn, spc, qch, hdr, mxr, fnc == FNC_COL); break; #if defined(WIN32) - case 'W': - qrp= WMIColumns(g, nsp, cls, fnc == 'C'); + case TAB_WMI: + qrp= WMIColumns(g, nsp, cls, fnc == FNC_COL); break; #endif // WIN32 + default: + strcpy(g->Message, "System error in pre_create"); + break; } // endswitch ttp if (!qrp) { @@ -3427,7 +3432,7 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) return true; } // endif qrp - if (fnc && fnc != '*') { + if (fnc != FNC_NO) { // Catalog table for (crp=qrp->Colresp; !b && crp; crp= crp->Next) { cnm= encode(g, crp->Name); @@ -3488,6 +3493,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) // cs= get_charset_by_name(csn, 0); // break; + default: + break; // Ignore } // endswitch Fld comment= thd->make_lex_string(NULL, rem, strlen(rem), true); diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index bbf38fa0374..48a26428426 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -1,4 +1,4 @@ -/* Copyright (C) Olivier Bertrand 2004 - 2012 +/* Copyright (C) Olivier Bertrand 2004 - 2013 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 @@ -16,7 +16,7 @@ /*************** Mycat CC Program Source Code File (.CC) ***************/ /* PROGRAM NAME: MYCAT */ /* ------------- */ -/* Version 1.3 */ +/* Version 1.4 */ /* */ /* Author: Olivier Bertrand 2012 - 2013 */ /* */ @@ -86,39 +86,66 @@ #include "ha_connect.h" #include "mycat.h" -/**************************************************************************/ -/* Extern static variables. */ -/**************************************************************************/ +/***********************************************************************/ +/* Extern static variables. */ +/***********************************************************************/ #if defined(WIN32) extern "C" HINSTANCE s_hModule; // Saved module handle #endif // !WIN32 extern int xtrace; -/**************************************************************************/ -/* General DB routines. */ -/**************************************************************************/ -//bool PlugCheckPattern(PGLOBAL, LPCSTR, LPCSTR); -//#if !defined(WIN32) -//#endif // !WIN32 -//void ptrc(char const *fmt, ...); - /***********************************************************************/ -/* Get a unique char identifier for types. The letter used are: */ -/* ABCDEF..I.KLM.O..R.T.VWXY.. */ +/* Get a unique enum table type ID. */ /***********************************************************************/ -char GetTypeID(const char *type) +TABTYPE GetTypeID(const char *type) { - return (!type) ? 'D' // DOS (default) - : (!stricmp(type, "FMT")) ? 'T' // CSV - : (!stricmp(type, "DIR")) ? 'R' // diR - : (!stricmp(type, "DBF")) ? 'A' // dbAse - : (!stricmp(type, "SYS")) ? 'I' // INI - : (!stricmp(type, "TBL")) ? 'L' // tbL - : (!stricmp(type, "MYSQL")) ? 'Y' // mYsql - : (!stricmp(type, "OEM")) ? 'E' : toupper(*type); + return (!type) ? TAB_UNDEF + : (!stricmp(type, "DOS")) ? TAB_DOS + : (!stricmp(type, "FIX")) ? TAB_FIX + : (!stricmp(type, "BIN")) ? TAB_BIN + : (!stricmp(type, "CSV")) ? TAB_CSV + : (!stricmp(type, "FMT")) ? TAB_FMT + : (!stricmp(type, "DBF")) ? TAB_DBF + : (!stricmp(type, "XML")) ? TAB_XML + : (!stricmp(type, "INI")) ? TAB_INI + : (!stricmp(type, "VEC")) ? TAB_VEC + : (!stricmp(type, "ODBC")) ? TAB_ODBC + : (!stricmp(type, "MYSQL")) ? TAB_MYSQL + : (!stricmp(type, "DIR")) ? TAB_DIR + : (!stricmp(type, "MAC")) ? TAB_MAC + : (!stricmp(type, "WMI")) ? TAB_WMI + : (!stricmp(type, "TBL")) ? TAB_TBL + : (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY; } // end of GetTypeID +/***********************************************************************/ +/* Get a unique enum catalog function ID. */ +/***********************************************************************/ +uint GetFuncID(const char *func) + { + uint fnc; + + if (!func) + fnc= FNC_NO; + else if (!strnicmp(func, "col", 3)) + fnc= FNC_COL; + else if (!strnicmp(func, "tab", 3)) + fnc= FNC_TABLE; + else if (!stricmp(func, "dsn") || + !strnicmp(func, "datasource", 10) || + !strnicmp(func, "source", 6) || + !strnicmp(func, "sqldatasource", 13)) + fnc= FNC_DSN; + else if (!strnicmp(func, "driver", 6) || + !strnicmp(func, "sqldriver", 9)) + fnc= FNC_DRIVER; + else + fnc= FNC_NIY; + + return fnc; + } // end of GetFuncID + /* ------------------------- Class CATALOG --------------------------- */ /***********************************************************************/ @@ -270,43 +297,44 @@ char *MYCAT::GetStringCatInfo(PGLOBAL g, PSZ name, PSZ what, PSZ sdef) /***********************************************************************/ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) { - char tc, *type= GetStringCatInfo(g, NULL, "Type", "DOS"); + char *type= GetStringCatInfo(g, NULL, "Type", "DOS"); 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)); // Get a unique char identifier for type - tc= (!defp->Catfunc) ? GetTypeID(type) : 0; + tc= (!defp->Catfunc) ? GetTypeID(type) : TAB_CATLG; // 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 == 'A') ? 1 : (tc == 'X' || tc == 'R') ? -1 : 0; + loff= (tc == TAB_DBF) ? 1 : (tc == TAB_XML || tc == TAB_DIR) ? -1 : 0; while (true) { // Default Offset depends on table type switch (tc) { - case 'D': // DOS - case 'F': // FIX - case 'B': // BIN - case 'V': // VEC - case 'A': // DBF + 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 'C': // CSV - case 'T': // FMT + case TAB_CSV: + case TAB_FMT: nlg+= nof; - case 'R': // DIR - case 'X': // XML + case TAB_DIR: + case TAB_XML: poff= loff + 1; break; - case 'I': // INI - case 'M': // MAC - case 'L': // TBL - case 'E': // OEM + case TAB_INI: + case TAB_MAC: + case TAB_TBL: + case TAB_OEM: poff = 0; // Offset represents an independant flag break; default: // VCT PLG ODBC MYSQL WMI... @@ -318,7 +346,7 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) field= Hc->GetColumnOption(field, pcf); } while (field && (*pcf->Name =='*' /*|| pcf->Flags & U_VIRTUAL*/)); - if (tc == 'A' && pcf->Type == TYPE_DATE && !pcf->Datefmt) { + if (tc == TAB_DBF && pcf->Type == TYPE_DATE && !pcf->Datefmt) { // DBF date format defaults to 'YYYMMDD' pcf->Datefmt= "YYYYMMDD"; pcf->Length= 8; @@ -336,9 +364,9 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) loff= cdp->GetOffset(); switch (tc) { - case 'V': + case TAB_VEC: cdp->SetOffset(0); // Not to have shift - case 'B': + case TAB_BIN: // BIN/VEC are packed by default if (nof) // Field width is the internal representation width @@ -355,6 +383,7 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) default: nof= cdp->Clen; } // endswitch Fmt + default: break; } // endswitch tc @@ -389,11 +418,11 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) // Calculate the default record size switch (tc) { - case 'F': + case TAB_FIX: recln= nlg + ending; // + length of line ending break; - case 'B': - case 'V': + case TAB_BIN: + case TAB_VEC: recln= nlg; // if ((k= (pak < 0) ? 8 : pak) > 1) @@ -402,15 +431,16 @@ int MYCAT::GetColCatInfo(PGLOBAL g, PTABDEF defp) // recln= ((recln + k - 1) / k) * k; break; - case 'D': - case 'A': + case TAB_DOS: + case TAB_DBF: recln= nlg; break; - case 'T': - case 'C': + 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 @@ -484,46 +514,45 @@ PRELDEF MYCAT::GetTableDesc(PGLOBAL g, LPCSTR name, /***********************************************************************/ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) { - char tc; + TABTYPE tc; PRELDEF tdp= NULL; if (xtrace) printf("MakeTableDesc: name=%s am=%s\n", name, SVP(am)); /*********************************************************************/ - /* Get a unique char identifier for types. The letter used are: */ - /* ABCDEF..IJKLM.OPQRSTUVWXYZ and Allocate table definition class */ + /* Get a unique enum identifier for types. */ /*********************************************************************/ tc= GetTypeID(am); switch (tc) { - case 'F': - case 'B': - case 'A': - case 'D': tdp= new(g) DOSDEF; break; - case 'T': - case 'C': tdp= new(g) CSVDEF; break; - case 'I': tdp= new(g) INIDEF; break; - case 'R': tdp= new(g) DIRDEF; break; + case TAB_FIX: + case TAB_BIN: + case TAB_DBF: + case TAB_DOS: tdp= new(g) DOSDEF; break; + case TAB_CSV: + case TAB_FMT: tdp= new(g) CSVDEF; break; + case TAB_INI: tdp= new(g) INIDEF; break; + case TAB_DIR: tdp= new(g) DIRDEF; break; #if defined(XML_SUPPORT) - case 'X': tdp= new(g) XMLDEF; break; + case TAB_XML: tdp= new(g) XMLDEF; break; #endif // XML_SUPPORT - case 'V': tdp= new(g) VCTDEF; break; + case TAB_VEC: tdp= new(g) VCTDEF; break; #if defined(ODBC_SUPPORT) - case 'O': tdp= new(g) ODBCDEF; break; + case TAB_ODBC: tdp= new(g) ODBCDEF; break; #endif // ODBC_SUPPORT #if defined(WIN32) - case 'M': tdp= new(g) MACDEF; break; - case 'W': tdp= new(g) WMIDEF; break; + case TAB_MAC: tdp= new(g) MACDEF; break; + case TAB_WMI: tdp= new(g) WMIDEF; break; #endif // WIN32 - case 'E': tdp= new(g) OEMDEF; break; - case 'L': tdp= new(g) TBLDEF; break; + case TAB_OEM: tdp= new(g) OEMDEF; break; + case TAB_TBL: tdp= new(g) TBLDEF; break; #if defined(MYSQL_SUPPORT) - case 'Y': tdp= new(g) MYSQLDEF; break; + case TAB_MYSQL: tdp= new(g) MYSQLDEF; break; #endif // MYSQL_SUPPORT -#if defined(PIVOT_SUPPORT) - case 'P': tdp= new(g) PIVOTDEF; break; -#endif // PIVOT_SUPPORT +//#if defined(PIVOT_SUPPORT) +// case TAB_PIVOT: tdp= new(g) PIVOTDEF; break; +//#endif // PIVOT_SUPPORT default: sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); } // endswitch diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h index 3019fa96b98..d578a5a43d7 100644 --- a/storage/connect/mycat.h +++ b/storage/connect/mycat.h @@ -1,4 +1,4 @@ -/* Copyright (C) Olivier Bertrand 2004 - 2011 +/* Copyright (C) Olivier Bertrand 2004 - 2013 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 @@ -24,7 +24,18 @@ #include "block.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. */ diff --git a/storage/connect/odbccat.h b/storage/connect/odbccat.h index 617c7d613a8..3665d1b283e 100644 --- a/storage/connect/odbccat.h +++ b/storage/connect/odbccat.h @@ -2,6 +2,7 @@ /* ODBC catalog function prototypes. */ /***********************************************************************/ 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 ODBCDrivers(PGLOBAL g, bool info); diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 0519a8141e6..cc2d5fa5fcb 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -225,58 +225,67 @@ void ResetNullValues(CATPARM *cap) /* of an ODBC table that will be retrieved by GetData commands. */ /* Note: The first two columns (Qualifier, Owner) are ignored. */ /***********************************************************************/ -PQRYRES ODBCColumns(PGLOBAL g, ODBConn *ocp, char *dsn, char *table, - char *colpat) +PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table, + char *colpat, bool info) { - static int dbtype[] = {DB_CHAR, DB_CHAR, + static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, DB_CHAR, DB_SHORT, DB_CHAR, DB_INT, DB_INT, DB_SHORT, DB_SHORT, DB_SHORT, DB_CHAR}; - static int buftyp[] = {TYPE_STRING, TYPE_STRING, + static int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT, TYPE_INT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_STRING}; - static XFLD fldtyp[] = {FLD_NO, FLD_NO, + static XFLD fldtyp[] = {FLD_NO, FLD_NO, FLD_NO, FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC, FLD_LENGTH, FLD_SCALE, FLD_RADIX, FLD_NULL, FLD_REM}; - static unsigned int length[] = {0, 0, 0, 6, 20, 10, 10, 6, 6, 6, 128}; - int n, ncol = 11; + static unsigned int length[] = {0, 0, 0, 0, 6, 20, 10, 10, 6, 6, 6, 128}; + int n, ncol = 12; int maxres; PQRYRES qrp; CATPARM *cap; + ODBConn *ocp; /************************************************************************/ /* Do an evaluation of the result size. */ /************************************************************************/ - if (ocp) { + if (!info) { + ocp = new(g) ODBConn(g, NULL); + + if (ocp->Open(dsn, 2) < 1) // 2 is openReadOnly + return NULL; + n = ocp->GetMaxValue(SQL_MAX_COLUMNS_IN_TABLE); maxres = (n) ? (int)n : 250; - n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_QUALIFIER_NAME_LEN); length[0] = (n) ? (n + 1) : 128; - n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); length[1] = (n) ? (n + 1) : 128; - n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); length[2] = (n) ? (n + 1) : 128; + n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); + length[3] = (n) ? (n + 1) : 128; } else { // Info table maxres = 0; length[0] = 128; length[1] = 128; length[2] = 128; + length[3] = 128; } // endif ocp #ifdef DEBTRACE htrc("ODBCColumns: max=%d len=%d,%d,%d\n", - maxres, length[0], length[1], length[2]); + maxres, length[0], length[1], length[2], length[3]); #endif /************************************************************************/ /* Allocate the structures used to refer to the result set. */ /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_COLUMNS + 1, - dbtype, buftyp, NULL, length, true, true); + qrp = PlgAllocResult(g, ncol, maxres, IDS_COLUMNS, + dbtype, buftyp, fldtyp, length, true, true); - if (!ocp) // Info table + if (info) // Info table return qrp; #ifdef DEBTRACE @@ -305,6 +314,7 @@ PQRYRES ODBCColumns(PGLOBAL g, ODBConn *ocp, char *dsn, char *table, return qrp; } // end of ODBCColumns +#if 0 /**************************************************************************/ /* MyODBCCols: returns column info as required by ha_connect::pre_create. */ /**************************************************************************/ @@ -339,7 +349,6 @@ PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info) if (ocp) ocp->Close(); -#if 0 if (!qrp) return NULL; // Error in ODBCColumns @@ -375,9 +384,9 @@ PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info) crp->Ncol = ++i; qrp->Nbcol = i; // Should be 7; was 11, skipped 4 -#endif // 0 return qrp; } // end of MyODBCCols +#endif // 0 /*************************************************************************/ /* ODBCDataSources: constructs the result blocks containing all ODBC */ @@ -482,16 +491,19 @@ PQRYRES ODBCDrivers(PGLOBAL g, bool info) /***********************************************************************/ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info) { - static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, DB_CHAR}; - static int buftyp[] = {TYPE_STRING, TYPE_STRING, + static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, DB_CHAR, DB_CHAR}; + static int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING}; - static unsigned int length[] = {0, 0, 16, 128}; - int n, ncol = 4; + static unsigned int length[] = {0, 0, 0, 16, 128}; + int n, ncol = 5; int maxres; PQRYRES qrp; CATPARM *cap; ODBConn *ocp; + /************************************************************************/ + /* Do an evaluation of the result size. */ + /************************************************************************/ if (!info) { /**********************************************************************/ /* Open the connection with the ODBC data source. */ @@ -501,13 +513,9 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info) if (ocp->Open(dsn, 2) < 1) // 2 is openReadOnly return NULL; - } // endif info - - /************************************************************************/ - /* Do an evaluation of the result size. */ - /************************************************************************/ - if (!info) { maxres = 512; // This is completely arbitrary + n = ocp->GetMaxValue(SQL_MAX_QUALIFIER_NAME_LEN); + length[0] = (n) ? (n + 1) : 128; n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); length[0] = (n) ? (n + 1) : 128; n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); @@ -516,6 +524,7 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info) maxres = 0; length[0] = 128; length[1] = 128; + length[2] = 128; } // endif info #ifdef DEBTRACE @@ -526,8 +535,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info) /************************************************************************/ /* Allocate the structures used to refer to the result set. */ /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_TABLES + 1, - dbtype, buftyp, NULL, length, true, true); + qrp = PlgAllocResult(g, ncol, maxres, IDS_TABLES, dbtype, buftyp, + NULL, length, true, true); if (info) return qrp; @@ -570,10 +579,11 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info) /**************************************************************************/ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table) { - static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, DB_SHORT, DB_CHAR}; + static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, + DB_CHAR, DB_SHORT, DB_CHAR}; static int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_SHORT, TYPE_STRING}; - static unsigned int length[] = {0, 0, 0, 6, 128}; + TYPE_STRING, TYPE_SHORT, TYPE_STRING}; + static unsigned int length[] = {0, 0, 0, 0, 6, 128}; int n, ncol = 5; int maxres; PQRYRES qrp; @@ -596,12 +606,14 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table) /************************************************************************/ n = ocp->GetMaxValue(SQL_MAX_COLUMNS_IN_TABLE); maxres = (n) ? (int)n : 250; - n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_QUALIFIER_NAME_LEN); length[0] = (n) ? (n + 1) : 128; - n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); length[1] = (n) ? (n + 1) : 128; - n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); + n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); length[2] = (n) ? (n + 1) : 128; + n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); + length[3] = (n) ? (n + 1) : 128; #ifdef DEBTRACE htrc("ODBCPrimaryKeys: max=%d len=%d,%d,%d\n", @@ -611,7 +623,7 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table) /************************************************************************/ /* Allocate the structure used to refer to the result set. */ /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_PKEY + 1, + qrp = PlgAllocResult(g, ncol, maxres, IDS_PKEY, dbtype, buftyp, NULL, length, true, true); #ifdef DEBTRACE @@ -653,14 +665,15 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table) PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat, int un, int acc) { - static int dbtype[] = {DB_CHAR, DB_CHAR, DB_SHORT, DB_CHAR, - DB_CHAR, DB_SHORT, DB_SHORT, DB_CHAR, - DB_CHAR, DB_INT, DB_INT, DB_CHAR}; - static int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_SHORT, TYPE_STRING, + static int dbtype[] = {DB_CHAR, DB_CHAR, DB_CHAR, DB_SHORT, DB_CHAR, + DB_CHAR, DB_SHORT, DB_SHORT, DB_CHAR, DB_CHAR, + DB_INT, DB_INT, DB_CHAR}; + static int buftyp[] = {TYPE_STRING, + TYPE_STRING, TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_STRING, TYPE_SHORT, TYPE_SHORT, TYPE_STRING, TYPE_STRING, TYPE_INT, TYPE_INT, TYPE_STRING}; - static unsigned int length[] = {0, 0 ,6 ,0 ,0 ,6 ,6 ,0 ,2 ,10 ,10 ,128}; - int n, ncol = 12; + static unsigned int length[] = {0, 0, 0 ,6 ,0 ,0 ,6 ,6 ,0 ,2 ,10 ,10 ,128}; + int n, ncol = 13; int maxres; PQRYRES qrp; CATPARM *cap; @@ -683,11 +696,11 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat, n = 1 + ocp->GetMaxValue(SQL_MAX_COLUMNS_IN_INDEX); maxres = (n) ? (int)n : 32; n = ocp->GetMaxValue(SQL_MAX_USER_NAME_LEN); - length[0] = (n) ? (n + 1) : 128; + length[1] = (n) ? (n + 1) : 128; n = ocp->GetMaxValue(SQL_MAX_TABLE_NAME_LEN); - length[1] = length[4] = (n) ? (n + 1) : 128; + length[2] = length[5] = (n) ? (n + 1) : 128; n = ocp->GetMaxValue(SQL_MAX_QUALIFIER_NAME_LEN); - length[3] = (n) ? (n + 1) : length[1]; + length[0] = length[4] = (n) ? (n + 1) : length[2]; n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN); length[7] = (n) ? (n + 1) : 128; @@ -698,7 +711,7 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat, /************************************************************************/ /* Allocate the structure used to refer to the result set. */ /************************************************************************/ - qrp = PlgAllocResult(g, ncol, maxres, IDS_STAT + 1, + qrp = PlgAllocResult(g, ncol, maxres, IDS_STAT, dbtype, buftyp, NULL, length, true, true); #ifdef DEBTRACE @@ -734,80 +747,6 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat, /************************************************************************/ return qrp; } // end of Statistics - -/***********************************************************************/ -/* GetColumnInfo: used when defining a ODBC table. The issue is that */ -/* some ODBC drivers give key information by SQLPrimaryKeys while */ -/* others do not implement it but give info using SQLStatistics. */ -/***********************************************************************/ -PQRYRES GetColumnInfo(PGLOBAL g, char*& dsn, - char *table, int ver, PVBLK& vbp) - { - PCOLRES crp; - PQRYRES qrpc, qrp; - PVBLK vbp2; - ODBConn *ocp = new(g) ODBConn(g, NULL); - - /**********************************************************************/ - /* Open the connection with the ODBC data source. */ - /**********************************************************************/ - if (ocp->Open(dsn, 2) < 1) // 2 is openReadOnly - return NULL; - else if (ver > 0) - ocp->m_Catver = ver; - - /**********************************************************************/ - /* Get the information about the ODBC table columns. */ - /**********************************************************************/ - if ((qrpc = ODBCColumns(g, ocp, dsn, table, NULL))) - dsn = ocp->GetConnect(); // Complete connect string - else - return NULL; - - if ((qrp = ODBCPrimaryKeys(g, ocp, dsn, table))) { - // Oracle, ... - if (qrp->Nblin) { - crp = qrp->Colresp->Next->Next; - vbp = crp->Kdata; - vbp->ReAlloc(vbp->GetValPointer(), qrp->Nblin); - } // endif Nblin - - } else if ((qrp = ODBCStatistics(g, ocp, dsn, table, -1, -1))) { - // Case of Microsoft Jet Engine - if (qrp->Nblin) { - int i, n = 0; - PCOLRES crp2; - - crp = qrp->Colresp->Next->Next->Next->Next; - crp2 = crp->Next->Next->Next; - - // This test may have to be modified for other ODBC drivers - for (i = 0; i < qrp->Nblin; i++) - if (!strcmp(crp->Kdata->GetCharValue(i), "PrimaryKey")) - n++; - - if (n) { - vbp2 = crp2->Kdata; - vbp = AllocValBlock(g, NULL, vbp2->GetType(), n, - vbp2->GetVlen(), 0, false, false); - - for (i = 0, n = 0; i < qrp->Nblin; i++) - if (!strcmp(crp->Kdata->GetCharValue(i), "PrimaryKey")) - vbp->SetValue(vbp2, n++, i); - - } // endif n - - } // endif Nblin - - } // endif qrp - - /************************************************************************/ - /* Close the local connection. */ - /************************************************************************/ - ocp->Close(); - - return qrpc; - } // end of GetColumnInfo #endif // 0 /***********************************************************************/ @@ -1796,8 +1735,8 @@ int ODBConn::GetCatInfo(CATPARM *cap) rc = SQLNumResultCols(hstmt, &ncol); - // n + 1 because we ignore the first column - if ((n = (UWORD)cap->Qrp->Nbcol) + 1 > (UWORD)ncol) + // n because we no more ignore the first column + if ((n = (UWORD)cap->Qrp->Nbcol) > (UWORD)ncol) ThrowDBX(MSG(COL_NUM_MISM)); if (m_RowsetSize == 1 && cap->Qrp->Maxres > 1) { @@ -1825,9 +1764,8 @@ int ODBConn::GetCatInfo(CATPARM *cap) ThrowDBX(m_G->Message); } // endif tp - // n + 2 because column numbers begin with 1 and because - // we ignore the first column - rc = SQLBindCol(hstmt, n + 2, tp, buffer, len, vl); + // n + 1 because column numbers begin with 1 + rc = SQLBindCol(hstmt, n + 1, tp, buffer, len, vl); if (!Check(rc)) ThrowDBX(rc, hstmt); diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index 7a8e13fa4c5..ff0a5bc7497 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -52,6 +52,30 @@ enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Correl Block */ TYPE_FB_XML = 21, /* DOM 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 */ TYPE_AM_ROWID = 1, /* ROWID type (special column) */ TYPE_AM_FILID = 2, /* FILEID type (special column) */ diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index a5c4abc79a3..e1a71cde9c6 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -129,10 +129,10 @@ char *GetMsgid(int id) case IDS_13: p = "%s: invalid connection key value %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_TAB_01: p = "Qualifier"; break; - case IDS_TAB_02: p = "Owner"; break; - case IDS_TAB_03: p = "Name"; break; - case IDS_TAB_04: p = "Type"; break; + case IDS_TAB_01: p = "Table_Qualifier"; break; + case IDS_TAB_02: p = "Table_Owner"; break; + case IDS_TAB_03: p = "Table_Name"; break; + case IDS_TAB_04: p = "Table_Type"; break; case IDS_TAB_05: p = "Remark"; break; case IDS_COL_01: p = "Table_Qualif"; break; case IDS_COL_02: p = "Table_Owner"; break; diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 4f99b2da6d6..98b2266b264 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -34,6 +34,7 @@ /***********************************************************************/ #include "global.h" #include "plgdbsem.h" +#include "mycat.h" #include "reldef.h" #include "colblk.h" #include "filamap.h" @@ -74,7 +75,7 @@ TABDEF::TABDEF(void) { Owner = NULL; Desc = NULL; - Catfunc = 0; + Catfunc = FNC_NO; Card = 0; Elemt = 0; Sort = 0; @@ -96,7 +97,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) Name = (PSZ)PlugSubAlloc(g, memp, strlen(name) + 1); strcpy(Name, name); Cat = cat; - Catfunc = toupper(*Cat->GetStringCatInfo(g, Name, "Catfunc", "")); + Catfunc = GetFuncID(Cat->GetStringCatInfo(g, Name, "Catfunc", NULL)); Elemt = cat->GetIntCatInfo(name, "Elements", 0); Multiple = cat->GetIntCatInfo(name, "Multiple", 0); Degree = cat->GetIntCatInfo(name, "Degree", 0); diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h index 8f14d28599f..4bf64d28208 100644 --- a/storage/connect/reldef.h +++ b/storage/connect/reldef.h @@ -85,7 +85,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */ // Members PSZ Owner; /* Table owner (for ODBC) */ PSZ Desc; /* Table description */ - char Catfunc; /* Catalog function */ + uint Catfunc; /* Catalog function ID */ int Card; /* (max) number of rows in table */ int Elemt; /* Number of rows in blocks or rowset */ int Sort; /* Table already sorted ??? */ diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 930048346b9..7d8092edc0f 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -46,7 +46,7 @@ #include "osutil.h" #include "plgdbsem.h" #include "catalog.h" -//#include "reldef.h" +#include "mycat.h" #include "xindex.h" #include "filamap.h" #include "filamfix.h" @@ -297,7 +297,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) /* Column blocks will be allocated only when needed. */ /*********************************************************************/ if (Recfm == RECFM_DBF) { - if (!Catfunc) { + if (Catfunc == FNC_NO) { if (map) txfp = new(g) DBMFAM(this); else diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 6834ca5ea28..a046fe771e5 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -49,6 +49,7 @@ /***********************************************************************/ #include "global.h" #include "plgdbsem.h" +#include "mycat.h" #include "filamap.h" #if defined(ZIP_SUPPORT) #include "filamzip.h" @@ -405,7 +406,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) char buf[8]; // Double check correctness of offset values - if (!Catfunc) + if (Catfunc == FNC_NO) for (PCOLDEF cdp = To_Cols; cdp; cdp = cdp->GetNext()) if (cdp->GetOffset() < 1) { strcpy(g->Message, MSG(BAD_OFFSET_VAL)); @@ -441,7 +442,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) { PTDBASE tdbp; - if (Catfunc != 'C') { + if (Catfunc != FNC_COL) { USETEMP tmp = PlgGetUser(g)->UseTemp; bool map = Mapped && mode != MODE_INSERT && !(tmp != TMP_NO && mode == MODE_UPDATE) && diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 27489f4635e..ae3f653c2b8 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -53,7 +53,7 @@ #include "xtable.h" #include "tabcol.h" #include "colblk.h" -//#include "xindex.h" +#include "mycat.h" #include "reldef.h" #include "tabmysql.h" #include "valblk.h" @@ -105,7 +105,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) /***********************************************************************/ PTDB MYSQLDEF::GetTable(PGLOBAL g, MODE m) { - if (Catfunc == 'C') + if (Catfunc == FNC_COL) return new(g) TDBMCL(this); else return new(g) TDBMYSQL(this); diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 276834b4e5e..876467c9706 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -64,6 +64,7 @@ /***********************************************************************/ #include "global.h" #include "plgdbsem.h" +#include "mycat.h" #include "xtable.h" #include "tabodbc.h" #include "odbccat.h" @@ -102,7 +103,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Desc = Connect = Cat->GetStringCatInfo(g, Name, "Connect", ""); Tabname = Cat->GetStringCatInfo(g, Name, "Name", - Catfunc == 'T' ? NULL : Name); + (Catfunc & (FNC_TABLE || FNC_COL)) ? NULL : Name); Tabname = Cat->GetStringCatInfo(g, Name, "Tabname", Tabname); Tabowner = Cat->GetStringCatInfo(g, Name, "Owner", ""); Tabqual = Cat->GetStringCatInfo(g, Name, "Qualifier", ""); @@ -125,16 +126,16 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m) /* Column blocks will be allocated only when needed. */ /*********************************************************************/ switch (Catfunc) { - case 'C': + case FNC_COL: tdbp = new(g) TDBOCL(this); break; - case 'T': + case FNC_TABLE: tdbp = new(g) TDBOTB(this); break; - case 'S': + case FNC_DSN: tdbp = new(g) TDBSRC(this); break; - case 'D': + case FNC_DRIVER: tdbp = new(g) TDBDRV(this); break; default: @@ -950,7 +951,7 @@ PQRYRES TDBOTB::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 Tabodbc --------------------------- */ diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp index e6a02e1871f..e4e5dde7be5 100644 --- a/storage/connect/tabwmi.cpp +++ b/storage/connect/tabwmi.cpp @@ -10,7 +10,7 @@ #include "global.h" #include "plgdbsem.h" -//#include "catalog.h" +#include "mycat.h" #include "reldef.h" #include "xtable.h" #include "colblk.h" @@ -344,7 +344,7 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Wclass = strcat(strcpy(p, "Win32_"), Wclass); } // endif Wclass - if (!Catfunc) + if (Catfunc == FNC_NO) Ems = Cat->GetIntCatInfo(Name, "Estimate", 100); return false; @@ -355,12 +355,12 @@ bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) /***********************************************************************/ PTDB WMIDEF::GetTable(PGLOBAL g, MODE m) { - if (!Catfunc) + if (Catfunc == FNC_NO) return new(g) TDBWMI(this); - else if (Catfunc == 'C') + else if (Catfunc == FNC_COL) 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; } // end of GetTable |