home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dbutil.zip / BUFOP.ZIP / DBSTUFF.SQH < prev    next >
Text File  |  1993-10-09  |  3KB  |  91 lines

  1. // 
  2. // processed by precompiler  10-08-93  06:43:14
  3. // 
  4.  
  5. /*******************************************************************
  6. *
  7. *  List database tables, views & attributes
  8. *
  9. *******************************************************************/
  10.  
  11. #include <iseq.h>
  12.  
  13. /*******************************************************************
  14. *
  15. *  Column information from the database
  16. *
  17. *******************************************************************/
  18.  
  19. EXEC SQL BEGIN DECLARE SECTION;
  20.  
  21. class columns {
  22. protected:
  23.   char name[19];
  24.   char table[19];
  25.   char remarks[254];
  26.   char type[8];
  27.   char nulls;                               // Y=nullable, N=not nullable, 
  28.                                                             // D=nullable with default
  29.   short len;
  30.   short colNbr;                             // The order of this col in the table
  31.   char highKey2[19];
  32.   char lowKey2[19];
  33.   char avgColLen;
  34.   short keySeq;                             // Sequence number of col in key (or zero)
  35. public:
  36.   char * getName();                         // get the name of a col
  37.   char   getType();
  38.   char * getRemarks();
  39.   short getlen();
  40.   short getColNbr();
  41.   friend 
  42.   ostream & operator <<(ostream & aStream, const Column & aCol);
  43.  
  44.   
  45. };
  46.  
  47. typedef ISequence<Column> columnSet;
  48. /*******************************************************************
  49. *
  50. *  Class to fill column container
  51. *
  52. *******************************************************************/
  53.  
  54. class colList : public Columns {
  55.  
  56.     public:
  57.     void selectCol(char * tablename);
  58.     friend
  59.     columnSet & operator << (columnSet &s, colList & c);
  60.   
  61. }; 
  62.  
  63. class Table {
  64.  
  65. private;
  66.     char    name[19];              // table name
  67.     char    creator[9];
  68.     char    type;                              // T = table, V=view
  69.     char    ctime[27];                         // time stamp when created
  70.     char    remarks[254];                      // user defined remarks about table or view
  71.     short    nbrCols;                           // number of columns in table
  72.     integer nbrRows; 
  73.     short    parents;                           // number of parent tables for this table
  74.     short children;                          // number of child tables
  75.     short selfRefs;                          // number of self references
  76.     short keyCol;                            // number of key col for this table
  77.     
  78.     columnSet AColSet;                      // sequential set of columns related to the table
  79. public:
  80. void    getTable(char * tablename);              // get table specified in tablename
  81.       friend ostream
  82.       &operator <<(ostream & aStream, Table const & aTable);
  83.   
  84. }; 
  85.  
  86. EXEC SQL END DECLARE SECTION;
  87.  
  88. void bind(char * DBName);                   // bind application to database if not bound
  89.  
  90.  
  91.