Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:11:28

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 QSQLRECORD_H
0005 #define QSQLRECORD_H
0006 
0007 #include <QtSql/qtsqlglobal.h>
0008 #include <QtCore/qshareddata.h>
0009 #include <QtCore/qstring.h>
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 
0014 class QSqlField;
0015 class QVariant;
0016 class QSqlRecordPrivate;
0017 QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QSqlRecordPrivate, Q_SQL_EXPORT)
0018 
0019 class Q_SQL_EXPORT QSqlRecord
0020 {
0021 public:
0022     QSqlRecord();
0023     QSqlRecord(const QSqlRecord &other);
0024     QSqlRecord(QSqlRecord &&other) noexcept = default;
0025     QSqlRecord& operator=(const QSqlRecord &other);
0026     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSqlRecord)
0027     ~QSqlRecord();
0028 
0029     void swap(QSqlRecord &other) noexcept { d.swap(other.d); }
0030 
0031     bool operator==(const QSqlRecord &other) const;
0032     inline bool operator!=(const QSqlRecord &other) const { return !operator==(other); }
0033 
0034     QVariant value(int i) const;
0035 #if QT_SQL_REMOVED_SINCE(6, 8)
0036     QVariant value(const QString &name) const;
0037 #endif
0038     QVariant value(QAnyStringView name) const;
0039     void setValue(int i, const QVariant &val);
0040 #if QT_SQL_REMOVED_SINCE(6, 8)
0041     void setValue(const QString &name, const QVariant &val);
0042 #endif
0043     void setValue(QAnyStringView name, const QVariant &val);
0044 
0045     void setNull(int i);
0046 #if QT_SQL_REMOVED_SINCE(6, 8)
0047     void setNull(const QString &name);
0048 #endif
0049     void setNull(QAnyStringView name);
0050     bool isNull(int i) const;
0051 #if QT_SQL_REMOVED_SINCE(6, 8)
0052     bool isNull(const QString &name) const;
0053 #endif
0054     bool isNull(QAnyStringView name) const;
0055 
0056 #if QT_SQL_REMOVED_SINCE(6, 8)
0057     int indexOf(const QString &name) const;
0058 #endif
0059     int indexOf(QAnyStringView name) const;
0060     QString fieldName(int i) const;
0061 
0062     QSqlField field(int i) const;
0063 #if QT_SQL_REMOVED_SINCE(6, 8)
0064     QSqlField field(const QString &name) const;
0065 #endif
0066     QSqlField field(QAnyStringView name) const;
0067 
0068     bool isGenerated(int i) const;
0069 #if QT_SQL_REMOVED_SINCE(6, 8)
0070     bool isGenerated(const QString &name) const;
0071 #endif
0072     bool isGenerated(QAnyStringView name) const;
0073 #if QT_SQL_REMOVED_SINCE(6, 8)
0074     void setGenerated(const QString &name, bool generated);
0075 #endif
0076     void setGenerated(QAnyStringView name, bool generated);
0077     void setGenerated(int i, bool generated);
0078 
0079     void append(const QSqlField &field);
0080     void replace(int pos, const QSqlField &field);
0081     void insert(int pos, const QSqlField &field);
0082     void remove(int pos);
0083 
0084     bool isEmpty() const;
0085 #if QT_SQL_REMOVED_SINCE(6, 8)
0086     bool contains(const QString &name) const;
0087 #endif
0088     bool contains(QAnyStringView name) const;
0089     void clear();
0090     void clearValues();
0091     int count() const;
0092     QSqlRecord keyValues(const QSqlRecord &keyFields) const;
0093 
0094 private:
0095     void detach();
0096     QExplicitlySharedDataPointer<QSqlRecordPrivate> d;
0097 };
0098 
0099 Q_DECLARE_SHARED(QSqlRecord)
0100 
0101 #ifndef QT_NO_DEBUG_STREAM
0102 Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &);
0103 #endif
0104 
0105 QT_END_NAMESPACE
0106 
0107 #endif // QSQLRECORD_H