6.0.0-rc4Source

QSqlIndex Class

The QSqlIndex class provides functions to manipulate and describe database indexes. More…

Header#include <QSqlIndex>
CMaketarget_link_libraries(app PRIVATE Nt::Sql)
ModuleNt SQL C++ Classes
InheritsQSqlRecord

List of all members, including inherited members

Public Functions

QSqlIndex(const QString &cursorName = QString(), const QString &name = QString())
QSqlIndex(const QSqlIndex &other)
QSqlIndex(QSqlIndex &&other)
QSqlIndex &operator=(const QSqlIndex &other)
QSqlIndex &operator=(QSqlIndex &&other)
~QSqlIndex()
voidsetCursorName(const QString &cursorName)
QStringcursorName() const
voidsetName(const QString &name)
QStringname() const
voidappend(const QSqlField &field)
voidappend(const QSqlField &field, bool desc)
boolisDescending(int i) const
voidsetDescending(int i, bool desc)
voidswap(QSqlIndex &other)

Detailed Description

A QSqlIndex is a record whose fields are the columns of an index, each with a sort order. QSqlDatabase::primaryIndex() returns the primary key of a table as one.

See also QSqlDatabase::primaryIndex() and QSqlRecord.

Differences from Qt

None.

Member Function Documentation

[explicit] QSqlIndex::QSqlIndex(const QString &cursorName = QString(), const QString &name = QString())

Constructs an empty index called name for the table or view cursorName.

QSqlIndex::QSqlIndex(const QSqlIndex &other)

Constructs a copy of other.

QSqlIndex::QSqlIndex(QSqlIndex &&other)

Constructs an index with the contents of other, which is left empty.

[override] QSqlIndex::~QSqlIndex()

Destroys the index.

void QSqlIndex::append(const QSqlField &field)

Adds field to the index, sorted in ascending order.

void QSqlIndex::append(const QSqlField &field, bool desc)

This is an overloaded function.

Adds field to the index, sorted in descending order if desc is true.

QString QSqlIndex::cursorName() const

Returns the name of the table or view that the index belongs to.

See also setCursorName().

bool QSqlIndex::isDescending(int i) const

Returns true if the field at position i is sorted in descending order; otherwise returns false.

See also setDescending().

QString QSqlIndex::name() const

Returns the name of the index.

See also setName().

QSqlIndex & QSqlIndex::operator=(const QSqlIndex &other)

Makes this index a copy of other and returns a reference to it.

QSqlIndex & QSqlIndex::operator=(QSqlIndex &&other)

Moves the contents of other to this index and returns a reference to it.

void QSqlIndex::setCursorName(const QString &cursorName)

Sets the name of the table or view that the index belongs to, to cursorName.

See also cursorName().

void QSqlIndex::setDescending(int i, bool desc)

Sets the sort order of the field at position i to descending if desc is true, and to ascending otherwise. Nothing happens if there is no such field.

See also isDescending().

void QSqlIndex::setName(const QString &name)

Sets the name of the index to name.

See also name().

void QSqlIndex::swap(QSqlIndex &other)

Swaps this index with other.