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 /**************** Cnt H Declares Source Code File (.H) *****************/
17 /*  Name: CONNECT.H    Version 2.4                                     */
18 /*  Author Olivier BERTRAND  bertrandop@gmail.com                      */
19 /*  This file contains the some based classes declares.                */
20 /***********************************************************************/
21 #include "filamtxt.h"
22 #include "tabdos.h"
23 
24 //typedef struct _tabdesc  *PTABD;        // For friend setting
25 typedef struct _xinfo        *PXF;
26 typedef struct _create_xinfo *PCXF;
27 typedef class ha_connect     *PHC;
28 typedef class TDBDOX         *PTDBDOX;
29 
30 /****************************************************************************/
31 /*  CONNECT functions called externally.                                    */
32 /****************************************************************************/
33 bool  CntCheckDB(PGLOBAL g, PHC handler, const char *pathname);
34 PTDB  CntGetTDB(PGLOBAL g, const char *name, MODE xmod, PHC);
35 bool  CntOpenTable(PGLOBAL g, PTDB tdbp, MODE, char *, char *, bool, PHC);
36 bool  CntRewindTable(PGLOBAL g, PTDB tdbp);
37 int   CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort);
38 int   CntIndexInit(PGLOBAL g, PTDB tdbp, int id, bool sorted);
39 RCODE CntReadNext(PGLOBAL g, PTDB tdbp);
40 RCODE CntIndexRead(PGLOBAL g, PTDB, OPVAL op, const key_range *kr, bool mrr);
41 RCODE CntWriteRow(PGLOBAL g, PTDB tdbp);
42 RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp);
43 RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all);
44 bool  CntInfo(PGLOBAL g, PTDB tdbp, PXF info);
45 int   CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
46                     bool *incl, key_part_map *kmap);
47 PGLOBAL CntExit(PGLOBAL g);
48 
49 #if 0
50 /***********************************************************************/
51 /*  Definition of classes XKPDEF, DOXDEF, TDBDOX                       */
52 /*  These classes purpose is chiefly to access protected items!        */
53 /***********************************************************************/
54 class DOXDEF: public DOSDEF {
55   friend int CntIndexInit(PGLOBAL, PTDB, int, bool);
56   }; // end of class DOXDEF
57 
58 /***********************************************************************/
59 /*  This is the DOS/UNIX Access Method base class declaration.         */
60 /***********************************************************************/
61 class TDBDOX: public TDBDOS {
62   friend int   MakeIndex(PGLOBAL, PTDB, PIXDEF);
63   friend int   CntCloseTable(PGLOBAL, PTDB, bool, bool);
64   friend int   CntIndexInit(PGLOBAL, PTDB, int, bool);
65   friend RCODE CntIndexRead(PGLOBAL, PTDB, OPVAL, const key_range*, bool);
66   friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool);
67   friend int   CntIndexRange(PGLOBAL, PTDB, const uchar**, uint*,
68                              bool*, key_part_map*);
69   friend class ha_connect;
70 	TDBDOX() : TDBDOS((PGLOBAL)0, (PTDBDOS)0) {}     /* Never called */
71 }; // end of class TDBDOX
72 
73 class XKPDEF: public KPARTDEF {
74   friend class TDBDOX;
75   friend class ha_connect;
76   friend int CntIndexInit(PGLOBAL, PTDB, int, bool);
77  public:
78   XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
79   }; // end of class XKPDEF
80 #endif // 0
81