1 /*************** TabCol H Declares Source Code File (.H) ***************/
2 /*  Name: TABCOL.H    Version 2.8                                      */
3 /*                                                                     */
4 /*  (C) Copyright to the author Olivier BERTRAND          1998-2013    */
5 /*                                                                     */
6 /*  This file contains the XTAB, COLUMN and XORDER class definitions.  */
7 /***********************************************************************/
8 
9 /***********************************************************************/
10 /*  Include required application header files                          */
11 /*  block.h      is header containing Block    global declarations.    */
12 /***********************************************************************/
13 #include "xobject.h"
14 
15 /***********************************************************************/
16 /*  Definition of class XTAB with all its method functions.            */
17 /***********************************************************************/
18 class DllExport XTAB: public BLOCK {  // Table Name-Schema-Srcdef block.
19   friend class TDBPRX;
20   friend class TDBTBM;
21  public:
22   // Constructors
23   XTAB(LPCSTR name, LPCSTR srcdef = NULL);
24   XTAB(PTABLE tp);
25 
26   // Implementation
GetNext(void)27   PTABLE GetNext(void) {return Next;}
GetTo_Tdb(void)28   PTDB   GetTo_Tdb(void) {return To_Tdb;}
GetName(void)29   LPCSTR GetName(void) {return Name;}
GetSrc(void)30   LPCSTR GetSrc(void) {return Srcdef;}
GetSchema(void)31   LPCSTR GetSchema(void) {return Schema;}
GetQualifier(void)32   LPCSTR GetQualifier(void) {return Qualifier;}
SetTo_Tdb(PTDB tdbp)33   void   SetTo_Tdb(PTDB tdbp) {To_Tdb = tdbp;}
SetName(LPCSTR name)34   void   SetName(LPCSTR name) {Name = name;}
SetSrc(LPCSTR srcdef)35   void   SetSrc(LPCSTR srcdef) {Srcdef = srcdef;}
SetSchema(LPCSTR schname)36   void   SetSchema(LPCSTR schname) {Schema = schname;}
SetQualifier(LPCSTR qname)37   void   SetQualifier(LPCSTR qname) {Qualifier = qname;}
38 
39   // Methods
40   PTABLE Link(PTABLE);
41   void   Printf(PGLOBAL g, FILE *f, uint n);
42   void   Prints(PGLOBAL g, char *ps, uint z);
43 
44  protected:
45   // Members
46   PTABLE    Next;              // Points to next table in chain
47   PTDB      To_Tdb;            // Points to Table description Block
48   LPCSTR    Name;              // Table name
49   LPCSTR    Srcdef;            // Table Source definition
50   LPCSTR    Schema;            // Schema name
51   LPCSTR    Qualifier;         // Qualifier name
52   }; // end of class XTAB
53 
54 
55 /***********************************************************************/
56 /*  Definition of class COLUMN with all its method functions.          */
57 /*  Note: because of LNA routines, the constantness of Name was        */
58 /*  removed and constructing a COLUMN with null name was allowed.      */
59 /*  Perhaps this should be replaced by the use of a specific class.    */
60 /***********************************************************************/
61 class DllExport COLUMN: public XOBJECT {  // Column Name/Qualifier block.
62  public:
63   // Constructor
64   COLUMN(LPCSTR name);
65 
66   // Implementation
GetType(void)67   virtual int    GetType(void) {return TYPE_COLUMN;}
GetResultType(void)68   virtual int    GetResultType(void) {assert(false); return TYPE_VOID;}
GetLength(void)69   virtual int    GetLength(void) {assert(false); return 0;}
GetLengthEx(void)70   virtual int    GetLengthEx(void) {assert(false); return 0;}
GetScale()71   virtual int    GetScale() {assert(false); return 0;};
GetName(void)72           LPCSTR GetName(void) {return Name;}
GetQualifier(void)73           LPCSTR GetQualifier(void) {return Qualifier;}
GetTo_Table(void)74           PTABLE GetTo_Table(void) {return To_Table;}
GetTo_Col(void)75           PCOL   GetTo_Col(void) {return To_Col;}
SetQualifier(LPCSTR qualif)76           void   SetQualifier(LPCSTR qualif) {Qualifier = qualif;}
SetTo_Table(PTABLE tablep)77           void   SetTo_Table(PTABLE tablep) {To_Table = tablep;}
SetTo_Col(PCOL colp)78           void   SetTo_Col(PCOL colp) {To_Col = colp;}
79 
80   // Methods
81   virtual void   Printf(PGLOBAL g, FILE *f, uint n);
82   virtual void   Prints(PGLOBAL g, char *ps, uint z);
83   // All methods below should never be used for COLUMN's
Reset(void)84   virtual void   Reset(void) {assert(false);}
Compare(PXOB)85   virtual bool   Compare(PXOB) {assert(false); return false;}
86   virtual bool   SetFormat(PGLOBAL, FORMAT&);
Eval(PGLOBAL)87   virtual bool   Eval(PGLOBAL) {assert(false); return true;}
88 
89  private:
90   // Members
91   PTABLE  To_Table;             // Point to Table Name Block
92   PCOL    To_Col;               // Points to Column Description Block
93   LPCSTR  const Name;           // Column name
94   LPCSTR  Qualifier;            // Qualifier name
95   }; // end of class COLUMN
96 
97 /***********************************************************************/
98 /*  Definition of class SPCCOL with all its method functions.          */
99 /*  Note: Currently the special columns are ROWID, ROWNUM, FILEID,     */
100 /*  SERVID, TABID, PARTID, and CONID.                                  */
101 /***********************************************************************/
102 class SPCCOL: public COLUMN {  // Special Column Name/Qualifier block.
103  public:
104   // Constructor
SPCCOL(LPCSTR name)105   SPCCOL(LPCSTR name) : COLUMN(name) {}
106 
107  private:
108   // Members
109   }; // end of class SPCCOL
110