home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / wsqlconn.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  2.0 KB  |  71 lines

  1. #ifndef _WSQLCONN_HPP_INCLUDED
  2. #define _WSQLCONN_HPP_INCLUDED
  3.  
  4. #ifndef _WTRANSAC_HPP_INCLUDED
  5. #include "wtransac.hpp"
  6. #endif
  7. #ifndef _WQUERY_HPP_INCLUDED
  8. #include "wquery.hpp"
  9. #endif
  10.  
  11. class WSQLTable : public WObject {
  12.     public:
  13.         WString         owner;
  14.         WString         name;
  15.         WString         type;
  16. };
  17.  
  18. class WSQLColumn : public WObject {
  19.     public:
  20.         ~WSQLColumn() { delete [] data; }
  21.         WString         name;
  22.         char            *data;
  23.         long            size;
  24.         long            max_size;
  25.         long            got_size;
  26. };
  27.  
  28. extern template WVector<WSQLTable>;
  29. extern template WVector<WSQLColumn>;
  30.  
  31. class WCMCLASS WSQLConnection : public WObject
  32. {
  33.     WDeclareSubclass ( WSQLConnection, WObject );
  34.     public:
  35.         WSQLConnection();
  36.  
  37.         ~WSQLConnection();
  38.  
  39.         WBool Open( WString dbname, WString userid, WString password, WString connectparms = "", WString dbms = "" );
  40.         WBool Close();
  41.         WBool EnumTables( WVector<WSQLTable> &, WString table_pattern = "%",
  42.                           WString owner_pattern = "%", WString type = "" );
  43.         WBool OpenCursor( WString query, WLong maxRows=0 );
  44.         WBool CloseCursor();
  45.         WBool BindColumns( WVector<WSQLColumn> &columns );
  46.         WBool Fetch();
  47.         WString GetError() { return( _message ); }
  48.         int GetRows() { return( _rows ); }
  49.         // TODO: Fix Error() to Call error message
  50. #if 0
  51.         void Error( void );
  52. #endif
  53.  
  54.         void SetParameter( int, WDataValue const & );
  55.         WString GetParameter( int );
  56.         void InitParameters();
  57.  
  58.         WString GetDBMS() { return _dbms; }
  59.         WString GetDBName() { return _dbname; }
  60.  
  61.     private:
  62.         WTransaction            _transact;
  63.         WQuery                  _query;
  64.         WString                 _message;
  65.         int                     _rows;
  66.         WString                 _dbname;
  67.         WString                 _dbms;
  68. };
  69.  
  70. #endif
  71.