mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 23:25:34 +02:00
- MRR + Block Indexing
modified: storage/connect/array.h 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/filter.cpp storage/connect/filter.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/plgdbutl.cpp 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/tabmysql.cpp storage/connect/tabmysql.h storage/connect/taboccur.h storage/connect/tabodbc.h storage/connect/tabsys.h storage/connect/tabtbl.h storage/connect/tabutil.h storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/tabwmi.h 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
This commit is contained in:
commit
7b400a088d
60 changed files with 32618 additions and 33489 deletions
|
|
@ -1,192 +1,188 @@
|
|||
/*************** TabFmt H Declares Source Code File (.H) ***************/
|
||||
/* Name: TABFMT.H Version 2.3 */
|
||||
/* */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2013 */
|
||||
/* */
|
||||
/* This file contains the CSV and FMT classes declares. */
|
||||
/***********************************************************************/
|
||||
#include "xtable.h" // Base class declares
|
||||
#include "tabdos.h"
|
||||
|
||||
//pedef struct _tabdesc *PTABD; // For friend setting
|
||||
typedef class TDBFMT *PTDBFMT;
|
||||
|
||||
/***********************************************************************/
|
||||
/* Functions used externally. */
|
||||
/***********************************************************************/
|
||||
PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
|
||||
int hdr, int mxr, bool info);
|
||||
|
||||
/***********************************************************************/
|
||||
/* CSV table. */
|
||||
/***********************************************************************/
|
||||
class DllExport CSVDEF : public DOSDEF { /* Logical table description */
|
||||
friend class TDBCSV;
|
||||
friend class TDBCCL;
|
||||
public:
|
||||
// Constructor
|
||||
CSVDEF(void);
|
||||
|
||||
// Implementation
|
||||
virtual const char *GetType(void) {return "CSV";}
|
||||
char GetSep(void) {return Sep;}
|
||||
char GetQot(void) {return Qot;}
|
||||
|
||||
// Methods
|
||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
bool Fmtd; /* true for formatted files */
|
||||
//bool Accept; /* true if wrong lines are accepted */
|
||||
bool Header; /* true if first line contains headers */
|
||||
//int Maxerr; /* Maximum number of bad records */
|
||||
int Quoted; /* Quoting level for quoted fields */
|
||||
char Sep; /* Separator for standard CSV files */
|
||||
char Qot; /* Character for quoted strings */
|
||||
}; // end of CSVDEF
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the DOS/UNIX Access Method class declaration for files */
|
||||
/* that are CSV files with columns separated by the Sep character. */
|
||||
/***********************************************************************/
|
||||
class TDBCSV : public TDBDOS {
|
||||
friend class CSVCOL;
|
||||
public:
|
||||
// Constructor
|
||||
TDBCSV(PCSVDEF tdp, PTXF txfp);
|
||||
TDBCSV(PGLOBAL g, PTDBCSV tdbp);
|
||||
|
||||
// Implementation
|
||||
virtual AMT GetAmType(void) {return TYPE_AM_CSV;}
|
||||
virtual PTDB Duplicate(PGLOBAL g)
|
||||
{return (PTDB)new(g) TDBCSV(g, this);}
|
||||
|
||||
// Methods
|
||||
virtual PTDB CopyOne(PTABS t);
|
||||
//virtual bool IsUsingTemp(PGLOBAL g);
|
||||
virtual int GetBadLines(void) {return (int)Nerr;}
|
||||
|
||||
// Database routines
|
||||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
||||
virtual bool OpenDB(PGLOBAL g);
|
||||
virtual int WriteDB(PGLOBAL g);
|
||||
virtual int CheckWrite(PGLOBAL g);
|
||||
virtual int ReadBuffer(PGLOBAL g); // Physical file read
|
||||
|
||||
// Specific routines
|
||||
virtual int EstimatedLength(PGLOBAL g);
|
||||
virtual bool SkipHeader(PGLOBAL g);
|
||||
virtual bool CheckErr(void);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
PSZ *Field; // Field to write to current line
|
||||
int *Offset; // Column offsets for current record
|
||||
int *Fldlen; // Column field length for current record
|
||||
bool *Fldtyp; // true for numeric fields
|
||||
int Fields; // Number of fields to handle
|
||||
int Nerr; // Number of bad records
|
||||
int Maxerr; // Maximum number of bad records
|
||||
int Quoted; // Quoting level for quoted fields
|
||||
bool Accept; // true if bad lines are accepted
|
||||
bool Header; // true if first line contains column headers
|
||||
char Sep; // Separator
|
||||
char Qot; // Quoting character
|
||||
}; // end of class TDBCSV
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class CSVCOL: CSV access method column descriptor. */
|
||||
/* This A.M. is used for Comma Separated V(?) files. */
|
||||
/***********************************************************************/
|
||||
class CSVCOL : public DOSCOL {
|
||||
friend class TDBCSV;
|
||||
friend class TDBFMT;
|
||||
public:
|
||||
// Constructors
|
||||
CSVCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
|
||||
CSVCOL(CSVCOL *colp, PTDB tdbp); // Constructor used in copy process
|
||||
|
||||
// Implementation
|
||||
virtual int GetAmType() {return TYPE_AM_CSV;}
|
||||
|
||||
// Methods
|
||||
#if defined(BLK_INDX)
|
||||
virtual bool VarSize(void);
|
||||
#endif // BLK_INDX
|
||||
virtual void ReadColumn(PGLOBAL g);
|
||||
virtual void WriteColumn(PGLOBAL g);
|
||||
// void Print(FILE *, uint);
|
||||
|
||||
protected:
|
||||
// Default constructor not to be used
|
||||
CSVCOL(void) {}
|
||||
|
||||
// Members
|
||||
int Fldnum; // Field ordinal number (0 based)
|
||||
}; // end of class CSVCOL
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the DOS/UNIX Access Method class declaration for files */
|
||||
/* whose record format is described by a Format keyword. */
|
||||
/***********************************************************************/
|
||||
class TDBFMT : public TDBCSV {
|
||||
friend class CSVCOL;
|
||||
//friend class FMTCOL;
|
||||
public:
|
||||
// Standard constructor
|
||||
TDBFMT(PCSVDEF tdp, PTXF txfp) : TDBCSV(tdp, txfp)
|
||||
{FldFormat = NULL; To_Fld = NULL; FmtTest = NULL; Linenum = 0;}
|
||||
|
||||
// Copy constructor
|
||||
TDBFMT(PGLOBAL g, PTDBFMT tdbp);
|
||||
|
||||
// Implementation
|
||||
virtual AMT GetAmType(void) {return TYPE_AM_FMT;}
|
||||
virtual PTDB Duplicate(PGLOBAL g)
|
||||
{return (PTDB)new(g) TDBFMT(g, this);}
|
||||
|
||||
// Methods
|
||||
virtual PTDB CopyOne(PTABS t);
|
||||
|
||||
// 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 WriteDB(PGLOBAL g);
|
||||
//virtual int CheckWrite(PGLOBAL g);
|
||||
virtual int ReadBuffer(PGLOBAL g); // Physical file read
|
||||
|
||||
// Specific routines
|
||||
virtual int EstimatedLength(PGLOBAL g);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
PSZ *FldFormat; // Field read format
|
||||
void *To_Fld; // To field test buffer
|
||||
int *FmtTest; // Test on ending by %n or %m
|
||||
int Linenum; // Last read line
|
||||
}; // end of class TDBFMT
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the class declaration for the CSV catalog table. */
|
||||
/***********************************************************************/
|
||||
class TDBCCL : public TDBCAT {
|
||||
public:
|
||||
// Constructor
|
||||
TDBCCL(PCSVDEF tdp);
|
||||
|
||||
protected:
|
||||
// Specific routines
|
||||
virtual PQRYRES GetResult(PGLOBAL g);
|
||||
|
||||
// Members
|
||||
char *Fn; // The CSV file (path) name
|
||||
bool Hdr; // true if first line contains headers
|
||||
int Mxr; // Maximum number of bad records
|
||||
int Qtd; // Quoting level for quoted fields
|
||||
char Sep; // Separator for standard CSV files
|
||||
}; // end of class TDBCCL
|
||||
|
||||
/* ------------------------- End of TabFmt.H ------------------------- */
|
||||
/*************** TabFmt H Declares Source Code File (.H) ***************/
|
||||
/* Name: TABFMT.H Version 2.4 */
|
||||
/* */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */
|
||||
/* */
|
||||
/* This file contains the CSV and FMT classes declares. */
|
||||
/***********************************************************************/
|
||||
#include "xtable.h" // Base class declares
|
||||
#include "tabdos.h"
|
||||
|
||||
typedef class TDBFMT *PTDBFMT;
|
||||
|
||||
/***********************************************************************/
|
||||
/* Functions used externally. */
|
||||
/***********************************************************************/
|
||||
PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
|
||||
int hdr, int mxr, bool info);
|
||||
|
||||
/***********************************************************************/
|
||||
/* CSV table. */
|
||||
/***********************************************************************/
|
||||
class DllExport CSVDEF : public DOSDEF { /* Logical table description */
|
||||
friend class TDBCSV;
|
||||
friend class TDBCCL;
|
||||
public:
|
||||
// Constructor
|
||||
CSVDEF(void);
|
||||
|
||||
// Implementation
|
||||
virtual const char *GetType(void) {return "CSV";}
|
||||
char GetSep(void) {return Sep;}
|
||||
char GetQot(void) {return Qot;}
|
||||
|
||||
// Methods
|
||||
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
|
||||
virtual PTDB GetTable(PGLOBAL g, MODE mode);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
bool Fmtd; /* true for formatted files */
|
||||
//bool Accept; /* true if wrong lines are accepted */
|
||||
bool Header; /* true if first line contains headers */
|
||||
//int Maxerr; /* Maximum number of bad records */
|
||||
int Quoted; /* Quoting level for quoted fields */
|
||||
char Sep; /* Separator for standard CSV files */
|
||||
char Qot; /* Character for quoted strings */
|
||||
}; // end of CSVDEF
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the DOS/UNIX Access Method class declaration for files */
|
||||
/* that are CSV files with columns separated by the Sep character. */
|
||||
/***********************************************************************/
|
||||
class TDBCSV : public TDBDOS {
|
||||
friend class CSVCOL;
|
||||
public:
|
||||
// Constructor
|
||||
TDBCSV(PCSVDEF tdp, PTXF txfp);
|
||||
TDBCSV(PGLOBAL g, PTDBCSV tdbp);
|
||||
|
||||
// Implementation
|
||||
virtual AMT GetAmType(void) {return TYPE_AM_CSV;}
|
||||
virtual PTDB Duplicate(PGLOBAL g)
|
||||
{return (PTDB)new(g) TDBCSV(g, this);}
|
||||
|
||||
// Methods
|
||||
virtual PTDB CopyOne(PTABS t);
|
||||
//virtual bool IsUsingTemp(PGLOBAL g);
|
||||
virtual int GetBadLines(void) {return (int)Nerr;}
|
||||
|
||||
// Database routines
|
||||
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
|
||||
virtual bool OpenDB(PGLOBAL g);
|
||||
virtual int WriteDB(PGLOBAL g);
|
||||
virtual int CheckWrite(PGLOBAL g);
|
||||
virtual int ReadBuffer(PGLOBAL g); // Physical file read
|
||||
|
||||
// Specific routines
|
||||
virtual int EstimatedLength(PGLOBAL g);
|
||||
virtual bool SkipHeader(PGLOBAL g);
|
||||
virtual bool CheckErr(void);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
PSZ *Field; // Field to write to current line
|
||||
int *Offset; // Column offsets for current record
|
||||
int *Fldlen; // Column field length for current record
|
||||
bool *Fldtyp; // true for numeric fields
|
||||
int Fields; // Number of fields to handle
|
||||
int Nerr; // Number of bad records
|
||||
int Maxerr; // Maximum number of bad records
|
||||
int Quoted; // Quoting level for quoted fields
|
||||
bool Accept; // true if bad lines are accepted
|
||||
bool Header; // true if first line contains column headers
|
||||
char Sep; // Separator
|
||||
char Qot; // Quoting character
|
||||
}; // end of class TDBCSV
|
||||
|
||||
/***********************************************************************/
|
||||
/* Class CSVCOL: CSV access method column descriptor. */
|
||||
/* This A.M. is used for Comma Separated V(?) files. */
|
||||
/***********************************************************************/
|
||||
class CSVCOL : public DOSCOL {
|
||||
friend class TDBCSV;
|
||||
friend class TDBFMT;
|
||||
public:
|
||||
// Constructors
|
||||
CSVCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
|
||||
CSVCOL(CSVCOL *colp, PTDB tdbp); // Constructor used in copy process
|
||||
|
||||
// Implementation
|
||||
virtual int GetAmType() {return TYPE_AM_CSV;}
|
||||
|
||||
// Methods
|
||||
virtual bool VarSize(void);
|
||||
virtual void ReadColumn(PGLOBAL g);
|
||||
virtual void WriteColumn(PGLOBAL g);
|
||||
|
||||
protected:
|
||||
// Default constructor not to be used
|
||||
CSVCOL(void) {}
|
||||
|
||||
// Members
|
||||
int Fldnum; // Field ordinal number (0 based)
|
||||
}; // end of class CSVCOL
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the DOS/UNIX Access Method class declaration for files */
|
||||
/* whose record format is described by a Format keyword. */
|
||||
/***********************************************************************/
|
||||
class TDBFMT : public TDBCSV {
|
||||
friend class CSVCOL;
|
||||
//friend class FMTCOL;
|
||||
public:
|
||||
// Standard constructor
|
||||
TDBFMT(PCSVDEF tdp, PTXF txfp) : TDBCSV(tdp, txfp)
|
||||
{FldFormat = NULL; To_Fld = NULL; FmtTest = NULL; Linenum = 0;}
|
||||
|
||||
// Copy constructor
|
||||
TDBFMT(PGLOBAL g, PTDBFMT tdbp);
|
||||
|
||||
// Implementation
|
||||
virtual AMT GetAmType(void) {return TYPE_AM_FMT;}
|
||||
virtual PTDB Duplicate(PGLOBAL g)
|
||||
{return (PTDB)new(g) TDBFMT(g, this);}
|
||||
|
||||
// Methods
|
||||
virtual PTDB CopyOne(PTABS t);
|
||||
|
||||
// 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 WriteDB(PGLOBAL g);
|
||||
//virtual int CheckWrite(PGLOBAL g);
|
||||
virtual int ReadBuffer(PGLOBAL g); // Physical file read
|
||||
|
||||
// Specific routines
|
||||
virtual int EstimatedLength(PGLOBAL g);
|
||||
|
||||
protected:
|
||||
// Members
|
||||
PSZ *FldFormat; // Field read format
|
||||
void *To_Fld; // To field test buffer
|
||||
int *FmtTest; // Test on ending by %n or %m
|
||||
int Linenum; // Last read line
|
||||
}; // end of class TDBFMT
|
||||
|
||||
/***********************************************************************/
|
||||
/* This is the class declaration for the CSV catalog table. */
|
||||
/***********************************************************************/
|
||||
class TDBCCL : public TDBCAT {
|
||||
public:
|
||||
// Constructor
|
||||
TDBCCL(PCSVDEF tdp);
|
||||
|
||||
protected:
|
||||
// Specific routines
|
||||
virtual PQRYRES GetResult(PGLOBAL g);
|
||||
|
||||
// Members
|
||||
char *Fn; // The CSV file (path) name
|
||||
bool Hdr; // true if first line contains headers
|
||||
int Mxr; // Maximum number of bad records
|
||||
int Qtd; // Quoting level for quoted fields
|
||||
char Sep; // Separator for standard CSV files
|
||||
}; // end of class TDBCCL
|
||||
|
||||
/* ------------------------- End of TabFmt.H ------------------------- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue