home *** CD-ROM | disk | FTP | other *** search
- #ifndef _WSQLCONN_HPP_INCLUDED
- #define _WSQLCONN_HPP_INCLUDED
-
- #ifndef _WTRANSAC_HPP_INCLUDED
- #include "wtransac.hpp"
- #endif
- #ifndef _WQUERY_HPP_INCLUDED
- #include "wquery.hpp"
- #endif
-
- class WSQLTable : public WObject {
- public:
- WString owner;
- WString name;
- WString type;
- };
-
- class WSQLColumn : public WObject {
- public:
- ~WSQLColumn() { delete [] data; }
- WString name;
- char *data;
- long size;
- long max_size;
- long got_size;
- };
-
- extern template WVector<WSQLTable>;
- extern template WVector<WSQLColumn>;
-
- class WCMCLASS WSQLConnection : public WObject
- {
- WDeclareSubclass ( WSQLConnection, WObject );
- public:
- WBool Open( WString dbname, WString userid, WString password, WString connectparms = "", WString dbms = "" );
- WBool Close();
- WBool EnumTables( WVector<WSQLTable> &, WString table_pattern = "%",
- WString owner_pattern = "%", WString type = "" );
- WBool OpenCursor( WString query );
- WBool CloseCursor();
- WBool BindColumns( WVector<WSQLColumn> &columns );
- WBool Fetch();
- WString GetError() { return( _message ); }
- int GetRows() { return( _rows ); }
- // TODO: Fix Error() to Call error message
- #if 0
- void Error( void );
- #endif
-
- void SetParameter( int, WDataValue const & );
- WString GetParameter( int );
- void InitParameters();
-
- private:
- WTransaction _transact;
- WQuery _query;
- WString _message;
- int _rows;
- };
-
- #endif
-