1 /*************** Catalog H Declares Source Code File (.H) **************/ 2 /* Name: CATALOG.H Version 3.3 */ 3 /* */ 4 /* (C) Copyright to the author Olivier BERTRAND 2000-2015 */ 5 /* */ 6 /* This file contains the CATALOG PlugDB classes definitions. */ 7 /***********************************************************************/ 8 #ifndef __CATALOG__H 9 #define __CATALOG__H 10 11 #include "block.h" 12 13 /***********************************************************************/ 14 /* Defines the length of a buffer to contain entire table section. */ 15 /***********************************************************************/ 16 #define PLG_MAX_PATH 144 /* Must be the same across systems */ 17 #define PLG_BUFF_LEN 100 /* Number of lines in binary file buffer */ 18 19 20 //typedef class INDEXDEF *PIXDEF; 21 22 /***********************************************************************/ 23 /* Defines the structure used to enumerate tables or views. */ 24 /***********************************************************************/ 25 typedef struct _curtab { 26 PRELDEF CurTdb; 27 char *Curp; 28 char *Tabpat; 29 bool Ispat; 30 bool NoView; 31 int Nt; 32 char *Type[16]; 33 } CURTAB, *PCURTAB; 34 35 /***********************************************************************/ 36 /* Defines the structure used to get column catalog info. */ 37 /***********************************************************************/ 38 typedef struct _colinfo { 39 PCSZ Name; 40 int Type; 41 int Offset; 42 int Length; 43 int Key; 44 int Precision; 45 int Scale; 46 int Opt; 47 int Freq; 48 PCSZ Remark; 49 PCSZ Datefmt; 50 PCSZ Fieldfmt; 51 ushort Flags; // Used by MariaDB CONNECT handlers 52 } COLINFO, *PCOLINFO; 53 54 /***********************************************************************/ 55 /* CATALOG: base class for catalog classes. */ 56 /***********************************************************************/ 57 class DllExport CATALOG { 58 friend class RELDEF; 59 friend class TABDEF; 60 friend class DIRDEF; 61 friend class OEMDEF; 62 public: 63 CATALOG(void); // Constructor ~CATALOG()64 virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy 65 66 // Implementation GetCblen(void)67 int GetCblen(void) {return Cblen;} GetDefHuge(void)68 bool GetDefHuge(void) {return DefHuge;} SetDefHuge(bool b)69 void SetDefHuge(bool b) {DefHuge = b;} GetCbuf(void)70 char *GetCbuf(void) {return Cbuf;} 71 72 // Methods Reset(void)73 virtual void Reset(void) {} CheckName(PGLOBAL,char *)74 virtual bool CheckName(PGLOBAL, char*) {return true;} ClearName(PGLOBAL,PSZ)75 virtual bool ClearName(PGLOBAL, PSZ) {return true;} MakeOneTableDesc(PGLOBAL,LPCSTR,LPCSTR)76 virtual PRELDEF MakeOneTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;} GetTableDescEx(PGLOBAL,PTABLE)77 virtual PRELDEF GetTableDescEx(PGLOBAL, PTABLE) {return NULL;} 78 //virtual PRELDEF GetTableDesc(PGLOBAL, LPCSTR, LPCSTR, 79 // PRELDEF* = NULL) {return NULL;} GetFirstTable(PGLOBAL)80 virtual PRELDEF GetFirstTable(PGLOBAL) {return NULL;} GetNextTable(PGLOBAL)81 virtual PRELDEF GetNextTable(PGLOBAL) {return NULL;} TestCond(PGLOBAL,const char *,const char *)82 virtual bool TestCond(PGLOBAL, const char*, const char*) {return true;} DropTable(PGLOBAL,PSZ,bool)83 virtual bool DropTable(PGLOBAL, PSZ, bool) {return true;} 84 virtual PTDB GetTable(PGLOBAL, PTABLE, 85 MODE = MODE_READ, LPCSTR = NULL) {return NULL;} TableNames(PGLOBAL,char *,int,int[])86 virtual void TableNames(PGLOBAL, char*, int, int[]) {} ColumnNames(PGLOBAL,char *,char *,int,int[])87 virtual void ColumnNames(PGLOBAL, char*, char*, int, int[]) {} ColumnDefs(PGLOBAL,char *,char *,int,int[])88 virtual void ColumnDefs(PGLOBAL, char*, char*, int, int[]) {} DecodeValues(PGLOBAL,char *,char *,char *,int,int[])89 virtual void *DecodeValues(PGLOBAL, char*, char*, char*, 90 int, int[]) {return NULL;} ColumnType(PGLOBAL,char *,char *)91 virtual int ColumnType(PGLOBAL, char*, char*) {return 0;} ClearDB(PGLOBAL)92 virtual void ClearDB(PGLOBAL) {} 93 94 protected: ClearSection(PGLOBAL,const char *,const char *)95 virtual bool ClearSection(PGLOBAL, const char*, const char*) {return true;} 96 //virtual PRELDEF MakeTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;} 97 98 // Members 99 char *Cbuf; /* Buffer used for col section */ 100 int Cblen; /* Length of suballoc. buffer */ 101 CURTAB Ctb; /* Used to enumerate tables */ 102 bool DefHuge; /* true: tables default to huge */ 103 }; // end of class CATALOG 104 105 #endif // __CATALOG__H 106