| 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 | /**************** 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 | /***********************************************************************/ |
| 50 | /* Definition of classes XKPDEF, DOXDEF, TDBDOX */ |
| 51 | /* These classes purpose is chiefly to access protected items! */ |
| 52 | /***********************************************************************/ |
| 53 | class DOXDEF: public DOSDEF { |
| 54 | friend int CntIndexInit(PGLOBAL, PTDB, int, bool); |
| 55 | }; // end of class DOXDEF |
| 56 | |
| 57 | /***********************************************************************/ |
| 58 | /* This is the DOS/UNIX Access Method base class declaration. */ |
| 59 | /***********************************************************************/ |
| 60 | class TDBDOX: public TDBDOS { |
| 61 | friend int MakeIndex(PGLOBAL, PTDB, PIXDEF); |
| 62 | friend int CntCloseTable(PGLOBAL, PTDB, bool, bool); |
| 63 | friend int CntIndexInit(PGLOBAL, PTDB, int, bool); |
| 64 | friend RCODE CntIndexRead(PGLOBAL, PTDB, OPVAL, const key_range*, bool); |
| 65 | friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool); |
| 66 | friend int CntIndexRange(PGLOBAL, PTDB, const uchar**, uint*, |
| 67 | bool*, key_part_map*); |
| 68 | friend class ha_connect; |
| 69 | TDBDOX() : TDBDOS((PGLOBAL)0, (PTDBDOS)0) {} /* Never called */ |
| 70 | }; // end of class TDBDOX |
| 71 | |
| 72 | class XKPDEF: public KPARTDEF { |
| 73 | friend class TDBDOX; |
| 74 | friend class ha_connect; |
| 75 | friend int CntIndexInit(PGLOBAL, PTDB, int, bool); |
| 76 | public: |
| 77 | XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {} |
| 78 | }; // end of class XKPDEF |
| 79 | |