WORM 0.2
A C++ DAL/ORM code generation framework
|
The WSqlError class provides SQL database and driver error information. More...
#include <wsqlerror.h>
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. | |
WSqlError & | operator= (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. |
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.
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. 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. Definition at line 38 of file wsqlerror.h.
WSql::WSqlError::WSqlError | ( | ) |
Constructs an empty WSqlError instance.
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.
string | the message |
ErrorType | type - the type flag |
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 ..).
string | the message |
int | errno - the error number |
ErrorType | type - the type flag |
ErrorSeverity | severity - 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.
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.
int | the 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.
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.
ErrorSeverity | how 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).
std::string | the 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..
ErrorType | the type of this error |
Definition at line 61 of file wsqlerror.h.