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 02111-1301 USA */ |
15 | |
16 | /**************** MYCAT H Declares Source Code File (.H) ***************/ |
17 | /* Name: MYCAT.H Version 2.3 */ |
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 | ulonglong lrecl; |
54 | ulonglong elements; |
55 | //ulonglong estimate; |
56 | ulonglong multiple; |
57 | ulonglong ; |
58 | ulonglong quoted; |
59 | ulonglong ending; |
60 | ulonglong compressed; |
61 | bool mapped; |
62 | bool huge; |
63 | bool split; |
64 | bool readonly; |
65 | bool sepindex; |
66 | bool zipped; |
67 | }; |
68 | |
69 | // Possible value for catalog functions |
70 | #define FNC_NO (1 << 0) // Not a catalog table |
71 | #define FNC_COL (1 << 1) // Column catalog function |
72 | #define FNC_TABLE (1 << 2) // Table catalog function |
73 | #define FNC_DSN (1 << 3) // Data Source catalog function |
74 | #define FNC_DRIVER (1 << 4) // Column catalog function |
75 | #define FNC_NIY (1 << 5) // Catalog function NIY |
76 | |
77 | typedef class ha_connect *PHC; |
78 | |
79 | char *GetPluginDir(void); |
80 | TABTYPE GetTypeID(const char *type); |
81 | bool IsFileType(TABTYPE type); |
82 | bool IsExactType(TABTYPE type); |
83 | bool IsTypeNullable(TABTYPE type); |
84 | bool IsTypeFixed(TABTYPE type); |
85 | bool IsTypeIndexable(TABTYPE type); |
86 | int GetIndexType(TABTYPE type); |
87 | uint GetFuncID(const char *func); |
88 | |
89 | /***********************************************************************/ |
90 | /* MYCAT: class for managing the CONNECT plugin DB items. */ |
91 | /***********************************************************************/ |
92 | class MYCAT : public CATALOG { |
93 | public: |
94 | MYCAT(PHC hc); // Constructor |
95 | |
96 | // Implementation |
97 | PHC GetHandler(void) {return Hc;} |
98 | void SetHandler(PHC hc) {Hc= hc;} |
99 | |
100 | // Methods |
101 | void Reset(void); |
102 | bool StoreIndex(PGLOBAL, PTABDEF) {return false;} // Temporary |
103 | PRELDEF GetTableDesc(PGLOBAL g, PTABLE tablep, |
104 | LPCSTR type, PRELDEF *prp = NULL); |
105 | PTDB GetTable(PGLOBAL g, PTABLE tablep, |
106 | MODE mode = MODE_READ, LPCSTR type = NULL); |
107 | void ClearDB(PGLOBAL g); |
108 | |
109 | protected: |
110 | PRELDEF MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am); |
111 | |
112 | // Members |
113 | ha_connect *Hc; // The Connect handler |
114 | }; // end of class MYCAT |
115 | |
116 | #endif /* __MYCAT__H */ |
117 | |