Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:18

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QSQLERROR_H
0005 #define QSQLERROR_H
0006 
0007 #include <QtSql/qtsqlglobal.h>
0008 #include <QtCore/qshareddata.h>
0009 #include <QtCore/qstring.h>
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 class QSqlErrorPrivate;
0014 QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QSqlErrorPrivate, Q_SQL_EXPORT)
0015 
0016 class Q_SQL_EXPORT QSqlError
0017 {
0018 public:
0019     enum ErrorType {
0020         NoError,
0021         ConnectionError,
0022         StatementError,
0023         TransactionError,
0024         UnknownError
0025     };
0026     QSqlError(const QString &driverText = QString(),
0027               const QString &databaseText = QString(),
0028               ErrorType type = NoError,
0029               const QString &errorCode = QString());
0030     QSqlError(const QSqlError &other);
0031     QSqlError(QSqlError &&other) noexcept = default;
0032     QSqlError& operator=(const QSqlError &other);
0033     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QSqlError)
0034     ~QSqlError();
0035 
0036     bool operator==(const QSqlError &other) const;
0037     bool operator!=(const QSqlError &other) const;
0038 
0039     void swap(QSqlError &other) noexcept { d.swap(other.d); }
0040 
0041     QString driverText() const;
0042     QString databaseText() const;
0043     ErrorType type() const;
0044     QString nativeErrorCode() const;
0045     QString text() const;
0046     bool isValid() const;
0047 
0048 private:
0049     QExplicitlySharedDataPointer<QSqlErrorPrivate> d;
0050 };
0051 
0052 Q_DECLARE_SHARED(QSqlError)
0053 
0054 #ifndef QT_NO_DEBUG_STREAM
0055 Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlError &);
0056 #endif
0057 
0058 QT_END_NAMESPACE
0059 
0060 #endif // QSQLERROR_H