Commit 5c2c68d4 authored by Olivier Bertrand's avatar Olivier Bertrand

This is a major update concerning many source files.

Fix MDEV-12035.
  modified:   storage/connect/jsonudf.cpp

Working on MDEV-11832: Srcdef performance enhancement
This require to mark place holders into srcdef to indicate where to insert
the where/having clauses that are retrieved in push_cond.
However this also make necessary to handle aliases in the srcdef.
This was the opportunity to base all external tables on common classes
called EXTDEF, TABEXT and EXTCOL.
  modified:   storage/connect/array.cpp
  modified:   storage/connect/array.h
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/connect.cc
  modified:   storage/connect/filamdbf.cpp
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/myconn.cpp
  modified:   storage/connect/odbconn.cpp
  modified:   storage/connect/plgdbsem.h
  modified:   storage/connect/reldef.cpp
  modified:   storage/connect/reldef.h
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabdos.h
  modified:   storage/connect/tabfix.cpp
  modified:   storage/connect/tabfix.h
  modified:   storage/connect/tabfmt.cpp
  modified:   storage/connect/tabfmt.h
  modified:   storage/connect/tabjdbc.cpp
  modified:   storage/connect/tabjdbc.h
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h
  modified:   storage/connect/table.cpp
  modified:   storage/connect/tabmac.cpp
  modified:   storage/connect/tabmac.h
  modified:   storage/connect/tabmul.cpp
  modified:   storage/connect/tabmul.h
  modified:   storage/connect/tabmysql.cpp
  modified:   storage/connect/tabmysql.h
  modified:   storage/connect/taboccur.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabodbc.h
  modified:   storage/connect/tabpivot.cpp
  modified:   storage/connect/tabpivot.h
  modified:   storage/connect/tabsys.cpp
  modified:   storage/connect/tabsys.h
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/tabutil.cpp
  modified:   storage/connect/tabutil.h
  modified:   storage/connect/tabvct.cpp
  modified:   storage/connect/tabvct.h
  modified:   storage/connect/tabvir.cpp
  modified:   storage/connect/tabwmi.cpp
  modified:   storage/connect/tabxcl.cpp
  modified:   storage/connect/tabxcl.h
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/tabxml.h
  modified:   storage/connect/xindex.cpp
  modified:   storage/connect/xindex.h
  modified:   storage/connect/xobject.h
  modified:   storage/connect/xtable.h
  added:      storage/connect/tabext.cpp
  added:      storage/connect/tabext.h
parent 9fa0d2fe
This diff is collapsed.
/**************** Array H Declares Source Code File (.H) ***************/ /**************** Array H Declares Source Code File (.H) ***************/
/* Name: ARRAY.H Version 3.1 */ /* Name: ARRAY.H Version 3.1 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */ /* */
/* This file contains the ARRAY and VALBASE derived classes declares. */ /* This file contains the ARRAY and VALBASE derived classes declares. */
/***********************************************************************/ /***********************************************************************/
...@@ -53,8 +53,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock ...@@ -53,8 +53,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
using XOBJECT::GetIntValue; using XOBJECT::GetIntValue;
virtual void Reset(void) {Bot = -1;} virtual void Reset(void) {Bot = -1;}
virtual int Qcompare(int *, int *); virtual int Qcompare(int *, int *);
virtual bool Compare(PXOB) {assert(FALSE); return FALSE;} virtual bool Compare(PXOB) {assert(false); return false;}
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(FALSE); return FALSE;} virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
//virtual int CheckSpcCol(PTDB, int) {return 0;} //virtual int CheckSpcCol(PTDB, int) {return 0;}
virtual void Print(PGLOBAL g, FILE *f, uint n); virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z); virtual void Print(PGLOBAL g, char *ps, uint z);
......
/************* Colblk C++ Functions Source Code File (.CPP) ************/ /************* Colblk C++ Functions Source Code File (.CPP) ************/
/* Name: COLBLK.CPP Version 2.1 */ /* Name: COLBLK.CPP Version 2.2 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */ /* */
/* This file contains the COLBLK class functions. */ /* This file contains the COLBLK class functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -300,7 +300,7 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op) ...@@ -300,7 +300,7 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
#if defined(__WIN__) #if defined(__WIN__)
Format.Prec = 1; // Case insensitive Format.Prec = 1; // Case insensitive
#endif // __WIN__ #endif // __WIN__
Constant = (!((PTDBASE)To_Tdb)->GetDef()->GetMultiple() && Constant = (!To_Tdb->GetDef()->GetMultiple() &&
To_Tdb->GetAmType() != TYPE_AM_PLG && To_Tdb->GetAmType() != TYPE_AM_PLG &&
To_Tdb->GetAmType() != TYPE_AM_PLM); To_Tdb->GetAmType() != TYPE_AM_PLM);
Fn = NULL; Fn = NULL;
...@@ -312,11 +312,11 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op) ...@@ -312,11 +312,11 @@ FIDBLK::FIDBLK(PCOLUMN cp, OPVAL op) : SPCBLK(cp), Op(op)
/***********************************************************************/ /***********************************************************************/
void FIDBLK::ReadColumn(PGLOBAL g) void FIDBLK::ReadColumn(PGLOBAL g)
{ {
if (Fn != ((PTDBASE)To_Tdb)->GetFile(g)) { if (Fn != To_Tdb->GetFile(g)) {
char filename[_MAX_PATH]; char filename[_MAX_PATH];
Fn = ((PTDBASE)To_Tdb)->GetFile(g); Fn = To_Tdb->GetFile(g);
PlugSetPath(filename, Fn, ((PTDBASE)To_Tdb)->GetPath()); PlugSetPath(filename, Fn, To_Tdb->GetPath());
if (Op != OP_XX) { if (Op != OP_XX) {
char buff[_MAX_PATH]; char buff[_MAX_PATH];
...@@ -378,10 +378,8 @@ void PRTBLK::ReadColumn(PGLOBAL g) ...@@ -378,10 +378,8 @@ void PRTBLK::ReadColumn(PGLOBAL g)
{ {
if (Pname == NULL) { if (Pname == NULL) {
char *p; char *p;
PTDBASE tdbp = (PTDBASE)To_Tdb;
Pname = tdbp->GetDef()->GetStringCatInfo(g, "partname", "?");
Pname = To_Tdb->GetDef()->GetStringCatInfo(g, "partname", "?");
p = strrchr(Pname, '#'); p = strrchr(Pname, '#');
Value->SetValue_psz((p) ? p + 1 : Pname); Value->SetValue_psz((p) ? p + 1 : Pname);
} // endif Pname } // endif Pname
......
...@@ -159,7 +159,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname) ...@@ -159,7 +159,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
bool CntInfo(PGLOBAL g, PTDB tp, PXF info) bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
{ {
if (tp) { if (tp) {
bool b = ((PTDBASE)tp)->GetFtype() == RECFM_NAF; bool b = (tp->GetFtype() == RECFM_NAF);
PTDBDOS tdbp = b ? NULL : (PTDBDOS)tp; PTDBDOS tdbp = b ? NULL : (PTDBDOS)tp;
info->data_file_length = (b) ? 0 : (ulonglong)tdbp->GetFileLength(g); info->data_file_length = (b) ? 0 : (ulonglong)tdbp->GetFileLength(g);
...@@ -331,9 +331,9 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -331,9 +331,9 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} // endfor colp } // endfor colp
// Attach the updated columns list to the main table // Attach the updated columns list to the main table
((PTDBASE)tdbp)->SetSetCols(utp->GetColumns()); tdbp->SetSetCols(utp->GetColumns());
} else if (tdbp && mode == MODE_INSERT) } else if (tdbp && mode == MODE_INSERT)
((PTDBASE)tdbp)->SetSetCols(tdbp->GetColumns()); tdbp->SetSetCols(tdbp->GetColumns());
// Now do open the physical table // Now do open the physical table
if (trace) if (trace)
...@@ -342,7 +342,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -342,7 +342,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
//tdbp->SetMode(mode); //tdbp->SetMode(mode);
if (del/* && ((PTDBASE)tdbp)->GetFtype() != RECFM_NAF*/) { if (del/* && (tdbp->GetFtype() != RECFM_NAF*/) {
// To avoid erasing the table when doing a partial delete // To avoid erasing the table when doing a partial delete
// make a fake Next // make a fake Next
// PDOSDEF ddp= new(g) DOSDEF; // PDOSDEF ddp= new(g) DOSDEF;
...@@ -435,7 +435,7 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp) ...@@ -435,7 +435,7 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
if (!tdbp) if (!tdbp)
return RC_FX; return RC_FX;
else if (((PTDBASE)tdbp)->GetKindex()) { else if (tdbp->GetKindex()) {
// Reading sequencially an indexed table. This happens after the // Reading sequencially an indexed table. This happens after the
// handler function records_in_range was called and MySQL decides // handler function records_in_range was called and MySQL decides
// to quit using the index (!!!) Drop the index. // to quit using the index (!!!) Drop the index.
...@@ -482,7 +482,7 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp) ...@@ -482,7 +482,7 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
{ {
RCODE rc; RCODE rc;
PCOL colp; PCOL colp;
PTDBASE tp= (PTDBASE)tdbp; //PTDBASE tp= (PTDBASE)tdbp;
if (!tdbp) if (!tdbp)
return RC_FX; return RC_FX;
...@@ -500,13 +500,13 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp) ...@@ -500,13 +500,13 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
} // endif rc } // endif rc
// Store column values in table write buffer(s) // Store column values in table write buffer(s)
for (colp= tp->GetSetCols(); colp; colp= colp->GetNext()) for (colp= tdbp->GetSetCols(); colp; colp= colp->GetNext())
if (!colp->GetColUse(U_VIRTUAL)) if (!colp->GetColUse(U_VIRTUAL))
colp->WriteColumn(g); colp->WriteColumn(g);
if (tp->IsIndexed()) if (tdbp->IsIndexed())
// Index values must be sorted before updating // Index values must be sorted before updating
rc= (RCODE)((PTDBDOS)tp)->GetTxfp()->StoreValues(g, true); rc= (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, true);
else else
// Return result code from write operation // Return result code from write operation
rc= (RCODE)tdbp->WriteDB(g); rc= (RCODE)tdbp->WriteDB(g);
...@@ -534,7 +534,7 @@ RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp) ...@@ -534,7 +534,7 @@ RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp)
RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all) RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
{ {
RCODE rc; RCODE rc;
PTDBASE tp= (PTDBASE)tdbp; //PTDBASE tp= (PTDBASE)tdbp;
if (!tdbp || tdbp->GetMode() != MODE_DELETE) if (!tdbp || tdbp->GetMode() != MODE_DELETE)
return RC_FX; return RC_FX;
...@@ -542,16 +542,16 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all) ...@@ -542,16 +542,16 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
return RC_NF; return RC_NF;
if (all) { if (all) {
if (((PTDBASE)tdbp)->GetDef()->Indexable()) if (tdbp->GetDef()->Indexable())
((PTDBDOS)tdbp)->Cardinal= 0; ((PTDBDOS)tdbp)->Cardinal= 0;
// Note: if all, this call will be done when closing the table // Note: if all, this call will be done when closing the table
rc= (RCODE)tdbp->DeleteDB(g, RC_FX); rc= (RCODE)tdbp->DeleteDB(g, RC_FX);
//} else if (tp->GetKindex() && !tp->GetKindex()->IsSorted() && //} else if (tdbp->GetKindex() && !((PTDBASE)tdbp)->GetKindex()->IsSorted() &&
// tp->Txfp->GetAmType() != TYPE_AM_DBF) { // ((PTDBASE)tdbp)->Txfp->GetAmType() != TYPE_AM_DBF) {
} else if(tp->IsIndexed()) { } else if(tdbp->IsIndexed()) {
// Index values must be sorted before updating // Index values must be sorted before updating
rc= (RCODE)((PTDBDOS)tp)->GetTxfp()->StoreValues(g, false); rc= (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, false);
} else // Return result code from delete operation } else // Return result code from delete operation
rc= (RCODE)tdbp->DeleteDB(g, RC_OK); rc= (RCODE)tdbp->DeleteDB(g, RC_OK);
...@@ -564,7 +564,7 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all) ...@@ -564,7 +564,7 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
{ {
int rc= RC_OK; int rc= RC_OK;
TDBASE *tbxp= (PTDBASE)tdbp; //TDBASE *tbxp= (PTDBASE)tdbp;
if (!tdbp) if (!tdbp)
return rc; // Nothing to do return rc; // Nothing to do
...@@ -580,13 +580,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -580,13 +580,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
tdbp, tdbp->GetMode(), nox, abort); tdbp, tdbp->GetMode(), nox, abort);
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN) { if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN) {
if (tbxp->IsIndexed()) if (tdbp->IsIndexed())
rc= ((PTDBDOS)tdbp)->GetTxfp()->DeleteSortedRows(g); rc= ((PTDBDOS)tdbp)->GetTxfp()->DeleteSortedRows(g);
if (!rc) if (!rc)
rc= tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine rc= tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
} else if (tbxp->GetMode() == MODE_UPDATE && tbxp->IsIndexed()) } else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
rc= ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g); rc= ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g);
switch(rc) { switch(rc) {
...@@ -594,7 +594,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -594,7 +594,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
abort= true; abort= true;
break; break;
case RC_INFO: case RC_INFO:
PushWarning(g, tbxp); PushWarning(g, tdbp);
break; break;
} // endswitch rc } // endswitch rc
...@@ -630,11 +630,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) ...@@ -630,11 +630,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
if (trace > 1) if (trace > 1)
printf("About to reset opt\n"); printf("About to reset opt\n");
// Make all the eventual indexes if (!tdbp->IsRemote()) {
tbxp= (TDBDOX*)tdbp; // Make all the eventual indexes
tbxp->ResetKindex(g, NULL); PTDBDOX tbxp = (PTDBDOX)tdbp;
tbxp->SetKey_Col(NULL); tbxp->ResetKindex(g, NULL);
rc= tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1); tbxp->SetKey_Col(NULL);
rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
} // endif remote
err: err:
if (trace > 1) if (trace > 1)
...@@ -656,10 +658,10 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) ...@@ -656,10 +658,10 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
if (!ptdb) if (!ptdb)
return -1; return -1;
else if (!((PTDBASE)ptdb)->GetDef()->Indexable()) { else if (!ptdb->GetDef()->Indexable()) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
return 0; return 0;
} else if (((PTDBASE)ptdb)->GetDef()->Indexable() == 3) { } else if (ptdb->GetDef()->Indexable() == 3) {
return 1; return 1;
} else } else
tdbp= (PTDBDOX)ptdb; tdbp= (PTDBDOX)ptdb;
...@@ -744,7 +746,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -744,7 +746,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
if (!ptdb) if (!ptdb)
return RC_FX; return RC_FX;
else else
x= ((PTDBASE)ptdb)->GetDef()->Indexable(); x= ptdb->GetDef()->Indexable();
if (!x) { if (!x) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
...@@ -874,7 +876,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -874,7 +876,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
if (!ptdb) if (!ptdb)
return -1; return -1;
x= ((PTDBASE)ptdb)->GetDef()->Indexable(); x= ptdb->GetDef()->Indexable();
if (!x) { if (!x) {
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -593,6 +593,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) ...@@ -593,6 +593,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
if (Accept) { if (Accept) {
Lrecl = reclen; Lrecl = reclen;
Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp); PushWarning(g, Tdbp);
} else } else
return true; return true;
...@@ -609,7 +610,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) ...@@ -609,7 +610,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
header->Filedate[1] = datm->tm_mon + 1; header->Filedate[1] = datm->tm_mon + 1;
header->Filedate[2] = datm->tm_mday; header->Filedate[2] = datm->tm_mday;
header->SetHeadlen((ushort)hlen); header->SetHeadlen((ushort)hlen);
header->SetReclen((ushort)reclen); header->SetReclen(reclen);
descp = (DESCRIPTOR*)header; descp = (DESCRIPTOR*)header;
// Currently only standard Xbase types are supported // Currently only standard Xbase types are supported
...@@ -675,6 +676,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) ...@@ -675,6 +676,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
if (Accept) { if (Accept) {
Lrecl = header.Reclen(); Lrecl = header.Reclen();
Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp); PushWarning(g, Tdbp);
} else } else
return true; return true;
...@@ -967,6 +969,7 @@ int DBMFAM::Cardinality(PGLOBAL g) ...@@ -967,6 +969,7 @@ int DBMFAM::Cardinality(PGLOBAL g)
if (Accept) { if (Accept) {
Lrecl = rln; Lrecl = rln;
Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp); PushWarning(g, Tdbp);
} else } else
return -1; return -1;
...@@ -1019,6 +1022,7 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g) ...@@ -1019,6 +1022,7 @@ bool DBMFAM::AllocateBuffer(PGLOBAL g)
if (Accept) { if (Accept) {
Lrecl = hp->Reclen(); Lrecl = hp->Reclen();
Blksize = Nrec * Lrecl;
PushWarning(g, Tdbp); PushWarning(g, Tdbp);
} else } else
return true; return true;
......
This diff is collapsed.
/************ Jdbconn C++ Functions Source Code File (.CPP) ************/ /************ Jdbconn C++ Functions Source Code File (.CPP) ************/
/* Name: JDBCONN.CPP Version 1.0 */ /* Name: JDBCONN.CPP Version 1.1 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2016 */ /* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
/* */ /* */
/* This file contains the JDBC connection classes functions. */ /* This file contains the JDBC connection classes functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
#include "plgdbsem.h" #include "plgdbsem.h"
#include "xobject.h" #include "xobject.h"
#include "xtable.h" #include "xtable.h"
#include "tabext.h"
#include "tabjdbc.h" #include "tabjdbc.h"
//#include "jdbconn.h" //#include "jdbconn.h"
//#include "plgcnx.h" // For DB types
#include "resource.h" #include "resource.h"
#include "valblk.h" #include "valblk.h"
#include "osutil.h" #include "osutil.h"
...@@ -318,13 +318,21 @@ PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat, ...@@ -318,13 +318,21 @@ PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat,
/**************************************************************************/ /**************************************************************************/
PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp) PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp)
{ {
char *sqry;
PQRYRES qrp; PQRYRES qrp;
JDBConn *jcp = new(g)JDBConn(g, NULL); JDBConn *jcp = new(g)JDBConn(g, NULL);
if (jcp->Open(sjp)) if (jcp->Open(sjp))
return NULL; return NULL;
qrp = jcp->GetMetaData(g, src); if (strstr(src, "%s")) {
// Place holder for an eventual where clause
sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 2);
sprintf(sqry, src, "1=1"); // dummy where clause
} else
sqry = src;
qrp = jcp->GetMetaData(g, sqry);
jcp->Close(); jcp->Close();
return qrp; return qrp;
} // end of JDBCSrcCols } // end of JDBCSrcCols
......
This diff is collapsed.
/* Copyright (C) Olivier Bertrand 2004 - 2016 /* Copyright (C) Olivier Bertrand 2004 - 2017
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
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
/*************** Mycat CC Program Source Code File (.CC) ***************/ /*************** Mycat CC Program Source Code File (.CC) ***************/
/* PROGRAM NAME: MYCAT */ /* PROGRAM NAME: MYCAT */
/* ------------- */ /* ------------- */
/* Version 1.5 */ /* Version 1.6 */
/* */ /* */
/* Author: Olivier Bertrand 2012 - 2016 */ /* Author: Olivier Bertrand 2012 - 2017 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -58,9 +58,10 @@ ...@@ -58,9 +58,10 @@
#endif // UNIX #endif // UNIX
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "reldef.h" //#include "reldef.h"
#include "tabcol.h"
#include "xtable.h" #include "xtable.h"
#include "tabext.h"
#include "tabcol.h"
#include "filamtxt.h" #include "filamtxt.h"
#include "tabdos.h" #include "tabdos.h"
#include "tabfmt.h" #include "tabfmt.h"
...@@ -559,13 +560,13 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) ...@@ -559,13 +560,13 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_XML: tdp= new(g) XMLDEF; break; case TAB_XML: tdp= new(g) XMLDEF; break;
#endif // XML_SUPPORT #endif // XML_SUPPORT
#if defined(VCT_SUPPORT) #if defined(VCT_SUPPORT)
case TAB_VEC: tdp = new(g)VCTDEF; break; case TAB_VEC: tdp = new(g) VCTDEF; break;
#endif // VCT_SUPPORT #endif // VCT_SUPPORT
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break; case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT) #if defined(JDBC_SUPPORT)
case TAB_JDBC: tdp= new(g)JDBCDEF; break; case TAB_JDBC: tdp= new(g) JDBCDEF; break;
#endif // JDBC_SUPPORT #endif // JDBC_SUPPORT
#if defined(__WIN__) #if defined(__WIN__)
case TAB_MAC: tdp= new(g) MACDEF; break; case TAB_MAC: tdp= new(g) MACDEF; break;
......
/************** MyConn C++ Program Source Code File (.CPP) **************/ /************** MyConn C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: MYCONN */ /* PROGRAM NAME: MYCONN */
/* ------------- */ /* ------------- */
/* Version 1.8 */ /* Version 1.9 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2007-2016 */ /* (C) Copyright to the author Olivier BERTRAND 2007-2017 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -375,10 +375,18 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db, ...@@ -375,10 +375,18 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db,
if (!port) if (!port)
port = mysqld_port; port = mysqld_port;
if (!strnicmp(srcdef, "select ", 7)) { if (!strnicmp(srcdef, "select ", 7) || strstr(srcdef, "%s")) {
query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 9); query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 10);
strcat(strcpy(query, srcdef), " LIMIT 0");
} else if (strstr(srcdef, "%s"))
sprintf(query, srcdef, "1=1"); // dummy where clause
else
strcpy(query, srcdef);
if (!strnicmp(srcdef, "select ", 7))
strcat(query, " LIMIT 0");
} else
query = (char *)srcdef; query = (char *)srcdef;
// Open a MySQL connection for this table // Open a MySQL connection for this table
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "xobject.h" #include "xobject.h"
//#include "kindex.h"
#include "xtable.h" #include "xtable.h"
#include "tabext.h"
#include "odbccat.h" #include "odbccat.h"
#include "tabodbc.h" #include "tabodbc.h"
#include "plgcnx.h" // For DB types #include "plgcnx.h" // For DB types
...@@ -413,12 +413,20 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table, ...@@ -413,12 +413,20 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/**************************************************************************/ /**************************************************************************/
PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop) PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop)
{ {
char *sqry;
ODBConn *ocp = new(g) ODBConn(g, NULL); ODBConn *ocp = new(g) ODBConn(g, NULL);
if (ocp->Open(dsn, sop, 10) < 1) // openReadOnly + noOdbcDialog if (ocp->Open(dsn, sop, 10) < 1) // openReadOnly + noOdbcDialog
return NULL; return NULL;
return ocp->GetMetaData(g, dsn, src); if (strstr(src, "%s")) {
// Place holder for an eventual where clause
sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 3);
sprintf(sqry, src, "1=1", "1=1"); // dummy where clause
} else
sqry = src;
return ocp->GetMetaData(g, dsn, sqry);
} // end of ODBCSrcCols } // end of ODBCSrcCols
#if 0 #if 0
...@@ -1417,7 +1425,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) ...@@ -1417,7 +1425,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
b = true; b = true;
if (trace) if (trace)
htrc("ExecDirect hstmt=%p %.64s\n", hstmt, sql); htrc("ExecDirect hstmt=%p %.256s\n", hstmt, sql);
if (m_Tdb->Srcdef) { if (m_Tdb->Srcdef) {
// Be sure this is a query returning a result set // Be sure this is a query returning a result set
......
/************** PlgDBSem H Declares Source Code File (.H) **************/ /************** PlgDBSem H Declares Source Code File (.H) **************/
/* Name: PLGDBSEM.H Version 3.7 */ /* Name: PLGDBSEM.H Version 3.7 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */ /* */
/* This file contains the CONNECT storage engine definitions. */ /* This file contains the CONNECT storage engine definitions. */
/***********************************************************************/ /***********************************************************************/
...@@ -57,7 +57,7 @@ enum TABTYPE {TAB_UNDEF = 0, /* Table of undefined type */ ...@@ -57,7 +57,7 @@ enum TABTYPE {TAB_UNDEF = 0, /* Table of undefined type */
TAB_FIX = 2, /* Fixed column offset, fixed LRECL */ TAB_FIX = 2, /* Fixed column offset, fixed LRECL */
TAB_BIN = 3, /* Like FIX but can have binary fields */ TAB_BIN = 3, /* Like FIX but can have binary fields */
TAB_CSV = 4, /* DOS files with CSV records */ TAB_CSV = 4, /* DOS files with CSV records */
TAB_FMT = 5, /* DOS files with formatted recordss */ TAB_FMT = 5, /* DOS files with formatted records */
TAB_DBF = 6, /* DBF Dbase or Foxpro files */ TAB_DBF = 6, /* DBF Dbase or Foxpro files */
TAB_XML = 7, /* XML or HTML files */ TAB_XML = 7, /* XML or HTML files */
TAB_INI = 8, /* INI or CFG files */ TAB_INI = 8, /* INI or CFG files */
...@@ -212,11 +212,24 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */ ...@@ -212,11 +212,24 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */
OP_SUB = 17, /* Expression Substract operator */ OP_SUB = 17, /* Expression Substract operator */
OP_MULT = 18, /* Expression Multiply operator */ OP_MULT = 18, /* Expression Multiply operator */
OP_DIV = 19, /* Expression Divide operator */ OP_DIV = 19, /* Expression Divide operator */
OP_NOP = 21, /* Scalar function is nopped */
OP_NUM = 22, /* Scalar function Op Num */ OP_NUM = 22, /* Scalar function Op Num */
OP_ABS = 23, /* Scalar function Op Abs */
OP_MAX = 24, /* Scalar function Op Max */ OP_MAX = 24, /* Scalar function Op Max */
OP_MIN = 25, /* Scalar function Op Min */ OP_MIN = 25, /* Scalar function Op Min */
OP_EXP = 36, /* Scalar function Op Exp */
OP_FDISK = 94, /* Operator Disk of fileid */
OP_FPATH = 95, /* Operator Path of fileid */
OP_FNAME = 96, /* Operator Name of fileid */
OP_FTYPE = 97, /* Operator Type of fileid */
OP_LAST = 82, /* Index operator Find Last */
OP_FIRST = 106, /* Index operator Find First */
OP_NEXT = 107, /* Index operator Find Next */
OP_SAME = 108, /* Index operator Find Next Same */
OP_FSTDIF = 109, /* Index operator Find First dif */
OP_NXTDIF = 110, /* Index operator Find Next dif */
OP_PREV = 116}; /* Index operator Find Previous */
#if 0
OP_NOP = 21, /* Scalar function is nopped */
OP_ABS = 23, /* Scalar function Op Abs */
OP_CEIL = 26, /* Scalar function Op Ceil */ OP_CEIL = 26, /* Scalar function Op Ceil */
OP_FLOOR = 27, /* Scalar function Op Floor */ OP_FLOOR = 27, /* Scalar function Op Floor */
OP_MOD = 28, /* Scalar function Op Mod */ OP_MOD = 28, /* Scalar function Op Mod */
...@@ -312,6 +325,7 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */ ...@@ -312,6 +325,7 @@ enum OPVAL {OP_EQ = 1, /* Filtering operator = */
OP_REMOVE = 201, /* Scalar function Op Remove */ OP_REMOVE = 201, /* Scalar function Op Remove */
OP_RENAME = 202, /* Scalar function Op Rename */ OP_RENAME = 202, /* Scalar function Op Rename */
OP_FCOMP = 203}; /* Scalar function Op Compare */ OP_FCOMP = 203}; /* Scalar function Op Compare */
#endif // 0
enum TUSE {USE_NO = 0, /* Table is not yet linearized */ enum TUSE {USE_NO = 0, /* Table is not yet linearized */
USE_LIN = 1, /* Table is linearized */ USE_LIN = 1, /* Table is linearized */
...@@ -356,6 +370,7 @@ typedef class XOBJECT *PXOB; ...@@ -356,6 +370,7 @@ typedef class XOBJECT *PXOB;
typedef class COLBLK *PCOL; typedef class COLBLK *PCOL;
typedef class TDB *PTDB; typedef class TDB *PTDB;
typedef class TDBASE *PTDBASE; typedef class TDBASE *PTDBASE;
typedef class TDBEXT *PTDBEXT;
typedef class TDBDOS *PTDBDOS; typedef class TDBDOS *PTDBDOS;
typedef class TDBFIX *PTDBFIX; typedef class TDBFIX *PTDBFIX;
typedef class TDBFMT *PTDBFMT; typedef class TDBFMT *PTDBFMT;
...@@ -374,6 +389,7 @@ typedef class KXYCOL *PXCOL; ...@@ -374,6 +389,7 @@ typedef class KXYCOL *PXCOL;
typedef class CATALOG *PCATLG; typedef class CATALOG *PCATLG;
typedef class RELDEF *PRELDEF; typedef class RELDEF *PRELDEF;
typedef class TABDEF *PTABDEF; typedef class TABDEF *PTABDEF;
typedef class EXTDEF *PEXTBDEF;
typedef class DOSDEF *PDOSDEF; typedef class DOSDEF *PDOSDEF;
typedef class CSVDEF *PCSVDEF; typedef class CSVDEF *PCSVDEF;
typedef class VCTDEF *PVCTDEF; typedef class VCTDEF *PVCTDEF;
...@@ -619,4 +635,4 @@ int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode) ...@@ -619,4 +635,4 @@ int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode)
DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir); DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir);
char *MakeEscape(PGLOBAL g, char* str, char q); char *MakeEscape(PGLOBAL g, char* str, char q);
DllExport bool PushWarning(PGLOBAL, PTDBASE, int level = 1); DllExport bool PushWarning(PGLOBAL, PTDB, int level = 1);
...@@ -621,8 +621,8 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int) ...@@ -621,8 +621,8 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int)
/***********************************************************************/ /***********************************************************************/
PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
{ {
RECFM rfm; RECFM rfm;
PTDBASE tdbp = NULL; PTDB tdbp = NULL;
// If define block not here yet, get it now // If define block not here yet, get it now
if (!Pxdef && !(Pxdef = GetXdef(g))) if (!Pxdef && !(Pxdef = GetXdef(g)))
...@@ -632,7 +632,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -632,7 +632,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
/* Allocate a TDB of the proper type. */ /* Allocate a TDB of the proper type. */
/* Column blocks will be allocated only when needed. */ /* Column blocks will be allocated only when needed. */
/*********************************************************************/ /*********************************************************************/
if (!(tdbp = (PTDBASE)Pxdef->GetTable(g, mode))) if (!(tdbp = Pxdef->GetTable(g, mode)))
return NULL; return NULL;
else else
rfm = tdbp->GetFtype(); rfm = tdbp->GetFtype();
......
...@@ -64,15 +64,16 @@ class DllExport RELDEF : public BLOCK { // Relation definition block ...@@ -64,15 +64,16 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
}; // end of RELDEF }; // end of RELDEF
/***********************************************************************/ /***********************************************************************/
/* These classes correspond to the data base description contained in */ /* This class corresponds to the data base description for tables */
/* a .XDB file the A.M. DOS, FIX, CSV, MAP, BIN, VCT, PLG, ODBC, DOM. */ /* of type DOS, FIX, CSV, DBF, BIN, VCT, JSON, XML... */
/***********************************************************************/ /***********************************************************************/
class DllExport TABDEF : public RELDEF { /* Logical table descriptor */ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
friend class CATALOG; friend class CATALOG;
friend class PLUGCAT; friend class PLUGCAT;
friend class MYCAT; friend class MYCAT;
friend class TDBASE; friend class TDB;
public: friend class TDBEXT;
public:
// Constructor // Constructor
TABDEF(void); // Constructor TABDEF(void); // Constructor
...@@ -112,11 +113,11 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */ ...@@ -112,11 +113,11 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
int Sort; /* Table already sorted ??? */ int Sort; /* Table already sorted ??? */
int Multiple; /* 0: No 1: DIR 2: Section 3: filelist */ int Multiple; /* 0: No 1: DIR 2: Section 3: filelist */
int Degree; /* Number of columns in the table */ int Degree; /* Number of columns in the table */
int Pseudo; /* Bit: 1 ROWID Ok, 2 FILEID Ok */ int Pseudo; /* Bit: 1 ROWID }Ok, 2 FILEID Ok */
bool Read_Only; /* true for read only tables */ bool Read_Only; /* true for read only tables */
const CHARSET_INFO *m_data_charset; const CHARSET_INFO *m_data_charset;
const char *csname; /* Table charset name */ const char *csname; /* Table charset name */
}; // end of TABDEF }; // end of TABDEF
/***********************************************************************/ /***********************************************************************/
/* Externally defined OEM tables. */ /* Externally defined OEM tables. */
...@@ -190,11 +191,12 @@ class DllExport COLCRT : public BLOCK { /* Column description block ...@@ -190,11 +191,12 @@ class DllExport COLCRT : public BLOCK { /* Column description block
/***********************************************************************/ /***********************************************************************/
/* Column definition block. */ /* Column definition block. */
/***********************************************************************/ /***********************************************************************/
class DllExport COLDEF : public COLCRT { /* Column description block */ class DllExport COLDEF : public COLCRT { /* Column description block */
friend class TABDEF; friend class TABDEF;
friend class COLBLK; friend class COLBLK;
friend class DBFFAM; friend class DBFFAM;
friend class TDBASE; friend class TDB;
friend class TDBASE;
friend class TDBDOS; friend class TDBDOS;
public: public:
COLDEF(void); // Constructor COLDEF(void); // Constructor
......
...@@ -504,7 +504,7 @@ TDBDOS::TDBDOS(PGLOBAL g, PTDBDOS tdbp) : TDBASE(tdbp) ...@@ -504,7 +504,7 @@ TDBDOS::TDBDOS(PGLOBAL g, PTDBDOS tdbp) : TDBASE(tdbp)
} // end of TDBDOS copy constructor } // end of TDBDOS copy constructor
// Method // Method
PTDB TDBDOS::CopyOne(PTABS t) PTDB TDBDOS::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PDOSCOL cp1, cp2; PDOSCOL cp1, cp2;
...@@ -518,7 +518,7 @@ PTDB TDBDOS::CopyOne(PTABS t) ...@@ -518,7 +518,7 @@ PTDB TDBDOS::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Allocate DOS column description block. */ /* Allocate DOS column description block. */
......
...@@ -142,7 +142,7 @@ class DllExport TDBDOS : public TDBASE { ...@@ -142,7 +142,7 @@ class DllExport TDBDOS : public TDBASE {
{return (PTDB)new(g) TDBDOS(g, this);} {return (PTDB)new(g) TDBDOS(g, this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual void ResetDB(void) {Txfp->Reset();} virtual void ResetDB(void) {Txfp->Reset();}
virtual bool IsUsingTemp(PGLOBAL g); virtual bool IsUsingTemp(PGLOBAL g);
virtual bool IsIndexed(void) {return Indxd;} virtual bool IsIndexed(void) {return Indxd;}
......
This diff is collapsed.
/*************** Tabext H Declares Source Code File (.H) ***************/
/* Name: TABEXT.H Version 1.0 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2017 */
/* */
/* This is the EXTDEF, TABEXT and EXTCOL classes definitions. */
/***********************************************************************/
#ifndef __TABEXT_H
#define __TABEXTF_H
#include "reldef.h"
typedef class ALIAS *PAL;
class ALIAS : public BLOCK {
public:
ALIAS(PAL x, PSZ n, PSZ a, bool h)
{Next = x, Name = n, Alias = a, Having = h;}
PAL Next;
PSZ Name;
PSZ Alias;
bool Having;
}; // end of class ALIAS
// Condition filter structure
class CONDFIL : public BLOCK {
public:
// Constructor
CONDFIL(const Item *cond, uint idx, AMT type);
// Functions
int Init(PGLOBAL g, PHC hc);
const char *Chk(const char *cln, bool *h);
// Members
const Item *Cond;
AMT Type;
uint Idx;
OPVAL Op;
PCMD Cmds;
PAL Alist;
bool All;
bool Bd;
bool Hv;
char *Body;
char *Having;
}; // end of class CONDFIL
/***********************************************************************/
/* This class corresponds to the data base description for external */
/* tables of type MYSQL, ODBC, JDBC... */
/***********************************************************************/
class DllExport EXTDEF : public TABDEF { /* EXT table */
friend TDBEXT;
public:
// Constructor
EXTDEF(void); // Constructor
// Implementation
virtual const char *GetType(void) { return "EXT"; }
inline PSZ GetTabname(void) { return Tabname; }
inline PSZ GetTabschema(void) { return Tabschema; }
inline PSZ GetUsername(void) { return Username; };
inline PSZ GetPassword(void) { return Password; };
inline PSZ GetTabcat(void) { return Tabcat; }
inline PSZ GetSrcdef(void) { return Srcdef; }
inline char GetSep(void) { return (Sep) ? *Sep : 0; }
inline int GetQuoted(void) { return Quoted; }
inline int GetOptions(void) { return Options; }
// Methods
virtual int Indexable(void) { return 2; }
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
protected:
// Members
PSZ Tabname; /* External table name */
PSZ Tabschema; /* External table schema */
PSZ Username; /* User connect name */
PSZ Password; /* Password connect info */
PSZ Tabcat; /* External table catalog */
PSZ Tabtyp; /* Catalog table type */
PSZ Colpat; /* Catalog column pattern */
PSZ Srcdef; /* The source table SQL definition */
PSZ Qchar; /* Identifier quoting character */
PSZ Qrystr; /* The original query */
PSZ Sep; /* Decimal separator */
//PSZ Alias; /* Column alias list */
PSZ Phpos; /* Place holer positions */
int Options; /* Open connection options */
int Cto; /* Open connection timeout */
int Qto; /* Query (command) timeout */
int Quoted; /* Identifier quoting level */
int Maxerr; /* Maxerr for an Exec table */
int Maxres; /* Maxres for a catalog table */
int Memory; /* Put result set in memory */
bool Scrollable; /* Use scrollable cursor */
bool Xsrc; /* Execution type */
}; // end of EXTDEF
/***********************************************************************/
/* This is the base class for all external tables. */
/***********************************************************************/
class DllExport TDBEXT : public TDB {
public:
// Constructors
TDBEXT(EXTDEF *tdp);
TDBEXT(PTDBEXT tdbp);
// Implementation
// Properties
virtual bool IsRemote(void) { return true; }
// Methods
virtual PSZ GetServer(void) { return "Remote"; }
virtual int GetRecpos(void);
// Database routines
virtual int GetMaxSize(PGLOBAL g);
virtual int GetProgMax(PGLOBAL g);
protected:
// Internal functions
virtual bool MakeSQL(PGLOBAL g, bool cnt);
//virtual bool MakeInsert(PGLOBAL g);
virtual bool MakeCommand(PGLOBAL g);
int Decode(char *utf, char *buf, size_t n);
// Members
PQRYRES Qrp; // Points to storage result
PSTRG Query; // Constructed SQL query
char *TableName; // Points to ODBC table name
char *Schema; // Points to ODBC table Schema
char *User; // User connect info
char *Pwd; // Password connect info
char *Catalog; // Points to ODBC table Catalog
char *Srcdef; // The source table SQL definition
char *Count; // Points to count(*) SQL statement
//char *Where; // Points to local where clause
char *Quote; // The identifier quoting character
char *MulConn; // Used for multiple ODBC tables
char *DBQ; // The address part of Connect string
char *Qrystr; // The original query
char Sep; // The decimal separator
int Options; // Connect options
int Cto; // Connect timeout
int Qto; // Query timeout
int Quoted; // The identifier quoting level
int Fpos; // Position of last read record
int Curpos; // Cursor position of last fetch
int AftRows; // The number of affected rows
int Rows; // Rowset size
int CurNum; // Current buffer line number
int Rbuf; // Number of lines read in buffer
int BufSize; // Size of connect string buffer
int Nparm; // The number of statement parameters
int Memory; // 0: No 1: Alloc 2: Put 3: Get
int Ncol; // The column number (JDBC)
bool Scrollable; // Use scrollable cursor
bool Placed; // True for position reading
}; // end of class TDBEXT
/***********************************************************************/
/* Virual class EXTCOL: external column. */
/***********************************************************************/
class DllExport EXTCOL : public COLBLK {
friend class TDBEXT;
public:
// Constructor
EXTCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am);
EXTCOL(PEXTCOL colp, PTDB tdbp); // Constructor used in copy process
// Implementation
inline int GetRank(void) { return Rank; }
inline void SetRank(int k) { Rank = k; }
//inline PVBLK GetBlkp(void) {return Blkp;}
inline void SetCrp(PCOLRES crp) { Crp = crp; }
// Methods
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL) = 0;
virtual void WriteColumn(PGLOBAL) = 0;
protected:
// Constructor for count(*) column
EXTCOL(void);
// Members
PCOLRES Crp; // To storage result
void *Bufp; // To extended buffer
PVBLK Blkp; // To Value Block
PVAL To_Val; // To value used for Insert
int Rank; // Rank (position) number in the query
//int Flag; // ???
}; // end of class EXTCOL
#endif // __TABEXT_H
...@@ -77,7 +77,7 @@ TDBFIX::TDBFIX(PGLOBAL g, PTDBFIX tdbp) : TDBDOS(g, tdbp) ...@@ -77,7 +77,7 @@ TDBFIX::TDBFIX(PGLOBAL g, PTDBFIX tdbp) : TDBDOS(g, tdbp)
} // end of TDBFIX copy constructor } // end of TDBFIX copy constructor
// Method // Method
PTDB TDBFIX::CopyOne(PTABS t) PTDB TDBFIX::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PGLOBAL g = t->G; PGLOBAL g = t->G;
...@@ -105,7 +105,7 @@ PTDB TDBFIX::CopyOne(PTABS t) ...@@ -105,7 +105,7 @@ PTDB TDBFIX::CopyOne(PTABS t)
} // endif Ftype } // endif Ftype
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Reset read/write position values. */ /* Reset read/write position values. */
......
...@@ -34,7 +34,7 @@ class DllExport TDBFIX : public TDBDOS { ...@@ -34,7 +34,7 @@ class DllExport TDBFIX : public TDBDOS {
{return (PTDB)new(g) TDBFIX(g, this);} {return (PTDB)new(g) TDBFIX(g, this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual void ResetDB(void); virtual void ResetDB(void);
virtual bool IsUsingTemp(PGLOBAL g); virtual bool IsUsingTemp(PGLOBAL g);
virtual int RowNumber(PGLOBAL g, bool b = false); virtual int RowNumber(PGLOBAL g, bool b = false);
......
...@@ -661,7 +661,7 @@ TDBCSV::TDBCSV(PGLOBAL g, PTDBCSV tdbp) : TDBDOS(g, tdbp) ...@@ -661,7 +661,7 @@ TDBCSV::TDBCSV(PGLOBAL g, PTDBCSV tdbp) : TDBDOS(g, tdbp)
} // end of TDBCSV copy constructor } // end of TDBCSV copy constructor
// Method // Method
PTDB TDBCSV::CopyOne(PTABS t) PTDB TDBCSV::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PCSVCOL cp1, cp2; PCSVCOL cp1, cp2;
...@@ -675,7 +675,7 @@ PTDB TDBCSV::CopyOne(PTABS t) ...@@ -675,7 +675,7 @@ PTDB TDBCSV::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Allocate CSV column description block. */ /* Allocate CSV column description block. */
...@@ -1169,7 +1169,7 @@ TDBFMT::TDBFMT(PGLOBAL g, PTDBFMT tdbp) : TDBCSV(g, tdbp) ...@@ -1169,7 +1169,7 @@ TDBFMT::TDBFMT(PGLOBAL g, PTDBFMT tdbp) : TDBCSV(g, tdbp)
} // end of TDBFMT copy constructor } // end of TDBFMT copy constructor
// Method // Method
PTDB TDBFMT::CopyOne(PTABS t) PTDB TDBFMT::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PCSVCOL cp1, cp2; PCSVCOL cp1, cp2;
...@@ -1186,7 +1186,7 @@ PTDB TDBFMT::CopyOne(PTABS t) ...@@ -1186,7 +1186,7 @@ PTDB TDBFMT::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Allocate FMT column description block. */ /* Allocate FMT column description block. */
......
...@@ -65,7 +65,7 @@ class DllExport TDBCSV : public TDBDOS { ...@@ -65,7 +65,7 @@ class DllExport TDBCSV : public TDBDOS {
{return (PTDB)new(g) TDBCSV(g, this);} {return (PTDB)new(g) TDBCSV(g, this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
//virtual bool IsUsingTemp(PGLOBAL g); //virtual bool IsUsingTemp(PGLOBAL g);
virtual int GetBadLines(void) {return (int)Nerr;} virtual int GetBadLines(void) {return (int)Nerr;}
...@@ -148,7 +148,7 @@ class DllExport TDBFMT : public TDBCSV { ...@@ -148,7 +148,7 @@ class DllExport TDBFMT : public TDBCSV {
{return (PTDB)new(g) TDBFMT(g, this);} {return (PTDB)new(g) TDBFMT(g, this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
// Database routines // Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
......
This diff is collapsed.
This diff is collapsed.
...@@ -574,7 +574,7 @@ TDBJSN::TDBJSN(TDBJSN *tdbp) : TDBDOS(NULL, tdbp) ...@@ -574,7 +574,7 @@ TDBJSN::TDBJSN(TDBJSN *tdbp) : TDBDOS(NULL, tdbp)
} // end of TDBJSN copy constructor } // end of TDBJSN copy constructor
// Used for update // Used for update
PTDB TDBJSN::CopyOne(PTABS t) PTDB TDBJSN::Clone(PTABS t)
{ {
G = NULL; G = NULL;
PTDB tp; PTDB tp;
...@@ -589,7 +589,7 @@ PTDB TDBJSN::CopyOne(PTABS t) ...@@ -589,7 +589,7 @@ PTDB TDBJSN::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Allocate JSN column description block. */ /* Allocate JSN column description block. */
...@@ -1578,7 +1578,7 @@ TDBJSON::TDBJSON(PJTDB tdbp) : TDBJSN(tdbp) ...@@ -1578,7 +1578,7 @@ TDBJSON::TDBJSON(PJTDB tdbp) : TDBJSN(tdbp)
} // end of TDBJSON copy constructor } // end of TDBJSON copy constructor
// Used for update // Used for update
PTDB TDBJSON::CopyOne(PTABS t) PTDB TDBJSON::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PJCOL cp1, cp2; PJCOL cp1, cp2;
...@@ -1592,7 +1592,7 @@ PTDB TDBJSON::CopyOne(PTABS t) ...@@ -1592,7 +1592,7 @@ PTDB TDBJSON::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Make the document tree from the object path. */ /* Make the document tree from the object path. */
......
...@@ -82,7 +82,7 @@ class TDBJSN : public TDBDOS { ...@@ -82,7 +82,7 @@ class TDBJSN : public TDBDOS {
void SetG(PGLOBAL g) {G = g;} void SetG(PGLOBAL g) {G = g;}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual PCOL InsertSpecialColumn(PCOL colp); virtual PCOL InsertSpecialColumn(PCOL colp);
virtual int RowNumber(PGLOBAL g, bool b = FALSE) virtual int RowNumber(PGLOBAL g, bool b = FALSE)
...@@ -188,7 +188,7 @@ class TDBJSON : public TDBJSN { ...@@ -188,7 +188,7 @@ class TDBJSON : public TDBJSN {
PJAR GetDoc(void) {return Doc;} PJAR GetDoc(void) {return Doc;}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
// Database routines // Database routines
virtual int Cardinality(PGLOBAL g); virtual int Cardinality(PGLOBAL g);
......
This diff is collapsed.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
//#include "catalog.h" //#include "catalog.h"
#include "reldef.h" //#include "reldef.h"
#include "xtable.h" #include "xtable.h"
#include "colblk.h" #include "colblk.h"
#include "tabmac.h" #include "tabmac.h"
......
...@@ -52,7 +52,7 @@ class TDBMAC : public TDBASE { ...@@ -52,7 +52,7 @@ class TDBMAC : public TDBASE {
//virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMAC(g, this);} //virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMAC(g, this);}
// Methods // Methods
//virtual PTDB CopyOne(PTABS t); //virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return N;} virtual int GetRecpos(void) {return N;}
virtual int RowNumber(PGLOBAL g, bool b = false) {return N;} virtual int RowNumber(PGLOBAL g, bool b = false) {return N;}
......
/************* TabMul C++ Program Source Code File (.CPP) **************/ /************* TabMul C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABMUL */ /* PROGRAM NAME: TABMUL */
/* ------------- */ /* ------------- */
/* Version 1.7 */ /* Version 1.8 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to PlugDB Software Development 2003 - 2015 */ /* (C) Copyright to PlugDB Software Development 2003 - 2017 */
/* Author: Olivier BERTRAND */ /* Author: Olivier BERTRAND */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
/***********************************************************************/ /***********************************************************************/
/* TABMUL constructors. */ /* TABMUL constructors. */
/***********************************************************************/ /***********************************************************************/
TDBMUL::TDBMUL(PTDBASE tdbp) : TDBASE(tdbp->GetDef()) TDBMUL::TDBMUL(PTDB tdbp) : TDBASE(tdbp->GetDef())
{ {
Tdbp = tdbp; Tdbp = tdbp;
Filenames = NULL; Filenames = NULL;
...@@ -94,22 +94,22 @@ TDBMUL::TDBMUL(PTDBMUL tdbp) : TDBASE(tdbp) ...@@ -94,22 +94,22 @@ TDBMUL::TDBMUL(PTDBMUL tdbp) : TDBASE(tdbp)
} // end of TDBMUL copy constructor } // end of TDBMUL copy constructor
// Method // Method
PTDB TDBMUL::CopyOne(PTABS t) PTDB TDBMUL::Clone(PTABS t)
{ {
PTDBMUL tp; PTDBMUL tp;
PGLOBAL g = t->G; // Is this really useful ??? PGLOBAL g = t->G; // Is this really useful ???
tp = new(g) TDBMUL(this); tp = new(g) TDBMUL(this);
tp->Tdbp = (PTDBASE)Tdbp->CopyOne(t); tp->Tdbp = Tdbp->Clone(t);
tp->Columns = tp->Tdbp->GetColumns(); tp->Columns = tp->Tdbp->GetColumns();
return tp; return tp;
} // end of CopyOne } // end of Clone
PTDB TDBMUL::Duplicate(PGLOBAL g) PTDB TDBMUL::Duplicate(PGLOBAL g)
{ {
PTDBMUL tmup = new(g) TDBMUL(this); PTDBMUL tmup = new(g) TDBMUL(this);
tmup->Tdbp = (PTDBASE)Tdbp->Duplicate(g); tmup->Tdbp = Tdbp->Duplicate(g);
return tmup; return tmup;
} // end of Duplicate } // end of Duplicate
...@@ -658,7 +658,7 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp) ...@@ -658,7 +658,7 @@ TDBDIR::TDBDIR(PTDBDIR tdbp) : TDBASE(tdbp)
} // end of TDBDIR copy constructor } // end of TDBDIR copy constructor
// Method // Method
PTDB TDBDIR::CopyOne(PTABS t) PTDB TDBDIR::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PGLOBAL g = t->G; // Is this really useful ??? PGLOBAL g = t->G; // Is this really useful ???
...@@ -666,7 +666,7 @@ PTDB TDBDIR::CopyOne(PTABS t) ...@@ -666,7 +666,7 @@ PTDB TDBDIR::CopyOne(PTABS t)
tp = new(g) TDBDIR(this); tp = new(g) TDBDIR(this);
tp->SetColumns(Columns); tp->SetColumns(Columns);
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Initialize/get the components of the search file pattern. */ /* Initialize/get the components of the search file pattern. */
...@@ -974,7 +974,7 @@ TDBSDR::TDBSDR(PTDBSDR tdbp) : TDBDIR(tdbp) ...@@ -974,7 +974,7 @@ TDBSDR::TDBSDR(PTDBSDR tdbp) : TDBDIR(tdbp)
} // end of TDBSDR copy constructor } // end of TDBSDR copy constructor
// Method // Method
PTDB TDBSDR::CopyOne(PTABS t) PTDB TDBSDR::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PGLOBAL g = t->G; // Is this really useful ??? PGLOBAL g = t->G; // Is this really useful ???
...@@ -982,7 +982,7 @@ PTDB TDBSDR::CopyOne(PTABS t) ...@@ -982,7 +982,7 @@ PTDB TDBSDR::CopyOne(PTABS t)
tp = new(g) TDBSDR(this); tp = new(g) TDBSDR(this);
tp->SetColumns(Columns); tp->SetColumns(Columns);
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* SDR GetMaxSize: returns the number of retrieved files. */ /* SDR GetMaxSize: returns the number of retrieved files. */
...@@ -1251,7 +1251,7 @@ TDBDHR::TDBDHR(PTDBDHR tdbp) : TDBASE(tdbp) ...@@ -1251,7 +1251,7 @@ TDBDHR::TDBDHR(PTDBDHR tdbp) : TDBASE(tdbp)
} // end of TDBDHR copy constructor } // end of TDBDHR copy constructor
// Method // Method
PTDB TDBDHR::CopyOne(PTABS t) PTDB TDBDHR::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PGLOBAL g = t->G; // Is this really useful ??? PGLOBAL g = t->G; // Is this really useful ???
...@@ -1259,7 +1259,7 @@ PTDB TDBDHR::CopyOne(PTABS t) ...@@ -1259,7 +1259,7 @@ PTDB TDBDHR::CopyOne(PTABS t)
tp = new(g) TDBDHR(this); tp = new(g) TDBDHR(this);
tp->Columns = Columns; tp->Columns = Columns;
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Allocate DHR column description block. */ /* Allocate DHR column description block. */
......
/*************** Tabmul H Declares Source Code File (.H) ***************/ /*************** Tabmul H Declares Source Code File (.H) ***************/
/* Name: TABMUL.H Version 1.4 */ /* Name: TABMUL.H Version 1.5 */
/* */ /* */
/* (C) Copyright to PlugDB Software Development 2003-2012 */ /* (C) Copyright to PlugDB Software Development 2003-2017 */
/* Author: Olivier BERTRAND */ /* Author: Olivier BERTRAND */
/* */ /* */
/* This file contains the TDBMUL and TDBDIR classes declares. */ /* This file contains the TDBMUL and TDBDIR classes declares. */
...@@ -28,7 +28,7 @@ class DllExport TDBMUL : public TDBASE { ...@@ -28,7 +28,7 @@ class DllExport TDBMUL : public TDBASE {
//friend class MULCOL; //friend class MULCOL;
public: public:
// Constructor // Constructor
TDBMUL(PTDBASE tdbp); TDBMUL(PTDB tdbp);
TDBMUL(PTDBMUL tdbp); TDBMUL(PTDBMUL tdbp);
// Implementation // Implementation
...@@ -37,7 +37,7 @@ class DllExport TDBMUL : public TDBASE { ...@@ -37,7 +37,7 @@ class DllExport TDBMUL : public TDBASE {
// Methods // Methods
virtual void ResetDB(void); virtual void ResetDB(void);
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual bool IsSame(PTDB tp) {return tp == (PTDB)Tdbp;} virtual bool IsSame(PTDB tp) {return tp == (PTDB)Tdbp;}
virtual PSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);} virtual PSZ GetFile(PGLOBAL g) {return Tdbp->GetFile(g);}
virtual int GetRecpos(void) {return 0;} virtual int GetRecpos(void) {return 0;}
...@@ -61,7 +61,7 @@ class DllExport TDBMUL : public TDBASE { ...@@ -61,7 +61,7 @@ class DllExport TDBMUL : public TDBASE {
protected: protected:
// Members // Members
TDBASE *Tdbp; // Points to a (file) table class PTDB Tdbp; // Points to a (file) table class
char* *Filenames; // Points to file names char* *Filenames; // Points to file names
int Rows; // Total rows of already read files int Rows; // Total rows of already read files
int Mul; // Type of multiple file list int Mul; // Type of multiple file list
...@@ -112,7 +112,7 @@ class TDBDIR : public TDBASE { ...@@ -112,7 +112,7 @@ class TDBDIR : public TDBASE {
{return (PTDB)new(g) TDBDIR(this);} {return (PTDB)new(g) TDBDIR(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return iFile;} virtual int GetRecpos(void) {return iFile;}
// Database routines // Database routines
...@@ -168,7 +168,7 @@ class TDBSDR : public TDBDIR { ...@@ -168,7 +168,7 @@ class TDBSDR : public TDBDIR {
{return (PTDB)new(g) TDBSDR(this);} {return (PTDB)new(g) TDBSDR(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
// Database routines // Database routines
virtual int GetMaxSize(PGLOBAL g); virtual int GetMaxSize(PGLOBAL g);
......
This diff is collapsed.
// TDBMYSQL.H Olivier Bertrand 2007-2014 // TDBMYSQL.H Olivier Bertrand 2007-2017
#include "myconn.h" // MySQL connection declares #include "myconn.h" // MySQL connection declares
typedef class MYSQLDEF *PMYDEF; typedef class MYSQLDEF *PMYDEF;
...@@ -18,7 +18,7 @@ typedef class MYSQLC *PMYC; ...@@ -18,7 +18,7 @@ typedef class MYSQLC *PMYC;
/***********************************************************************/ /***********************************************************************/
/* MYSQL table. */ /* MYSQL table. */
/***********************************************************************/ /***********************************************************************/
class MYSQLDEF : public TABDEF {/* Logical table description */ class MYSQLDEF : public EXTDEF {/* Logical table description */
friend class TDBMYSQL; friend class TDBMYSQL;
friend class TDBMYEXC; friend class TDBMYEXC;
friend class TDBMCL; friend class TDBMCL;
...@@ -27,19 +27,18 @@ class MYSQLDEF : public TABDEF {/* Logical table description */ ...@@ -27,19 +27,18 @@ class MYSQLDEF : public TABDEF {/* Logical table description */
// Constructor // Constructor
MYSQLDEF(void); MYSQLDEF(void);
// Implementation // Implementation
virtual const char *GetType(void) {return "MYSQL";} virtual const char *GetType(void) {return "MYSQL";}
inline PSZ GetHostname(void) {return Hostname;}; inline PSZ GetHostname(void) {return Hostname;};
inline PSZ GetDatabase(void) {return Database;}; //inline PSZ GetDatabase(void) {return Tabschema;};
inline PSZ GetTabname(void) {return Tabname;} //inline PSZ GetTabname(void) {return Tabname;}
inline PSZ GetSrcdef(void) {return Srcdef;} //inline PSZ GetSrcdef(void) {return Srcdef;}
inline PSZ GetUsername(void) {return Username;}; //inline PSZ GetUsername(void) {return Username;};
inline PSZ GetPassword(void) {return Password;}; //inline PSZ GetPassword(void) {return Password;};
inline int GetPortnumber(void) {return Portnumber;} inline int GetPortnumber(void) {return Portnumber;}
// Methods // Methods
virtual int Indexable(void) {return 2;} //virtual int Indexable(void) {return 2;}
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m); virtual PTDB GetTable(PGLOBAL g, MODE m);
bool ParseURL(PGLOBAL g, char *url, bool b = true); bool ParseURL(PGLOBAL g, char *url, bool b = true);
...@@ -48,27 +47,27 @@ class MYSQLDEF : public TABDEF {/* Logical table description */ ...@@ -48,27 +47,27 @@ class MYSQLDEF : public TABDEF {/* Logical table description */
protected: protected:
// Members // Members
PSZ Hostname; /* Host machine to use */ PSZ Hostname; /* Host machine to use */
PSZ Database; /* Database to be used by server */ //PSZ Tabschema; /* Database to be used by server */
PSZ Tabname; /* External table name */ //PSZ Tabname; /* External table name */
PSZ Srcdef; /* The source table SQL definition */ //PSZ Srcdef; /* The source table SQL definition */
PSZ Username; /* User logon name */ //PSZ Username; /* User logon name */
PSZ Password; /* Password logon info */ //PSZ Password; /* Password logon info */
PSZ Server; /* PServerID */ PSZ Server; /* PServerID */
PSZ Qrystr; /* The original query */ //PSZ Qrystr; /* The original query */
int Portnumber; /* MySQL port number (0 = default) */ int Portnumber; /* MySQL port number (0 = default) */
int Mxr; /* Maxerr for an Exec table */ //int Maxerr; /* Maxerr for an Exec table */
int Quoted; /* Identifier quoting level */ //int Quoted; /* Identifier quoting level */
bool Isview; /* true if this table is a MySQL view */ bool Isview; /* true if this table is a MySQL view */
bool Bind; /* Use prepared statement on insert */ bool Bind; /* Use prepared statement on insert */
bool Delayed; /* Delayed insert */ bool Delayed; /* Delayed insert */
bool Xsrc; /* Execution type */ //bool Xsrc; /* Execution type */
bool Huge; /* True for big table */ bool Huge; /* True for big table */
}; // end of MYSQLDEF }; // end of MYSQLDEF
/***********************************************************************/ /***********************************************************************/
/* This is the class declaration for the MYSQL table. */ /* This is the class declaration for the MYSQL table. */
/***********************************************************************/ /***********************************************************************/
class TDBMYSQL : public TDBASE { class TDBMYSQL : public TDBEXT {
friend class MYSQLCOL; friend class MYSQLCOL;
public: public:
// Constructor // Constructor
...@@ -80,7 +79,7 @@ class TDBMYSQL : public TDBASE { ...@@ -80,7 +79,7 @@ class TDBMYSQL : public TDBASE {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
//virtual int GetAffectedRows(void) {return AftRows;} //virtual int GetAffectedRows(void) {return AftRows;}
virtual int GetRecpos(void) {return N;} virtual int GetRecpos(void) {return N;}
virtual int GetProgMax(PGLOBAL g); virtual int GetProgMax(PGLOBAL g);
...@@ -88,12 +87,12 @@ class TDBMYSQL : public TDBASE { ...@@ -88,12 +87,12 @@ class TDBMYSQL : public TDBASE {
virtual int RowNumber(PGLOBAL g, bool b = false); virtual int RowNumber(PGLOBAL g, bool b = false);
virtual bool IsView(void) {return Isview;} virtual bool IsView(void) {return Isview;}
virtual PSZ GetServer(void) {return Server;} virtual PSZ GetServer(void) {return Server;}
void SetDatabase(LPCSTR db) {Database = (char*)db;} void SetDatabase(LPCSTR db) {Schema = (char*)db;}
// Database routines // Schema routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g); virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g); //virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g); virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g); virtual int ReadDB(PGLOBAL g);
virtual int WriteDB(PGLOBAL g); virtual int WriteDB(PGLOBAL g);
...@@ -111,7 +110,7 @@ class TDBMYSQL : public TDBASE { ...@@ -111,7 +110,7 @@ class TDBMYSQL : public TDBASE {
bool MakeSelect(PGLOBAL g, bool mx); bool MakeSelect(PGLOBAL g, bool mx);
bool MakeInsert(PGLOBAL g); bool MakeInsert(PGLOBAL g);
int BindColumns(PGLOBAL g); int BindColumns(PGLOBAL g);
int MakeCommand(PGLOBAL g); virtual bool MakeCommand(PGLOBAL g);
//int MakeUpdate(PGLOBAL g); //int MakeUpdate(PGLOBAL g);
//int MakeDelete(PGLOBAL g); //int MakeDelete(PGLOBAL g);
int SendCommand(PGLOBAL g); int SendCommand(PGLOBAL g);
...@@ -119,25 +118,25 @@ class TDBMYSQL : public TDBASE { ...@@ -119,25 +118,25 @@ class TDBMYSQL : public TDBASE {
// Members // Members
MYSQLC Myc; // MySQL connection class MYSQLC Myc; // MySQL connection class
MYSQL_BIND *Bind; // To the MySQL bind structure array MYSQL_BIND *Bind; // To the MySQL bind structure array
PSTRG Query; // Constructed SQL query //PSTRG Query; // Constructed SQL query
char *Host; // Host machine to use char *Host; // Host machine to use
char *User; // User logon info //char *User; // User logon info
char *Pwd; // Password logon info //char *Pwd; // Password logon info
char *Database; // Database to be used by server //char *Schema; // Database to be used by server
char *Tabname; // External table name //char *TableName; // External table name
char *Srcdef; // The source table SQL definition //char *Srcdef; // The source table SQL definition
char *Server; // The server ID char *Server; // The server ID
char *Qrystr; // The original query //char *Qrystr; // The original query
bool Fetched; // True when fetch was done bool Fetched; // True when fetch was done
bool Isview; // True if this table is a MySQL view bool Isview; // True if this table is a MySQL view
bool Prep; // Use prepared statement on insert bool Prep; // Use prepared statement on insert
bool Delayed; // Use delayed insert bool Delayed; // Use delayed insert
int m_Rc; // Return code from command int m_Rc; // Return code from command
int AftRows; // The number of affected rows //int AftRows; // The number of affected rows
int N; // The current table index int N; // The current table index
int Port; // MySQL port number (0 = default) int Port; // MySQL port number (0 = default)
int Nparm; // The number of statement parameters //int Nparm; // The number of statement parameters
int Quoted; // The identifier quoting level //int Quoted; // The identifier quoting level
}; // end of class TDBMYSQL }; // end of class TDBMYSQL
/***********************************************************************/ /***********************************************************************/
...@@ -162,9 +161,6 @@ class MYSQLCOL : public COLBLK { ...@@ -162,9 +161,6 @@ class MYSQLCOL : public COLBLK {
bool FindRank(PGLOBAL g); bool FindRank(PGLOBAL g);
protected: protected:
// Default constructor not to be used
MYSQLCOL(void) {}
// Members // Members
MYSQL_BIND *Bind; // This column bind structure pointer MYSQL_BIND *Bind; // This column bind structure pointer
PVAL To_Val; // To value used for Update/Insert PVAL To_Val; // To value used for Update/Insert
...@@ -187,7 +183,7 @@ class TDBMYEXC : public TDBMYSQL { ...@@ -187,7 +183,7 @@ class TDBMYEXC : public TDBMYSQL {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYEXC(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual bool IsView(void) {return Isview;} virtual bool IsView(void) {return Isview;}
// Database routines // Database routines
...@@ -228,9 +224,6 @@ class MYXCOL : public MYSQLCOL { ...@@ -228,9 +224,6 @@ class MYXCOL : public MYSQLCOL {
virtual void WriteColumn(PGLOBAL g); virtual void WriteColumn(PGLOBAL g);
protected: protected:
// Default constructor not to be used
MYXCOL(void) {}
// Members // Members
char *Buffer; // To get returned message char *Buffer; // To get returned message
int Flag; // Column content desc int Flag; // Column content desc
......
/************ TabOccur CPP Declares Source Code File (.CPP) ************/ /************ TabOccur CPP Declares Source Code File (.CPP) ************/
/* Name: TABOCCUR.CPP Version 1.1 */ /* Name: TABOCCUR.CPP Version 1.2 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2013 - 2015 */ /* (C) Copyright to the author Olivier BERTRAND 2013 - 2017 */
/* */ /* */
/* OCCUR: Table that provides a view of a source table where the */ /* OCCUR: Table that provides a view of a source table where the */
/* contain of several columns of the source table is placed in only */ /* contain of several columns of the source table is placed in only */
...@@ -39,12 +39,13 @@ ...@@ -39,12 +39,13 @@
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "reldef.h" #include "xtable.h"
#include "tabext.h"
//#include "reldef.h"
#include "filamtxt.h" #include "filamtxt.h"
#include "tabdos.h" #include "tabdos.h"
#include "tabcol.h" #include "tabcol.h"
#include "taboccur.h" #include "taboccur.h"
#include "xtable.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "ha_connect.h" #include "ha_connect.h"
......
This diff is collapsed.
This diff is collapsed.
/************ TabPivot C++ Program Source Code File (.CPP) *************/ /************ TabPivot C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABPIVOT */ /* PROGRAM NAME: TABPIVOT */
/* ------------- */ /* ------------- */
/* Version 1.6 */ /* Version 1.7 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "xtable.h" #include "xtable.h"
#include "tabext.h"
#include "tabcol.h" #include "tabcol.h"
#include "colblk.h" #include "colblk.h"
#include "tabmysql.h" #include "tabmysql.h"
...@@ -883,7 +884,7 @@ SRCCOL::SRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int n) ...@@ -883,7 +884,7 @@ SRCCOL::SRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int n)
/***********************************************************************/ /***********************************************************************/
/* Initialize the column as pointing to the source column. */ /* Initialize the column as pointing to the source column. */
/***********************************************************************/ /***********************************************************************/
bool SRCCOL::Init(PGLOBAL g, PTDBASE tp) bool SRCCOL::Init(PGLOBAL g, PTDB tp)
{ {
if (PRXCOL::Init(g, tp)) if (PRXCOL::Init(g, tp))
return true; return true;
......
...@@ -183,7 +183,7 @@ class SRCCOL : public PRXCOL { ...@@ -183,7 +183,7 @@ class SRCCOL : public PRXCOL {
using PRXCOL::Init; using PRXCOL::Init;
virtual void Reset(void) {} virtual void Reset(void) {}
void SetColumn(void); void SetColumn(void);
virtual bool Init(PGLOBAL g, PTDBASE tp); virtual bool Init(PGLOBAL g, PTDB tp);
bool CompareLast(void); bool CompareLast(void);
protected: protected:
......
...@@ -159,7 +159,7 @@ TDBINI::TDBINI(PTDBINI tdbp) : TDBASE(tdbp) ...@@ -159,7 +159,7 @@ TDBINI::TDBINI(PTDBINI tdbp) : TDBASE(tdbp)
} // end of TDBINI copy constructor } // end of TDBINI copy constructor
// Is this really useful ??? // Is this really useful ???
PTDB TDBINI::CopyOne(PTABS t) PTDB TDBINI::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PINICOL cp1, cp2; PINICOL cp1, cp2;
...@@ -173,7 +173,7 @@ PTDB TDBINI::CopyOne(PTABS t) ...@@ -173,7 +173,7 @@ PTDB TDBINI::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Get the section list from the INI file. */ /* Get the section list from the INI file. */
...@@ -565,7 +565,7 @@ TDBXIN::TDBXIN(PTDBXIN tdbp) : TDBINI(tdbp) ...@@ -565,7 +565,7 @@ TDBXIN::TDBXIN(PTDBXIN tdbp) : TDBINI(tdbp)
} // end of TDBXIN copy constructor } // end of TDBXIN copy constructor
// Is this really useful ??? // Is this really useful ???
PTDB TDBXIN::CopyOne(PTABS t) PTDB TDBXIN::Clone(PTABS t)
{ {
PTDB tp; PTDB tp;
PXINCOL cp1, cp2; PXINCOL cp1, cp2;
...@@ -579,7 +579,7 @@ PTDB TDBXIN::CopyOne(PTABS t) ...@@ -579,7 +579,7 @@ PTDB TDBXIN::CopyOne(PTABS t)
} // endfor cp1 } // endfor cp1
return tp; return tp;
} // end of CopyOne } // end of Clone
/***********************************************************************/ /***********************************************************************/
/* Get the key list from the INI file. */ /* Get the key list from the INI file. */
......
...@@ -57,7 +57,7 @@ class TDBINI : public TDBASE { ...@@ -57,7 +57,7 @@ class TDBINI : public TDBASE {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBINI(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return N;} virtual int GetRecpos(void) {return N;}
virtual int GetProgCur(void) {return N;} virtual int GetProgCur(void) {return N;}
//virtual int GetAffectedRows(void) {return 0;} //virtual int GetAffectedRows(void) {return 0;}
...@@ -136,7 +136,7 @@ class TDBXIN : public TDBINI { ...@@ -136,7 +136,7 @@ class TDBXIN : public TDBINI {
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBXIN(this);}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void); virtual int GetRecpos(void);
virtual bool SetRecpos(PGLOBAL g, int recpos); virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual void ResetDB(void) virtual void ResetDB(void)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -68,7 +68,7 @@ class DllExport TDBVCT : public TDBFIX { ...@@ -68,7 +68,7 @@ class DllExport TDBVCT : public TDBFIX {
bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;} bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB Clone(PTABS t);
virtual bool IsUsingTemp(PGLOBAL g); virtual bool IsUsingTemp(PGLOBAL g);
// Database routines // Database routines
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "plgdbsem.h" #include "plgdbsem.h"
#include "filter.h" #include "filter.h"
#include "xtable.h" #include "xtable.h"
#include "reldef.h" //#include "reldef.h"
#include "colblk.h" #include "colblk.h"
#include "mycat.h" // for FNC_COL #include "mycat.h" // for FNC_COL
#include "tabvir.h" #include "tabvir.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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