mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
e5729127b8
in this version. Sure enough, it never caused any improvement in the execution speed and rather caused a small increase of execution time. This is probably because values are sorted by rowid in each range of CONNECT indexes. This could be reconsidered if a customer have a need for processing very big files. - Fix a bug in ha_connect::CheckCond. The negated form of BETWEEN and IS NULL operators was not recognized. modified: storage/connect/ha_connect.cc - Add long jump initialization in CntReadNext. This was causing a server crash when an error occured in a ReadColumn. modified: storage/connect/connect.cc - General cleanup of CONNECT source code eliminating all code not used by CONNECT, including the MRR test code (saved separately). modified: storage/connect/catalog.h storage/connect/colblk.cpp storage/connect/colblk.h storage/connect/connect.cc storage/connect/connect.h storage/connect/domdoc.h storage/connect/filamap.cpp storage/connect/filamap.h storage/connect/filamdbf.h storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/filamtxt.h storage/connect/filamvct.cpp storage/connect/filamvct.h storage/connect/filamzip.cpp storage/connect/filamzip.h storage/connect/global.h storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/myconn.h storage/connect/plgcnx.h storage/connect/plgdbsem.h storage/connect/plugutil.c storage/connect/preparse.h storage/connect/reldef.cpp storage/connect/reldef.h storage/connect/tabcol.h storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabfix.cpp storage/connect/tabfmt.cpp storage/connect/tabfmt.h storage/connect/table.cpp storage/connect/tabmac.h storage/connect/tabmul.h storage/connect/tabmysql.cpp storage/connect/tabmysql.h storage/connect/taboccur.h storage/connect/tabodbc.cpp storage/connect/tabodbc.h storage/connect/tabsys.cpp storage/connect/tabsys.h storage/connect/tabtbl.cpp storage/connect/tabtbl.h storage/connect/tabutil.h storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/tabwmi.cpp storage/connect/tabwmi.h storage/connect/tabxml.cpp storage/connect/tabxml.h storage/connect/user_connect.cc storage/connect/user_connect.h storage/connect/valblk.cpp storage/connect/valblk.h storage/connect/value.cpp storage/connect/value.h storage/connect/xindex.cpp storage/connect/xindex.h storage/connect/xobject.cpp storage/connect/xobject.h storage/connect/xtable.h
142 lines
4.8 KiB
C++
142 lines
4.8 KiB
C++
// TABOCCUR.H Olivier Bertrand 2013
|
|
// Defines the OCCUR tables
|
|
|
|
#include "tabutil.h"
|
|
|
|
typedef class OCCURDEF *POCCURDEF;
|
|
typedef class TDBOCCUR *PTDBOCCUR;
|
|
typedef class OCCURCOL *POCCURCOL;
|
|
typedef class RANKCOL *PRANKCOL;
|
|
|
|
/* -------------------------- OCCUR classes -------------------------- */
|
|
|
|
/***********************************************************************/
|
|
/* OCCUR: Table that provides a view of a source table where the */
|
|
/* contain of several columns of the source table is placed in only */
|
|
/* one column, the OCCUR column, this resulting into several rows. */
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
/* OCCUR table. */
|
|
/***********************************************************************/
|
|
class OCCURDEF : public PRXDEF { /* Logical table description */
|
|
friend class TDBOCCUR;
|
|
public:
|
|
// Constructor
|
|
OCCURDEF(void) {Pseudo = 3; Colist = Xcol = NULL;}
|
|
|
|
// Implementation
|
|
virtual const char *GetType(void) {return "OCCUR";}
|
|
|
|
// Methods
|
|
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
|
virtual PTDB GetTable(PGLOBAL g, MODE m);
|
|
|
|
protected:
|
|
// Members
|
|
char *Colist; /* The source column list */
|
|
char *Xcol; /* The multiple occurence column */
|
|
char *Rcol; /* The rank column */
|
|
}; // end of OCCURDEF
|
|
|
|
/***********************************************************************/
|
|
/* This is the class declaration for the OCCUR table. */
|
|
/***********************************************************************/
|
|
class TDBOCCUR : public TDBPRX {
|
|
friend class OCCURCOL;
|
|
friend class RANKCOL;
|
|
public:
|
|
// Constructor
|
|
TDBOCCUR(POCCURDEF tdp);
|
|
|
|
// Implementation
|
|
virtual AMT GetAmType(void) {return TYPE_AM_OCCUR;}
|
|
void SetTdbp(PTDBASE tdbp) {Tdbp = tdbp;}
|
|
|
|
// Methods
|
|
virtual void ResetDB(void) {N = 0; Tdbp->ResetDB();}
|
|
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
|
|
bool MakeColumnList(PGLOBAL g);
|
|
bool ViewColumnList(PGLOBAL g);
|
|
|
|
// Database routines
|
|
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
|
virtual bool InitTable(PGLOBAL g);
|
|
virtual int GetMaxSize(PGLOBAL g);
|
|
virtual bool OpenDB(PGLOBAL g);
|
|
virtual int ReadDB(PGLOBAL g);
|
|
|
|
protected:
|
|
// Members
|
|
LPCSTR Tabname; // Name of source table
|
|
char *Colist; // Source column list
|
|
char *Xcolumn; // Occurence column name
|
|
char *Rcolumn; // Rank column name
|
|
POCCURCOL Xcolp; // To the OCCURCOL column
|
|
PCOL *Col; // To source multiple columns
|
|
int Mult; // Multiplication factor
|
|
int N; // The current table index
|
|
int M; // The occurence rank
|
|
BYTE RowFlag; // 0: Ok, 1: Same, 2: Skip
|
|
}; // end of class TDBOCCUR
|
|
|
|
/***********************************************************************/
|
|
/* Class OCCURCOL: for the multiple occurence column. */
|
|
/***********************************************************************/
|
|
class OCCURCOL : public COLBLK {
|
|
public:
|
|
// Constructors
|
|
OCCURCOL(PCOLDEF cdp, PTDBOCCUR tdbp, int n);
|
|
|
|
// Implementation
|
|
virtual int GetAmType(void) {return TYPE_AM_OCCUR;}
|
|
int GetI(void) {return I;}
|
|
|
|
// Methods
|
|
virtual void Reset(void) {} // Evaluated only by TDBOCCUR
|
|
virtual void ReadColumn(PGLOBAL g);
|
|
void Xreset(void) {I = 0;};
|
|
|
|
protected:
|
|
// Default constructor not to be used
|
|
OCCURCOL(void) {}
|
|
|
|
// Members
|
|
int I;
|
|
}; // end of class OCCURCOL
|
|
|
|
/***********************************************************************/
|
|
/* Class RANKCOL: for the multiple occurence column ranking. */
|
|
/***********************************************************************/
|
|
class RANKCOL : public COLBLK {
|
|
public:
|
|
// Constructors
|
|
RANKCOL(PCOLDEF cdp, PTDBOCCUR tdbp, int n) : COLBLK(cdp, tdbp, n) {}
|
|
|
|
// Implementation
|
|
virtual int GetAmType(void) {return TYPE_AM_OCCUR;}
|
|
|
|
// Methods
|
|
virtual void ReadColumn(PGLOBAL g);
|
|
|
|
protected:
|
|
// Default constructor not to be used
|
|
RANKCOL(void) {}
|
|
|
|
// Members
|
|
}; // end of class RANKCOL
|
|
|
|
/***********************************************************************/
|
|
/* Definition of class XCOLDEF. */
|
|
/* This class purpose is just to access COLDEF protected items! */
|
|
/***********************************************************************/
|
|
class XCOLDEF: public COLDEF {
|
|
friend class TDBOCCUR;
|
|
}; // end of class XCOLDEF
|
|
|
|
|
|
bool OcrColumns(PGLOBAL g, PQRYRES qrp, const char *col,
|
|
const char *ocr, const char *rank);
|
|
|
|
bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
|
|
const char *ocr, const char *rank);
|