WORM 0.2
A C++ DAL/ORM code generation framework
Public Types | Public Member Functions

WSql::WSqlError Class Reference

The WSqlError class provides SQL database and driver error information. More...

#include <wsqlerror.h>

List of all members.

Public Types

enum  ErrorSeverity {
  NONE = 0x0, MESSAGE = 0x01, WARNING = 0x02, DANGER = 0x04,
  FATAL = 0x08, ALL = 0xff
}
enum  ErrorType {
  UNKNOWN = 0, DRIVER, SERVER, QUERY,
  SYSTEM
}

Public Member Functions

 WSqlError ()
 Constructs an empty WSqlError instance.
 WSqlError (const std::string &text, ErrorType type=UNKNOWN)
 Constructs an error containing the text text of ErrorType type.
 WSqlError (const std::string &text, int errno=-1, ErrorType type=UNKNOWN, ErrorSeverity severity=NONE)
 Constructs a fully populated error object.
 WSqlError (const WSqlError &other)
 Creates a copy of other.
WSqlErroroperator= (const WSqlError &other)
 Assigns the other error's values to this error.
bool operator== (const WSqlError &other) const
 Comparison operator - returns true if this WSqlError is identical to other.
bool operator!= (const WSqlError &other) const
 ~WSqlError ()
 Destroys the object and frees any allocated resources.
std::string text () const
 Returns the text of the error message.
int errorNumber () const
 Returns the error number.
ErrorType type () const
 Returns the type of error.
ErrorSeverity severity () const
 Returns the severity of the error.
void setErrorNumber (int errno)
 Sets the errorNumber to be errno.
void setText (const std::string &text)
 Sets the text of the error to message.
void setType (ErrorType type)
 Sets the type flag to be type.
void setSeverity (ErrorSeverity severity)
 Sets the severity flag to be severity.

Detailed Description

The WSqlError class provides SQL database and driver error information.

WSqlError provides an error object with type and severity flags as well as convenience methods for setting the error message or number.

Definition at line 26 of file wsqlerror.h.


Member Enumeration Documentation

This is a flag indicating of what severity the error is, ie. how bad was it ..

  • NONE No error occurred.
  • MESSAGE Just a friendly message ..
  • WARNING Advice that something is not right ..
  • DANGER Strong advice that something is very wrong
  • FATAL - self explanatory, action not completed.
Enumerator:
NONE 
MESSAGE 
WARNING 
DANGER 
FATAL 
ALL 

Definition at line 30 of file wsqlerror.h.

This is a flag indicating what type of error occured

  • NONE No error occurred.
  • DRIVER An error in the driver itself.
  • SERVER An error from the database
  • QUERY SQL statement syntax error
  • SYSTEM An error from the system, eg. an exception was thrown
  • UNKNOWN Unable to determine.
Enumerator:
UNKNOWN 
DRIVER 
SERVER 
QUERY 
SYSTEM 

Definition at line 38 of file wsqlerror.h.


Constructor & Destructor Documentation

WSql::WSqlError::WSqlError ( )

Constructs an empty WSqlError instance.

Note:
The type and severity are set to UNKNOWN and NONE and errno is -1 by default. Use setType(), setSeverity() and setErrorNumber() to change this or a constructor with the full set of arguments.

Definition at line 66 of file wsqlerror.cpp.

WSql::WSqlError::WSqlError ( const std::string &  text,
WSqlError::ErrorType  type = UNKNOWN 
)

Constructs an error containing the text text of ErrorType type.

Note:
The severity is set to MESSAGE and errno to -1 by default. Use setSeverity() and setErrorNumber() to change this or a constructor with the full set of arguments.
Parameters:
stringthe message
ErrorTypetype - the type flag
See also:
setSeverity() setErrorNumber()

Definition at line 84 of file wsqlerror.cpp.

WSql::WSqlError::WSqlError ( const std::string &  text,
int  errno = -1,
WSqlError::ErrorType  type = UNKNOWN,
WSqlError::ErrorSeverity  severity = NONE 
)

Constructs a fully populated error object.

Constructs an error containing the text text of ErrorType type and ErrorSeverity severity with the error number errno (usually from the database server ..).

Parameters:
stringthe message
interrno - the error number
ErrorTypetype - the type flag
ErrorSeverityseverity - the severity flag

Definition at line 102 of file wsqlerror.cpp.

WSql::WSqlError::WSqlError ( const WSqlError other)

Creates a copy of other.

Definition at line 112 of file wsqlerror.cpp.

WSql::WSqlError::~WSqlError ( )

Destroys the object and frees any allocated resources.

Definition at line 141 of file wsqlerror.cpp.


Member Function Documentation

int WSql::WSqlError::errorNumber ( ) const [inline]

Returns the error number.

This function returns an error number if possible - generally from a database driver or the system. If no error number was set it retuns -1.

Return values:
intthe error number

Definition at line 60 of file wsqlerror.h.

bool WSql::WSqlError::operator!= ( const WSqlError other) const [inline]

Definition at line 56 of file wsqlerror.h.

WSqlError & WSql::WSqlError::operator= ( const WSqlError other)

Assigns the other error's values to this error.

Definition at line 121 of file wsqlerror.cpp.

bool WSql::WSqlError::operator== ( const WSqlError other) const

Comparison operator - returns true if this WSqlError is identical to other.

Definition at line 131 of file wsqlerror.cpp.

WSql::WSqlError::setErrorNumber ( int  errno) [inline]

Sets the errorNumber to be errno.

Definition at line 64 of file wsqlerror.h.

WSql::WSqlError::setSeverity ( ErrorSeverity  severity) [inline]

Sets the severity flag to be severity.

Definition at line 67 of file wsqlerror.h.

WSql::WSqlError::setText ( const std::string &  text) [inline]

Sets the text of the error to message.

Definition at line 65 of file wsqlerror.h.

WSql::WSqlError::setType ( ErrorType  type) [inline]

Sets the type flag to be type.

Definition at line 66 of file wsqlerror.h.

ErrorSeverity WSql::WSqlError::severity ( ) const [inline]

Returns the severity of the error.

This function returns a flag indicating the severity of the error.

See also:
ErrorSeverity ErrorType
Return values:
ErrorSeverityhow bad it is ..

Definition at line 62 of file wsqlerror.h.

std::string WSql::WSqlError::text ( ) const [inline]

Returns the text of the error message.

This function returns a single string of text containing the error message. This may be concatenated messages (eg. from a driver) or a single message or an empty string (eg. if only the errorNumber was set).

Return values:
std::stringthe text of the error message

Definition at line 59 of file wsqlerror.h.

ErrorType WSql::WSqlError::type ( ) const [inline]

Returns the type of error.

This function returns a flag indicating what type of error this is - eg. DRIVER, SYSTEM, etc..

See also:
ErrorType ErrorSeverity
Return values:
ErrorTypethe type of this error

Definition at line 61 of file wsqlerror.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines