mariadb/storage/connect/tabxcl.h

105 lines
3.7 KiB
C
Raw Normal View History

// TABXCL.H Olivier Bertrand 2013
// Defines the XCOL tables
#include "tabutil.h"
typedef class XCLDEF *PXCLDEF;
typedef class TDBXCL *PTDBXCL;
typedef class XCLCOL *PXCLCOL;
/* -------------------------- XCOL classes --------------------------- */
/***********************************************************************/
/* XCOL: table having one column containing several values comma */
/* (or any other character) separated. When creating the table, the */
/* name of the X column is given by the NAME option. */
/* This sample has a limitation: */
/* - The X column has the same length than in the physical file. */
/* This tables produces as many rows for a physical row than the */
/* number of items in the X column (eventually 0). */
/***********************************************************************/
/***********************************************************************/
/* XCL table. */
/***********************************************************************/
class XCLDEF : public PRXDEF { /* Logical table description */
friend class TDBXCL;
public:
// Constructor
XCLDEF(void);
// Implementation
virtual const char *GetType(void) {return "XCL";}
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE mode);
protected:
// Members
char *Xcol; /* The column containing separated fields */
char Sep; /* The field separator, defaults to comma */
int Mult; /* Multiplication factor */
}; // end of XCLDEF
/***********************************************************************/
/* This is the class declaration for the XCOL table. */
/***********************************************************************/
class TDBXCL : public TDBPRX {
friend class XCLDEF;
friend class PRXCOL;
friend class XCLCOL;
public:
// Constructor
TDBXCL(PXCLDEF tdp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_XCOL;}
// Methods
virtual void ResetDB(void) {N = 0; Tdbp->ResetDB();}
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
protected:
// Members
char *Xcolumn; // Multiple column name
PXCLCOL Xcolp; // To the XCVCOL column
int Mult; // Multiplication factor
int N; // The current table index
int M; // The occurence rank
BYTE RowFlag; // 0: Ok, 1: Same, 2: Skip
bool New; // TRUE for new line
char Sep; // The Xcol separator
}; // end of class TDBXCL
/***********************************************************************/
/* Class XCLCOL: for the multiple CSV column. */
/***********************************************************************/
class XCLCOL : public PRXCOL {
friend class TDBXCL;
public:
// Constructors
Get rid of GCC warnings about unused parameters modified: storage/connect/array.cpp modified: storage/connect/blkfil.cpp modified: storage/connect/block.h modified: storage/connect/catalog.h modified: storage/connect/colblk.cpp modified: storage/connect/colblk.h modified: storage/connect/connect.cc modified: storage/connect/filamap.cpp modified: storage/connect/filamdbf.cpp modified: storage/connect/filamfix.cpp modified: storage/connect/filamtxt.cpp modified: storage/connect/filamtxt.h modified: storage/connect/filamvct.cpp modified: storage/connect/filamzip.cpp modified: storage/connect/filter.h modified: storage/connect/ha_connect.c modified: storage/connect/jsonudf.cpp modified: storage/connect/mycat.h modified: storage/connect/myconn.cpp modified: storage/connect/plgdbutl.cpp modified: storage/connect/reldef.cpp modified: storage/connect/reldef.h modified: storage/connect/tabcol.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabfmt.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h modified: storage/connect/table.cpp modified: storage/connect/tabmul.cpp modified: storage/connect/tabmysql.cpp modified: storage/connect/tabmysql.h modified: storage/connect/taboccur.cpp modified: storage/connect/tabpivot.cpp modified: storage/connect/tabsys.cpp modified: storage/connect/tabtbl.cpp modified: storage/connect/tabtbl.h modified: storage/connect/tabutil.cpp modified: storage/connect/tabutil.h modified: storage/connect/tabvct.cpp modified: storage/connect/tabvir.cpp modified: storage/connect/tabvir.h modified: storage/connect/tabxcl.cpp modified: storage/connect/tabxcl.h modified: storage/connect/tabxml.cpp modified: storage/connect/tabxml.h modified: storage/connect/valblk.cpp modified: storage/connect/valblk.h modified: storage/connect/value.cpp modified: storage/connect/value.h modified: storage/connect/xindex.cpp modified: storage/connect/xindex.h modified: storage/connect/xobject.h modified: storage/connect/xtable.h
2015-05-09 17:30:20 +02:00
XCLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
// Methods
using PRXCOL::Init;
virtual void Reset(void) {} // Evaluated only by TDBXCL
virtual void ReadColumn(PGLOBAL g);
2017-02-16 18:01:48 +01:00
virtual bool Init(PGLOBAL g, PTDB tp = NULL);
protected:
// Default constructor not to be used
XCLCOL(void) {}
// Members
char *Cbuf; // The column buffer
char *Cp; // Pointer to current position
char Sep; // The separator
}; // end of class XCLCOL