File indexing completed on 2025-01-18 10:09:19
0001
0002
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 QVariant value(const QString &name) const;
0036 void setValue(int i, const QVariant &val);
0037 void setValue(const QString &name, const QVariant &val);
0038
0039 void setNull(int i);
0040 void setNull(const QString &name);
0041 bool isNull(int i) const;
0042 bool isNull(const QString &name) const;
0043
0044 int indexOf(const QString &name) const;
0045 QString fieldName(int i) const;
0046
0047 QSqlField field(int i) const;
0048 QSqlField field(const QString &name) const;
0049
0050 bool isGenerated(int i) const;
0051 bool isGenerated(const QString &name) const;
0052 void setGenerated(const QString &name, bool generated);
0053 void setGenerated(int i, bool generated);
0054
0055 void append(const QSqlField &field);
0056 void replace(int pos, const QSqlField &field);
0057 void insert(int pos, const QSqlField &field);
0058 void remove(int pos);
0059
0060 bool isEmpty() const;
0061 bool contains(const QString &name) const;
0062 void clear();
0063 void clearValues();
0064 int count() const;
0065 QSqlRecord keyValues(const QSqlRecord &keyFields) const;
0066
0067 private:
0068 void detach();
0069 QExplicitlySharedDataPointer<QSqlRecordPrivate> d;
0070 };
0071
0072 Q_DECLARE_SHARED(QSqlRecord)
0073
0074 #ifndef QT_NO_DEBUG_STREAM
0075 Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &);
0076 #endif
0077
0078 QT_END_NAMESPACE
0079
0080 #endif