home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 32 / IOPROG_32.ISO / SOFT / SqlEval7 / MSOLAP / samples / Samples.exe / CppOlapDemo / OLAPTab.hpp < prev   
Encoding:
C/C++ Source or Header  |  1998-10-30  |  3.2 KB  |  81 lines

  1. //-----------------------------------------------------------------------------
  2. // Microsoft OLE DB QLAPDEMO Sample
  3. // Copyright (C) 1995-1998 Microsoft Corporation
  4. //
  5. // File: OLAPTab.hpp
  6. //
  7. // This file defines the class OLAPTab which is used for printing
  8. // the results to the console. It prints various rowset and cellset info
  9. // It also does some formatting tables for output to look nice on the screen
  10. //-----------------------------------------------------------------------------
  11.  
  12. #ifndef OLAPTab_hpp
  13. #define OLAPTab_hpp
  14.  
  15. #ifndef RC_INVOKED
  16. #pragma message ("Including OLAPTab.hpp from " __FILE__)
  17. #endif
  18.  
  19. //////////////////////////////////////////////////////////////////////////////////////
  20. class OLAPTab
  21.  
  22. // The OLAP application class
  23. //////////////////////////////////////////////////////////////////////////////////////
  24. {
  25. private:
  26.  
  27.     TCHAR   m_tDelimeter;
  28.  
  29.     LONG    m_cColumns;
  30.     LONG    m_pColumnLen[OLAP_APP_MAX_COLUMNS];     
  31.     TCHAR*  m_pColumnStr[OLAP_APP_MAX_COLUMNS];     
  32.  
  33.     TCHAR   m_pColumnBuffer[OLAP_APP_MAX_STRING_LEN];     
  34.  
  35. protected:
  36.  
  37.             LONG     First( TCHAR*  string, TCHAR**  text, TCHAR**  next );
  38.             LONG     Next( TCHAR**  text, TCHAR**  next );
  39.  
  40. public:
  41.  
  42.             OLAPTab( LPTSTR  pFormat = NULL, TCHAR  pDelimeter = TEXT(' ') );
  43.             ~OLAPTab();
  44.  
  45.             LONG        Set( LPTSTR  pFormat = NULL );
  46.     inline  LONG        GetColumns()                     { return m_cColumns; }                       
  47.     inline  LONG        GetColumnLength( LONG  iColumn ) { return (iColumn < m_cColumns) ? m_pColumnLen[iColumn] : 0;    }                       
  48.     inline  LPTSTR      GetColumnString( LONG  iColumn ) { return (iColumn < m_cColumns) ? m_pColumnStr[iColumn] : NULL; }                       
  49.  
  50.  
  51.             HRESULT     PrintPropertiesInfo( IDBCreateSession*  pIDBSource, DWORD  dwFlags = -1 );
  52.             HRESULT     PrintSchemaRowset( IDBCreateCommand*  pIDBSession, LPTSTR  pcSchema = NULL, GUID*  pGuid = NULL );
  53.             HRESULT     PrintAxisRowset( IMDDataset*  pIMDDataset, LONG  iAxis = OLAP_ALL, LPTSTR  pAxis = NULL );
  54.  
  55.             BOOL        PrintColumnCaption( LONG  iColumn, LONG  lLength, LPTSTR  pCaption );
  56.             BOOL        PrintColumnDelimiter( LONG  iColumn, LONG  lLength );
  57.             BOOL        PrintColumnString( LONG  iColumn, LPTSTR  pData );
  58.             BOOL        PrintColumnVariant( LONG  iColumn, VARIANT*  pData );
  59.  
  60.             HRESULT     PrintRowset( IRowset*  pIRowset );
  61.             HRESULT     PrintDataset( IMDDataset*  pIMDDataset );
  62.             HRESULT     PrintQuery( IMDDataset*  pIMDDataset );
  63.             HRESULT     PrintError();
  64.  
  65. };
  66.  
  67. //////////////////////////////////////////////////////////////////////////////////////
  68.  
  69. // Layout of column in memory.
  70. //////////////////////////////////////////////////////////////////////////////////////
  71. struct COLUMNDATA {
  72.     DWORD       dwLength;   // length of data (not space allocated)
  73.     DBSTATUS    dwStatus;   // status of column
  74.     BYTE        bData[1];   // data here and beyond
  75. };
  76.  
  77. #define ROUND_UP(Size,Amount)  (((DWORD)(Size)+((Amount)-1))&~((Amount)-1))
  78. const   COLUMN_ALIGNVAL  = 8;
  79.  
  80. #endif
  81.