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 QVariant value(const QString &name) const;
37 void setValue(int i, const QVariant &val);
38 void setValue(const QString &name, const QVariant &val);
39 void setValue(QStringView name, const QVariant &val);
40
41 void setNull(int i);
42 void setNull(const QString &name);
43 void setNull(QStringView name);
44 bool isNull(int i) const;
45 bool isNull(const QString &name) const;
46 bool isNull(QStringView name) const;
47
48 int indexOf(const QString &name) const;
49 int indexOf(QStringView name) const;
50 QString fieldName(int i) const;
51
52 QSqlField field(int i) const;
53 QSqlField field(const QString &name) const;
54 QSqlField field(QStringView name) const;
55
56 bool isGenerated(int i) const;
57 bool isGenerated(const QString &name) const;
58 bool isGenerated(QStringView name) const;
59 void setGenerated(const QString &name, bool generated);
60 void setGenerated(QStringView name, bool generated);
61 void setGenerated(int i, bool generated);
62
63 void append(const QSqlField &field);
64 void replace(int pos, const QSqlField &field);
65 void insert(int pos, const QSqlField &field);
66 void remove(int pos);
67
68 bool isEmpty() const;
69 bool contains(const QString &name) const;
70 bool contains(QStringView name) const;
71 void clear();
72 void clearValues();
73 int count() const;
74 QSqlRecord keyValues(const QSqlRecord &keyFields) const;
75
76private:
77 void detach();
78 QExplicitlySharedDataPointer<QSqlRecordPrivate> d;
79};
80
81Q_DECLARE_SHARED(QSqlRecord)
82
83#ifndef QT_NO_DEBUG_STREAM
84Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &);
85#endif
86
88
89#endif // QSQLRECORD_H
\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.
\inmodule QtCore
Definition qstringview.h:78
\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]