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
qsqlrecord.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 QSQLRECORD_H
5#define QSQLRECORD_H
6
7#include <QtSql/qtsqlglobal.h>
8#include <QtCore/qshareddata.h>
9#include <QtCore/qstring.h>
10
12
13
14class QSqlField;
15class QVariant;
18
19class Q_SQL_EXPORT QSqlRecord
20{
21public:
22 QSqlRecord();
24 QSqlRecord(QSqlRecord &&other) noexcept = default;
26 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSqlRecord)
28
29 void swap(QSqlRecord &other) noexcept { d.swap(other.d); }
30
31 bool operator==(const QSqlRecord &other) const;
32 inline bool operator!=(const QSqlRecord &other) const { return !operator==(other); }
33
34 QVariant value(int i) const;
35#if QT_SQL_REMOVED_SINCE(6, 8)
36 QVariant value(const QString &name) const;
37#endif
39 void setValue(int i, const QVariant &val);
40#if QT_SQL_REMOVED_SINCE(6, 8)
41 void setValue(const QString &name, const QVariant &val);
42#endif
44
45 void setNull(int i);
46#if QT_SQL_REMOVED_SINCE(6, 8)
47 void setNull(const QString &name);
48#endif
49 void setNull(QAnyStringView name);
50 bool isNull(int i) const;
51#if QT_SQL_REMOVED_SINCE(6, 8)
52 bool isNull(const QString &name) const;
53#endif
54 bool isNull(QAnyStringView name) const;
55
56#if QT_SQL_REMOVED_SINCE(6, 8)
57 int indexOf(const QString &name) const;
58#endif
59 int indexOf(QAnyStringView name) const;
60 QString fieldName(int i) const;
61
62 QSqlField field(int i) const;
63#if QT_SQL_REMOVED_SINCE(6, 8)
64 QSqlField field(const QString &name) const;
65#endif
66 QSqlField field(QAnyStringView name) const;
67
68 bool isGenerated(int i) const;
69#if QT_SQL_REMOVED_SINCE(6, 8)
70 bool isGenerated(const QString &name) const;
71#endif
72 bool isGenerated(QAnyStringView name) const;
73#if QT_SQL_REMOVED_SINCE(6, 8)
74 void setGenerated(const QString &name, bool generated);
75#endif
76 void setGenerated(QAnyStringView name, bool generated);
77 void setGenerated(int i, bool generated);
78
79 void append(const QSqlField &field);
80 void replace(int pos, const QSqlField &field);
81 void insert(int pos, const QSqlField &field);
82 void remove(int pos);
83
84 bool isEmpty() const;
85#if QT_SQL_REMOVED_SINCE(6, 8)
86 bool contains(const QString &name) const;
87#endif
88 bool contains(QAnyStringView name) const;
89 void clear();
90 void clearValues();
91 int count() const;
92 QSqlRecord keyValues(const QSqlRecord &keyFields) const;
93
94private:
95 void detach();
96 QExplicitlySharedDataPointer<QSqlRecordPrivate> d;
97};
98
99Q_DECLARE_SHARED(QSqlRecord)
100
101#ifndef QT_NO_DEBUG_STREAM
102Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &);
103#endif
104
106
107#endif // QSQLRECORD_H
\inmodule QtCore
\inmodule QtCore
The QSqlField class manipulates the fields in SQL database tables and views.
Definition qsqlfield.h:19
The QSqlRecord class encapsulates a database record.
Definition qsqlrecord.h:20
void swap(QSqlRecord &other) noexcept
Definition qsqlrecord.h:29
~QSqlRecord()
Destroys the object and frees any allocated resources.
QSqlRecord(QSqlRecord &&other) noexcept=default
bool operator!=(const QSqlRecord &other) const
Returns true if this object is not identical to other; otherwise returns false.
Definition qsqlrecord.h:32
QSqlRecord & operator=(const QSqlRecord &other)
Sets the record equal to other.
QSqlRecord(const QSqlRecord &other)
Constructs a copy of other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
b clear()
list append(new Employee("Blackpool", "Stephen"))
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool contains(const QJsonArray &haystack, unsigned needle)
Definition qopengl.cpp:116
GLenum GLenum GLsizei count
GLuint name
GLuint GLfloat * val
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 QSqlRecord &)
settings setValue("DataPump/bgcolor", color)
settings remove("monkey")
list indexOf("B")
QSharedPointer< T > other(t)
[5]