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
qsqlindex.cpp
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#include "qsqlindex.h"
5
6#include "qsqlfield.h"
7
9
10using namespace Qt::StringLiterals;
11
30QSqlIndex::QSqlIndex(const QString& cursorname, const QString& name)
31 : cursor(cursorname), nm(name)
32{
33}
34
40 : QSqlRecord(other), cursor(other.cursor), nm(other.nm), sorts(other.sorts)
41{
42}
43
68{
69 cursor = other.cursor;
70 nm = other.nm;
71 sorts = other.sorts;
73 return *this;
74}
75
76
85
99{
100 nm = name;
101}
102
108void QSqlIndex::append(const QSqlField& field)
109{
110 append(field, false);
111}
112
121void QSqlIndex::append(const QSqlField& field, bool desc)
122{
123 sorts.append(desc);
125}
126
127
134{
135 if (i >= 0 && i < sorts.size())
136 return sorts[i];
137 return false;
138}
139
146void QSqlIndex::setDescending(int i, bool desc)
147{
148 if (i >= 0 && i < sorts.size())
149 sorts[i] = desc;
150}
151
165void QSqlIndex::setCursorName(const QString& cursorName)
166{
167 cursor = cursorName;
168}
169
171
172#include "moc_qsqlindex.cpp"
qsizetype size() const noexcept
Definition qlist.h:397
void append(parameter_type t)
Definition qlist.h:458
The QSqlField class manipulates the fields in SQL database tables and views.
Definition qsqlfield.h:19
The QSqlIndex class provides functions to manipulate and describe database indexes.
Definition qsqlindex.h:18
void setName(const QString &name)
Sets \l name to name.
Definition qsqlindex.cpp:98
bool isDescending(int i) const
Returns true if field i in the index is sorted in descending order; otherwise returns false.
void setDescending(int i, bool desc)
If desc is true, field i is sorted in descending order.
QSqlIndex(const QString &cursorName=QString(), const QString &name=QString())
Constructs an empty index using the cursor name cursorname and index name name.
Definition qsqlindex.cpp:30
~QSqlIndex()
Destroys the object and frees any allocated resources.
Definition qsqlindex.cpp:81
QString name
Definition qsqlindex.h:21
void setCursorName(const QString &cursorName)
Sets \l cursorName to cursorName.
void append(const QSqlField &field)
Appends the field field to the list of indexed fields.
QString cursorName
Definition qsqlindex.h:22
QSqlIndex & operator=(const QSqlIndex &other)
Move-assigns other to this QSqlIndex instance.
Definition qsqlindex.cpp:67
The QSqlRecord class encapsulates a database record.
Definition qsqlrecord.h:20
QSqlField field(int i) const
Returns the field at position index.
void append(const QSqlField &field)
Append a copy of field field to the end of the record.
QSqlRecord & operator=(const QSqlRecord &other)
Sets the record equal to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QCursor cursor
Combined button and popup list for selecting options.
GLuint name
QSharedPointer< T > other(t)
[5]