home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WTRANSDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-03
|
8KB
|
233 lines
/*************************************************************************
*
* WODCBTransaction -- ODBC transaction interface.
*
*************************************************************************/
#ifndef _WTRANSDR_HPP_INCLUDED
#define _WTRANSDR_HPP_INCLUDED
#ifndef _WREFOBJ_HPP_INCLUDED
#include "wrefobj.hpp"
#endif
#ifndef _WTRANSAC_HPP_INCLUDED
#include "wtransac.hpp"
#endif
class WODBCDriver;
//
// WODBCTransaction
//
// Specialization of WTransaction that knows how to talk to an ODBC
// driver.
//
class WCMCLASS WODBCTransaction : public WTransaction {
WDeclareSubclass( WODBCTransaction, WTransaction );
public:
WODBCTransaction( WTransaction *proxy=NULL );
virtual ~WODBCTransaction();
/****************************************************************
* Properties
****************************************************************/
// ODBCDriver
//
//
virtual WODBCDriver *GetODBCDriver() const;
/***************************************************************
* Methods
***************************************************************/
/***************************************************************
* Overrides
***************************************************************/
WTAccessMode GetAccessMode() const;
WBool SetAccessMode( WTAccessMode accessMode );
WBool GetAutoCommit() const;
WBool SetAutoCommit( WBool autoCommit );
WTBookmarkPersistence GetBookmarkPersistence() const;
WBool GetConnected() const;
WDWord GetConnectionHandle() const;
WString GetConnectParams() const;
WBool SetConnectParams( const WString & connectParams );
WTCursorDriver GetCursorDriver() const;
WBool SetCursorDriver( WTCursorDriver driv );
WString GetDataSource() const;
WBool SetDataSource( const WString & dataSource );
WString GetDBMSName() const;
WBool SetDBMSName( const WString & dbmsName );
WBool GetDisplayErrorDialog() const;
WBool SetDisplayErrorDialog( WBool display );
WBool GetDisplayWarningDialog() const;
WBool SetDisplayWarningDialog( WBool display );
WDWord GetEnvironmentHandle() const;
WLong GetErrorCode( WLong *apiFunc = NULL ) const;
WBool GetErrorInfo( WString *errorMessage, WString *state = NULL,
WLong *nativeErrorCode = NULL ) const;
WDataErrorArray GetErrorList() const;
WTFetchDirection GetFetchDirection() const;
WTFileUsage GetFileUsage() const;
WTIsolationLevel GetIsolationLevel() const;
WBool SetIsolationLevel( WTIsolationLevel level );
WString GetLoginID() const;
WBool SetLoginID( const WString & lid );
WString GetLoginPassword() const;
WBool SetLoginPassword( const WString & pwd );
WTLoginPrompt GetLoginPrompt() const;
WBool SetLoginPrompt( WTLoginPrompt prompt );
WLong GetMaxOptionIndex() const;
WLong GetNumericOption( WTOptionID id ) const;
WBool SetNumericOption( WTOptionID id, const WLong value );
WString GetPassword() const;
WBool SetPassword( const WString & password );
WTQualifierLocation GetQualifierLocation() const;
WString GetQualifierSeparator() const;
WString GetServerName() const;
WBool SetServerName( const WString & server );
WTStaticSensitivity GetStaticSensitivity() const;
WString GetStringOption( WTOptionID id ) const;
WBool SetStringOption( WTOptionID id, const WString & value );
WTCursorTypes GetSupportedCursorTypes() const;
WTUpdateTypes GetSupportedUpdateTypes() const;
WBool GetTraceToLog() const;
WBool SetTraceToLog( WBool on );
WString GetUserid() const;
WBool SetUserid( const WString & userid );
WTCursorCommitBehavior GetCursorCommitBehavior() const;
WTCursorRollbackBehavior GetCursorRollbackBehavior() const;
WBool Commit();
WBool Connect( WWindow *parent = NULL );
WBool Create();
WBool Create( const WString & dbmsName );
WBool Destroy();
WBool Disconnect();
WBool FetchErrors( WLong, WLong );
WBool GetDataSourceInfo( WString *name, WString *description,
WBool getFirst = FALSE ) const;
WBool GetOptionInfo( WTOptionID & id, WString & name,
WBool *isString = NULL,
WLong index = -1 ) const;
WBool List( WQuery & query, WTListType type, const WTListSource *source,
const WTListSource *source2 = NULL,
WDWord flags = WTF_ENSURE_VALIDITY );
WBool Rollback();
protected:
/****************************************************************
* Internal
****************************************************************/
WBool CheckODBCRetCode( RETCODE rc, WLong func ) const;
WBool BuildConnectStr();
WBool SplitConnectStr( const WString & newStr );
WBool IsODBCOption( WTOptionID id ) const;
/****************************************************************
* Property Data
****************************************************************/
WBool _connected;
WString _connectParams;
HDBC _connHandle;
WString _dataSource;
HENV _envHandle;
WTLoginPrompt _loginPrompt;
WODBCDriver * _driver;
WString _password;
WString _userid;
WDWord _bookmarks;
WDWord _fetchDirection;
WDWord _staticSensitivity;
WDWord _cursorTypes;
WDWord _cursorDriver;
WLong _qualifierLocation;
WString _qualifierSeparator;
WLong _fileUsage;
WDWord _updateType;
WString _loginID;
WString _loginPassword;
WString _serverName;
WTCursorCommitBehavior _cursorCommitBehavior;
WTCursorRollbackBehavior _cursorRollbackBehavior;
/****************************************************************
* Internal Data
****************************************************************/
WBool _fetchedError;
WString _connStr; // ODBC connection string
WLong _lastCode; // RC of the last ODBC call
WLong _lastFunc;
WDataErrorArray _errorList;
WBool _displayErrors;
WBool _displayWarnings;
WTransaction * _proxy;
static const WConstantString _useridKW; // connection string keywords
static const WConstantString _passwordKW;
static const WConstantString _dataSourceKW;
};
#endif