Qt 6.x
The Qt SDK
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;
36 void setValue(int i, const QVariant& val);
37 void setValue(const QString& name, const QVariant& val);
38
39 void setNull(int i);
40 void setNull(const QString& name);
41 bool isNull(int i) const;
42 bool isNull(const QString& name) const;
43
44 int indexOf(const QString &name) const;
45 QString fieldName(int i) const;
46
47 QSqlField field(int i) const;
48 QSqlField field(const QString &name) const;
49
50 bool isGenerated(int i) const;
51 bool isGenerated(const QString& name) const;
52 void setGenerated(const QString& name, bool generated);
53 void setGenerated(int i, bool generated);
54
55 void append(const QSqlField& field);
56 void replace(int pos, const QSqlField& field);
57 void insert(int pos, const QSqlField& field);
58 void remove(int pos);
59
60 bool isEmpty() const;
61 bool contains(const QString& name) const;
62 void clear();
63 void clearValues();
64 int count() const;
65 QSqlRecord keyValues(const QSqlRecord &keyFields) const;
66
67private:
68 void detach();
70};
71
72#ifndef QT_NO_DEBUG_STREAM
73Q_SQL_EXPORT QDebug operator<<(QDebug, const QSqlRecord &);
74#endif
75
77
78#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.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qvariant.h:64
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:1219
#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]