Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 08:32:47

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