5#include "qx/sql/qx_sql_export.h"
12namespace QxSqlPrivate {
template<
typename T>
struct FieldChecker; }
20class QX_SQL_EXPORT SqlError final :
public AbstractError<"Qx::SqlError", 7>
23 friend struct QxSqlPrivate::FieldChecker;
38 static inline const QHash<Form, QString> ERR_STRINGS{
39 {NoError, u
"No error occurred."_s},
40 {MissingDb, u
"The query could not be executed because it has no associated database."_s},
41 {EngineError, u
"Engine error."_s},
42 {TypeMismatch, u
"A field value did not match the expected type."_s},
43 {MissingField, u
"An expected field is missing."_s},
44 {InvalidResult, u
"Data retrieval from an invalid result was attempted."_s}
46 static inline const QString DATABASE_INFO_TEMPLATE =
48 u
"Database Name: %2\n"_s
60 SqlError(
const QString& fromType,
const QString& toType,
const QString& field = {});
64 SqlError(Form f,
const QString& c = {});
65 SqlError(
const QSqlError& engineError);
69 quint32 deriveValue()
const override;
70 QString derivePrimary()
const override;
71 QString deriveSecondary()
const override;
72 QString deriveDetails()
const override;
77 QString cause()
const;
78 QString query()
const;
79 QString databaseInfo()
const;
81 SqlError& withQuery(
const SqlQuery& q);
82 SqlError& withQuery(
const QString& q);
83 SqlError& withDatabase(
const SqlDatabase& db);
The SqlDatabase class provides straightforward access to an SQL database.
Definition qx-sqldatabase.h:36
Form
Definition qx-sqlerror.h:27
@ NoError
Definition qx-sqlerror.h:28
@ TypeMismatch
Definition qx-sqlerror.h:31
@ EngineError
Definition qx-sqlerror.h:30
@ MissingField
Definition qx-sqlerror.h:32
SqlQuery is a base class from which all query types derive.
Definition qx-sqlquery.h:171
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-abstracterror.cpp:13
The qx-abstracterror.h header file provides access to the base class from which custom error types sh...