1 /* Copyright (C) MariaDB Corporation Ab
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License as published by
5   the Free Software Foundation; version 2 of the License.
6 
7   This program is distributed in the hope that it will be useful,
8   but WITHOUT ANY WARRANTY; without even the implied warranty of
9   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10   GNU General Public License for more details.
11 
12   You should have received a copy of the GNU General Public License
13   along with this program; if not, write to the Free Software
14   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
15 
16 /**************** MYCAT H Declares Source Code File (.H) ***************/
17 /*  Name: MYCAT.H  Version 2.4                                         */
18 /*  Author: Olivier Bertrand                                           */
19 /*  This file contains the CONNECT plugin MYCAT class definitions.     */
20 /***********************************************************************/
21 #ifndef __MYCAT__H
22 #define __MYCAT__H
23 
24 #include "block.h"
25 #include "catalog.h"
26 
27 //typedef struct ha_table_option_struct TOS, *PTOS;
28 
29 /**
30   structure for CREATE TABLE options (table options)
31 
32   These can be specified in the CREATE TABLE:
33   CREATE TABLE ( ... ) {...here...}
34 */
35 struct ha_table_option_struct {
36   const char *type;
37   const char *filename;
38   const char *optname;
39   const char *tabname;
40   const char *tablist;
41   const char *dbname;
42   const char *separator;
43 //const char *connect;
44   const char *qchar;
45   const char *module;
46   const char *subtype;
47   const char *catfunc;
48   const char *srcdef;
49   const char *colist;
50 	const char *filter;
51   const char *oplist;
52   const char *data_charset;
53   const char *http;
54   const char *uri;
55   ulonglong lrecl;
56   ulonglong elements;
57 //ulonglong estimate;
58   ulonglong multiple;
59   ulonglong header;
60   ulonglong quoted;
61   ulonglong ending;
62   ulonglong compressed;
63   bool mapped;
64   bool huge;
65   bool split;
66   bool readonly;
67   bool sepindex;
68 	bool zipped;
69   };
70 
71 // Possible value for catalog functions
72 #define FNC_NO      (1 << 0)    // Not a catalog table
73 #define FNC_COL     (1 << 1)    // Column catalog function
74 #define FNC_TABLE   (1 << 2)    // Table catalog function
75 #define FNC_DSN     (1 << 3)    // Data Source catalog function
76 #define FNC_DRIVER  (1 << 4)    // Column catalog function
77 #define FNC_NIY     (1 << 5)    // Catalog function NIY
78 
79 typedef class ha_connect     *PHC;
80 
81 char   *GetPluginDir(void);
82 char   *GetMessageDir(void);
83 TABTYPE GetTypeID(const char *type);
84 bool    IsFileType(TABTYPE type);
85 bool    IsExactType(TABTYPE type);
86 bool    IsTypeNullable(TABTYPE type);
87 bool    IsTypeFixed(TABTYPE type);
88 bool    IsTypeIndexable(TABTYPE type);
89 int     GetIndexType(TABTYPE type);
90 uint    GetFuncID(const char *func);
91 
92 /***********************************************************************/
93 /*  MYCAT: class for managing the CONNECT plugin DB items.             */
94 /***********************************************************************/
95 class MYCAT : public CATALOG {
96  public:
97   MYCAT(PHC hc);                       // Constructor
98 
99   // Implementation
GetHandler(void)100   PHC     GetHandler(void) {return Hc;}
SetHandler(PHC hc)101   void    SetHandler(PHC hc) {Hc= hc;}
102 
103   // Methods
104   void    Reset(void);
StoreIndex(PGLOBAL,PTABDEF)105   bool    StoreIndex(PGLOBAL, PTABDEF) {return false;}  // Temporary
106 	PTABDEF GetTableDesc(PGLOBAL g, PTABLE tablep,
107 		                   LPCSTR type, PRELDEF *prp = NULL);
108   PTDB    GetTable(PGLOBAL g, PTABLE tablep,
109                               MODE mode = MODE_READ, LPCSTR type = NULL);
110   void    ClearDB(PGLOBAL g);
111 
112  protected:
113 	PTABDEF MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am);
114 
115   // Members
116   ha_connect *Hc;                          // The Connect handler
117   }; // end of class MYCAT
118 
119 #endif /* __MYCAT__H */
120