home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WDATAERR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-08-26
|
4KB
|
134 lines
#ifndef _WDATAERR_HPP_INCLUDED
#define _WDATAERR_HPP_INCLUDED
//-----------------------------------------------------------------------
//
// Database errors.
//
//-----------------------------------------------------------------------
#ifndef _WODBC_HPP_INCLUDED
#include "wodbc.hpp"
#endif
#ifndef _WEVENT_HPP_INCLUDED
#include "wevent.hpp"
#endif
struct WDatabaseErrorEventData : public WEventData {
WBool isWarning; // TRUE if only a warning
WLong errorCode; // error or warning code
WLong apiFunction; // code of API function
};
//
// WDataError
//
// Holds the error information returned by a database or data source.
//
class WCMCLASS WDataError : public WObject {
WDeclareSubclass( WDataError, WObject );
typedef WArray<WDataError> WDataErrorArray;
public:
WDataError();
WDataError( const WDataError & o );
WDataError( const WString & message );
WDataError( WLong errCode, WLong funcCode );
WDataError( WLong errCode, WLong funcCode, WBool fromDriver,
const WString & message,
const WAnsiChar *sqlState,
WLong nativeCode );
~WDataError();
WDataError & operator=( const WDataError & );
WDataError & operator=( const WString & );
int operator==( const WDataError & ) const;
int operator!=( const WDataError & ) const;
/***************************************************************
* Properties
***************************************************************/
// ErrorCode
//
// The general error code for this error, one of the values
// SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR,
// SQL_NEED_DATA, SQL_NO_DATA_FOUND, SQL_INVALID_HANDLE,
// SQL_STILL_EXECUTING, SQL_WCM_ERROR or SQL_WCM_WARNING.
WLong GetErrorCode() const;
// ErrorMessage
//
// The error message. May be a null string.
WString GetErrorMessage() const;
// FunctionCode
//
// A code identifying which driver call caused the error.
WLong GetFunctionCode() const;
// NativeCode
//
// The native error code, a value assigned by the database
// driver.
WLong GetNativeCode() const;
// SQLState
//
// The ODBC error state, assigned by the database driver.
// May be a null string.
WString GetSQLState() const;
/***************************************************************
* Methods
***************************************************************/
void Clear();
void Create( const WString & message );
void Create( const WDataError & o );
void Create( WLong errCode, WLong funcCode );
void Create( WLong errCode, WLong funcCode, WBool fromDriver,
const WString & message, const WAnsiChar *sqlState,
WLong nativeCode );
/***************************************************************
* Static Properties
***************************************************************/
static const WDataError & GetNullError();
static const WDataErrorArray & GetNullErrorArray();
protected:
/***************************************************************
* Data Members
***************************************************************/
WBool _fromDriver;
WLong _errorCode;
WLong _functionCode;
WLong _nativeCode;
WAnsiChar _sqlState[10];
WString _errorMessage;
};
extern template WArrayReference<WDataError>;
extern template WArray<WDataError>;
typedef WArray<WDataError> WDataErrorArray;
#endif