diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-04-29 13:50:20 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-04-29 13:50:20 +0200 |
commit | 4fd74200dd8ff357b7f870ea0407ef8f3c78ff11 (patch) | |
tree | d297698912fdf321efb715957a62ffd2b7e5e099 /storage/connect/tabutil.h | |
parent | bc80fb07ded7abcfb99d368d14e4c5e81a669101 (diff) | |
download | mariadb-git-4fd74200dd8ff357b7f870ea0407ef8f3c78ff11.tar.gz |
- Adding 3 new table types:
PROXY table base on another table. Used by several other types.
XCOL proxy on a table having a colummn containing a list of values
OCCUR proxy on a table having several columns containing the same type
of values that can be put in a unique column and several rows.
TBL Not new but now internally using the PROXY table class.
- Fix 2 bugs in add_field:
Change '=' to ' ' after the COMMENT keyword.
Quote column names between '`' in the SQL string.
- Update xml test result to the CONNECT version
added:
storage/connect/taboccur.cpp
storage/connect/taboccur.h
storage/connect/tabutil.cpp
storage/connect/tabutil.h
storage/connect/tabxcl.cpp
storage/connect/tabxcl.h
modified:
storage/connect/CMakeLists.txt
storage/connect/ha_connect.cc
storage/connect/ha_connect.h
storage/connect/mycat.cc
storage/connect/myconn.cpp
storage/connect/mysql-test/connect/r/xml.result
storage/connect/plgdbsem.h
storage/connect/tabmysql.cpp
storage/connect/tabtbl.cpp
storage/connect/tabtbl.h
storage/connect/valblk.cpp
storage/connect/valblk.h
Diffstat (limited to 'storage/connect/tabutil.h')
-rw-r--r-- | storage/connect/tabutil.h | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h new file mode 100644 index 00000000000..48e97bd49ec --- /dev/null +++ b/storage/connect/tabutil.h @@ -0,0 +1,181 @@ +// TABUTIL.H Olivier Bertrand 2013 +// Defines the TAB catalog tables + +#ifndef TABUTIL +#define TABUTIL 1 + +//#include "tabtbl.h" + +#define TYPE_AM_PRX (AMT)129 + +typedef class PRXDEF *PPRXDEF; +typedef class TDBPRX *PTDBPRX; +typedef class XXLCOL *PXXLCOL; +typedef class PRXCOL *PPRXCOL; +typedef class TBCDEF *PTBCDEF; +typedef class TDBTBC *PTDBTBC; +typedef class XTDBASE *PTDBX; +typedef class XCOLBLK *PCOLX; + +TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, + const char *name, bool& mysql); +PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, + const char *name, bool info); + +/***********************************************************************/ +/* This class is used to access protected members of TDBASE. */ +/***********************************************************************/ +class XTDBASE : public TDBASE { + friend class TDBXCL; + }; // end of class XCOLBLK + +/***********************************************************************/ +/* This class is used to access protected members of COLBLK. */ +/***********************************************************************/ +class XCOLBLK : public COLBLK { + friend class TDBXCL; + }; // end of class XCOLBLK + +/* -------------------------- PROXY classes -------------------------- */ + +/***********************************************************************/ +/* PROXY: table based on another table. Can be used to have a */ +/* different view on an existing table. */ +/* However, its real use is to be the base of TBL and PRX tables. */ +/***********************************************************************/ + +/***********************************************************************/ +/* PRX table. */ +/***********************************************************************/ +class DllExport PRXDEF : public TABDEF { /* Logical table description */ + friend class TDBPRX; + friend class TDBTBC; + public: + // Constructor + PRXDEF(void); + + // Implementation + virtual const char *GetType(void) {return "PRX";} + + // Methods + virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); + virtual PTDB GetTable(PGLOBAL g, MODE mode); + + protected: + // Members + PTABLE Tablep; /* The object table */ + }; // end of PRXDEF + +/***********************************************************************/ +/* This is the class declaration for the XCSV table. */ +/***********************************************************************/ +class DllExport TDBPRX : public TDBASE { +//friend class MULINDX; + friend class PRXDEF; + friend class PRXCOL; + public: + // Constructor + TDBPRX(PPRXDEF tdp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_PRX;} + + // Methods + virtual int GetRecpos(void) {return Tdbp->GetRecpos();} + virtual void ResetDB(void) {Tdbp->ResetDB();} + virtual int RowNumber(PGLOBAL g, bool b = FALSE); + + // 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); + virtual int WriteDB(PGLOBAL g); + virtual int DeleteDB(PGLOBAL g, int irc); + virtual void CloseDB(PGLOBAL g) {if (Tdbp) Tdbp->CloseDB(g);} + PTDB GetSubTable(PGLOBAL g, PTABLE tabp); + + protected: + // Members + PTDBASE Tdbp; // The object table + }; // end of class TDBPRX + +/***********************************************************************/ +/* Class PRXCOL: PRX access method column descriptor. */ +/* This A.M. is used for PRX tables. */ +/***********************************************************************/ +class DllExport PRXCOL : public COLBLK { + friend class TDBPRX; + friend class TDBTBL; + public: + // Constructors + PRXCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "PRX"); + + // Implementation + virtual int GetAmType(void) {return TYPE_AM_PRX;} + + // Methods + virtual bool IsSpecial(void) {return Pseudo;} + virtual void ReadColumn(PGLOBAL g); + bool Init(PGLOBAL g); + + protected: + // Default constructor not to be used + PRXCOL(void) {} + + // Members + PCOL Colp; // Points to matching table column + PVAL To_Val; // To the matching column value + bool Pseudo; // TRUE for special columns + int Colnum; // Used when retrieving columns by number + }; // end of class PRXCOL + +#if 0 +/***********************************************************************/ +/* TBC table. */ +/***********************************************************************/ +class TBCDEF : public TABDEF {/* Logical table description */ + friend class TDBTBC; + friend class ha_connect; + public: + // Constructor + TBCDEF(void) {Database = NULL; Tabname = NULL;} + + + // Implementation + virtual const char *GetType(void) {return "TBC";} + inline PSZ GetDatabase(void) {return Database;}; + inline PSZ GetTabname(void) {return Tabname;} + + // Methods + virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); + virtual PTDB GetTable(PGLOBAL g, MODE m); + + protected: + // Members + PSZ Database; /* Database to be used by server */ + PSZ Tabname; /* External table name */ + }; // end of TBCDEF +#endif // 0 + +/***********************************************************************/ +/* This is the class declaration for the TBC column catalog table. */ +/***********************************************************************/ +class TDBTBC : public TDBCAT { + public: + // Constructors + TDBTBC(PPRXDEF tdp); +//TDBTBC(PTBLDEF tdp); +//TDBTBC(PXCLDEF tdp); + + protected: + // Specific routines + virtual PQRYRES GetResult(PGLOBAL g); + + // Members + PSZ Db; // Database of the table + PSZ Tab; // Table name + }; // end of class TDBMCL + +#endif // TABUTIL |