Commit 9df57eba authored by Olivier Bertrand's avatar Olivier Bertrand

- Adding parallelism to the TBL table type

modified:
  storage/connect/tabcol.h
  storage/connect/tabtbl.cpp
  storage/connect/tabtbl.h
  storage/connect/value.cpp
parent 0a01953c
......@@ -17,6 +17,7 @@
/***********************************************************************/
class DllExport XTAB: public BLOCK { // Table Name-Owner-Srcdef block.
friend class TDBPRX;
friend class TDBTBM;
public:
// Constructors
XTAB(LPCSTR name, LPCSTR srcdef = NULL);
......
This diff is collapsed.
/*************** TabTbl H Declares Source Code File (.H) ***************/
/* Name: TABTBL.H Version 1.2 */
/* Name: TABTBL.H Version 1.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2008-2013 */
/* */
......@@ -11,7 +11,29 @@
typedef class TBLDEF *PTBLDEF;
typedef class TDBTBL *PTDBTBL;
typedef class TDBTBM *PTDBTBM;
typedef class MYSQLC *PMYC;
/***********************************************************************/
/* Defines the structures used for distributed TBM tables. */
/***********************************************************************/
typedef struct _TBMtable *PTBMT;
typedef struct _TBMtable {
PTBMT Next; // Points to next data table struct
PTABLE Tap; // Points to the sub table
PGLOBAL G; // Needed in thread routine
bool Complete; // TRUE when all results are read
bool Ready; // TRUE when results are there
int Rows; // Total number of rows read so far
int ProgCur; // Current pos
int ProgMax; // Max pos
int Rc; // Return code
THD *Thd;
pthread_attr_t attr; // ???
pthread_t Tid; // CheckOpen thread ID
} TBMT;
/***********************************************************************/
/* TBL table. */
/***********************************************************************/
......@@ -32,6 +54,7 @@ class DllExport TBLDEF : public PRXDEF { /* Logical table description */
protected:
// Members
bool Accept; /* TRUE if bad tables are accepted */
bool Thread; /* Use thread for remote tables */
int Maxerr; /* Maximum number of bad tables */
int Ntables; /* Number of tables */
}; // end of TBLDEF
......@@ -41,7 +64,6 @@ class DllExport TBLDEF : public PRXDEF { /* Logical table description */
/***********************************************************************/
class DllExport TDBTBL : public TDBPRX {
friend class TBTBLK;
friend class TDBPLG;
public:
// Constructor
TDBTBL(PTBLDEF tdp = NULL);
......@@ -51,8 +73,8 @@ class DllExport TDBTBL : public TDBPRX {
// Methods
virtual void ResetDB(void);
virtual int GetRecpos(void) {return Rows;}
virtual int GetBadLines(void) {return (int)Nbf;}
virtual int GetRecpos(void) {return Rows;}
virtual int GetBadLines(void) {return (int)Nbc;}
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
......@@ -72,7 +94,7 @@ class DllExport TDBTBL : public TDBPRX {
PTABLE CurTable; // Points to the current table
bool Accept; // TRUE if bad tables are accepted
int Maxerr; // Maximum number of bad tables
int Nbf; // Number of bad connections
int Nbc; // Number of bad connections
int Rows; // Used for RowID
int Crp; // Used for CurPos
}; // end of class TDBTBL
......@@ -100,3 +122,44 @@ class TBTBLK : public TIDBLK {
protected:
// Must not have additional members
}; // end of class TBTBLK
/***********************************************************************/
/* This is the TBM Access Method class declaration. */
/***********************************************************************/
class DllExport TDBTBM : public TDBTBL {
friend class TBTBLK;
public:
// Constructor
TDBTBM(PTBLDEF tdp = NULL);
// Implementation
//virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
// Methods
virtual void ResetDB(void);
//virtual int GetRecpos(void) {return Rows;}
//virtual int GetBadLines(void) {return (int)Nbc;}
// Database routines
//virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
//virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL scp);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
protected:
// Internal functions
//bool InitTableList(PGLOBAL g);
//bool TestFil(PGLOBAL g, PFIL filp, PTABLE tabp);
bool OpenTables(PGLOBAL g);
int ReadNextRemote(PGLOBAL g);
// Members
PTBMT Tmp; // To data table TBMT structures
PTBMT Cmp; // Current data table PLGF (to move to TDBTBL)
PTBMT Bmp; // To bad (unconnected) PLGF structures
bool Done; // TRUE after first GetAllResults
int Nrc; // Number of remote connections
int Nlc; // Number of local connections
}; // end of class TDBTBM
......@@ -566,7 +566,7 @@ void TYPVAL<TYPE>::SetValue_char(char *p, int n)
if (minus && Tval)
Tval = - Tval;
if (trace)
if (trace > 1)
htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"),
GetTypeName(Type), Tval);
......@@ -585,7 +585,7 @@ void TYPVAL<double>::SetValue_char(char *p, int n)
buf[n] = '\0';
Tval = atof(buf);
if (trace)
if (trace > 1)
htrc(" setting double: '%s' -> %lf\n", buf, Tval);
Null = false;
......@@ -900,7 +900,7 @@ void TYPVAL<PSZ>::SetValue_char(char *p, int n)
*(++p) = '\0';
if (trace)
if (trace > 1)
htrc(" Setting string to: '%s'\n", Strp);
Null = false;
......@@ -1291,7 +1291,7 @@ bool DTVAL::MakeTime(struct tm *ptm)
int n, y = ptm->tm_year;
time_t t = mktime_mysql(ptm);
if (trace)
if (trace > 1)
htrc("MakeTime from (%d,%d,%d,%d,%d,%d)\n",
ptm->tm_year, ptm->tm_mon, ptm->tm_mday,
ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
......@@ -1314,7 +1314,7 @@ bool DTVAL::MakeTime(struct tm *ptm)
}
Tval= (int) t;
if (trace)
if (trace > 1)
htrc("MakeTime Ival=%d\n", Tval);
return false;
......@@ -1334,7 +1334,7 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
datm.tm_mon=0;
datm.tm_year=70;
if (trace)
if (trace > 1)
htrc("MakeDate from(%d,%d,%d,%d,%d,%d) nval=%d\n",
val[0], val[1], val[2], val[3], val[4], val[5], nval);
......@@ -1398,7 +1398,7 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
} // endfor i
if (trace)
if (trace > 1)
htrc("MakeDate datm=(%d,%d,%d,%d,%d,%d)\n",
datm.tm_year, datm.tm_mon, datm.tm_mday,
datm.tm_hour, datm.tm_min, datm.tm_sec);
......@@ -1459,7 +1459,7 @@ void DTVAL::SetValue_char(char *p, int n)
ndv = ExtractDate(Sdate, Pdtp, DefYear, dval);
MakeDate(NULL, dval, ndv);
if (trace)
if (trace > 1)
htrc(" setting date: '%s' -> %d\n", Sdate, Tval);
Null = false;
......@@ -1483,7 +1483,7 @@ void DTVAL::SetValue_psz(PSZ p)
ndv = ExtractDate(Sdate, Pdtp, DefYear, dval);
MakeDate(NULL, dval, ndv);
if (trace)
if (trace > 1)
htrc(" setting date: '%s' -> %d\n", Sdate, Tval);
Null = false;
......
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