Qx v0.7
Qt Extensions Library
|
The SqlError class is used to report errors related to database configuration and SQL queries.
#include <qx/sql/qx-sqlerror.h>
Public Types | |
enum | Form { NoError , MissingDb , EngineError , TypeMismatch , MissingField , InvalidResult } |
Public Member Functions | |
SqlError () | |
SqlError (const QSqlError &engineError) | |
SqlError (Form f, const QString &c={}) | |
QString | cause () const |
QString | databaseInfo () const |
Form | form () const |
bool | isValid () const |
QString | query () const |
SqlError & | withDatabase (const SqlDatabase &db) |
SqlError & | withQuery (const QString &q) |
SqlError & | withQuery (const SqlQuery &q) |
![]() | |
operator bool () const | |
bool | operator!= (const AbstractError &other) const=default |
bool | operator== (const AbstractError &other) const=default |
Friends | |
template<typename T> | |
struct | QxSqlPrivate::FieldChecker |
Additional Inherited Members | |
![]() | |
static constexpr quint16 | TYPE_CODE |
static constexpr QLatin1StringView | TYPE_NAME |
![]() | |
IError ()=default | |
virtual QString | deriveCaption () const |
virtual Severity | deriveSeverity () const |
bool | operator!= (const IError &other) const =default |
bool | operator== (const IError &other) const =default |
enum Qx::SqlError::Form |
Qx::SqlError::SqlError | ( | ) |
Creates an invalid SqlError.
Qx::SqlError::SqlError | ( | Form | f, |
const QString & | c = {} ) |
Creates a SQL error with the form f and cause c.
Qx::SqlError::SqlError | ( | const QSqlError & | engineError | ) |
Creates a SQL error from engineError.
QString Qx::SqlError::cause | ( | ) | const |
The primary cause of the error.
QString Qx::SqlError::databaseInfo | ( | ) | const |
Textual information above the database that the error originated from.
SqlError::Form Qx::SqlError::form | ( | ) | const |
The form of error that occurred.
bool Qx::SqlError::isValid | ( | ) | const |
Returns true
if an error occurred; otherwise, returns false
.
QString Qx::SqlError::query | ( | ) | const |
The query used when the error occurred, if any.
SqlError & Qx::SqlError::withDatabase | ( | const SqlDatabase & | db | ) |
Sets the database associated with the error and returns a reference to the error.
SqlError & Qx::SqlError::withQuery | ( | const QString & | q | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the query associated with the error and returns a reference to the error.