summaryrefslogtreecommitdiff
path: root/storage/connect/tabxcl.h
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-04-29 13:50:20 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2013-04-29 13:50:20 +0200
commit4fd74200dd8ff357b7f870ea0407ef8f3c78ff11 (patch)
treed297698912fdf321efb715957a62ffd2b7e5e099 /storage/connect/tabxcl.h
parentbc80fb07ded7abcfb99d368d14e4c5e81a669101 (diff)
downloadmariadb-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/tabxcl.h')
-rw-r--r--storage/connect/tabxcl.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h
new file mode 100644
index 00000000000..6db653d5709
--- /dev/null
+++ b/storage/connect/tabxcl.h
@@ -0,0 +1,133 @@
+// TABXCL.H Olivier Bertrand 2013
+// Defines the XCOL tables
+
+#include "tabutil.h"
+
+#define TYPE_AM_XCOL (AMT)124
+
+typedef class XCLDEF *PXCLDEF;
+typedef class TDBXCL *PTDBXCL;
+typedef class XCLCOL *PXCLCOL;
+//pedef class MULINDX *PMINDX;
+
+/* -------------------------- 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 XCSV table. */
+/***********************************************************************/
+class TDBXCL : public TDBPRX {
+//friend class MULINDX;
+ 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);
+//virtual bool HaveSame(void) {return RowFlag == 1;}
+
+ // 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
+ 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
+ XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
+
+ // Methods
+ virtual void Reset(void) {} // Evaluated only by TDBXCL
+ virtual void ReadColumn(PGLOBAL g);
+
+ 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
+
+#if 0
+/* ------------------------- MULINDX classes ------------------------- */
+
+/***********************************************************************/
+/* This represents a KINDEX class for an XCOL table. */
+/***********************************************************************/
+class MULINDX : public KINDEX {
+ public:
+ // Constructor
+ MULINDX(PTDBXCL txlp) : KINDEX(txlp->Tdbp) {Txlp = txlp;}
+
+ // Implementation
+ virtual BOOL HaveSame(void);
+
+ // Methods
+ virtual BOOL Init(PGLOBAL g);
+ virtual BOOL NextVal(BOOL eq);
+ virtual int MoreVal(void);
+
+ protected:
+ //Member
+ PTDBXCL Txlp;
+}; // end of class MULINDX
+#endif // 0