CopperSpice API
1.9.2
|
Provides SQL database error information. More...
Public Types | |
enum | ErrorType |
Public Methods | |
QSqlError (const QSqlError &other) | |
QSqlError (const QString &driverText=QString (), const QString &databaseText=QString (), ErrorType type=NoError, const QString &errorCode=QString ()) | |
~QSqlError () | |
QString | databaseText () const |
QString | driverText () const |
bool | isValid () const |
QString | nativeErrorCode () const |
QSqlError & | operator= (const QSqlError &other) |
QString | text () const |
ErrorType | type () const |
The QSqlError class provides SQL database error information.
A QSqlError object can provide database-specific error data, including the driverText() and databaseText() messages (or both concatenated together as text()), and the error number() and type(). The functions all have setters so that you can create and return QSqlError objects from your own classes, for example from your own SQL drivers.
enum QSqlError::ErrorType |
This enum type describes the context in which the error occurred, e.g., a connection error, a statement error, etc.
Constant | Value | Description |
---|---|---|
QSqlError::NoError | 0 | No error occurred. |
QSqlError::ConnectionError | 1 | Connection error. |
QSqlError::StatementError | 2 | SQL statement syntax error. |
QSqlError::TransactionError | 3 | Transaction failed error. |
QSqlError::UnknownError | 4 | Unknown error. |
QSqlError::QSqlError | ( | const QString & | driverText = QString() , |
const QString & | databaseText = QString() , |
||
ErrorType | type = NoError , |
||
const QString & | errorCode = QString() |
||
) |
Constructs an error containing the driver error text driverText, the database-specific error text databaseText, the type and the error code errorCode.
QSqlError::QSqlError | ( | const QSqlError & | other | ) |
Creates a copy of other.
QSqlError::~QSqlError | ( | ) |
Destroys the object and frees any allocated resources.
QString QSqlError::databaseText | ( | ) | const |
Returns the text of the error as reported by the database. This may contain database-specific descriptions; it may be empty.
QString QSqlError::driverText | ( | ) | const |
Returns the text of the error as reported by the driver. This may contain database-specific descriptions. It may also be empty.
bool QSqlError::isValid | ( | ) | const |
Returns true if an error is set, otherwise false.
QString QSqlError::nativeErrorCode | ( | ) | const |
Returns the database specific error code or an empty string if it can not be determined.
QSqlError & QSqlError::operator= | ( | const QSqlError & | other | ) |
Copy assigns from other and returns a reference to this object.
QString QSqlError::text | ( | ) | const |
This method returns the values for databaseText() and driverText() concatenated into a single string.
ErrorType QSqlError::type | ( | ) | const |
Returns the error type or -1 if the type can not be determined.