Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsqlerror.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSQLERROR_H
5#define QSQLERROR_H
6
7#include <QtSql/qtsqlglobal.h>
8#include <QtCore/qshareddata.h>
9#include <QtCore/qstring.h>
10
12
15
16class Q_SQL_EXPORT QSqlError
17{
18public:
26 QSqlError(const QString &driverText = QString(),
27 const QString &databaseText = QString(),
28 ErrorType type = NoError,
29 const QString &errorCode = QString());
31 QSqlError(QSqlError &&other) noexcept = default;
33 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QSqlError)
35
36 bool operator==(const QSqlError &other) const;
37 bool operator!=(const QSqlError &other) const;
38
39 void swap(QSqlError &other) noexcept { d.swap(other.d); }
40
41 QString driverText() const;
42 QString databaseText() const;
43 ErrorType type() const;
44 QString nativeErrorCode() const;
45 QString text() const;
46 bool isValid() const;
47
48private:
49 QExplicitlySharedDataPointer<QSqlErrorPrivate> d;
50};
51
52Q_DECLARE_SHARED(QSqlError)
53
54#ifndef QT_NO_DEBUG_STREAM
55Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlError &);
56#endif
57
59
60#endif // QSQLERROR_H
\inmodule QtCore
The QSqlError class provides SQL database error information.
Definition qsqlerror.h:17
QSqlError(const QSqlError &other)
Creates a copy of other.
QSqlError(QSqlError &&other) noexcept=default
Move-constructs a QSqlError instance, making it point at the same object that other was pointing to.
QSqlError & operator=(const QSqlError &other)
Move-assigns other to this QSqlError instance.
~QSqlError()
Destroys the object and frees any allocated resources.
void swap(QSqlError &other) noexcept
Swaps error other with this error.
Definition qsqlerror.h:39
ErrorType
This enum type describes the context in which the error occurred, e.g., a connection error,...
Definition qsqlerror.h:19
@ StatementError
Definition qsqlerror.h:22
@ TransactionError
Definition qsqlerror.h:23
@ ConnectionError
Definition qsqlerror.h:21
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString text
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
GLenum type
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlError &)
Definition qsqlerror.cpp:12
@ NoError
Definition main.cpp:34
QSharedPointer< T > other(t)
[5]