Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsqlindex.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// Qt-Security score:significant reason:default
4
5#ifndef QSQLINDEX_H
6#define QSQLINDEX_H
7
8#include <QtSql/qtsqlglobal.h>
9#include <QtSql/qsqlrecord.h>
10#include <QtCore/qlist.h>
11#include <QtCore/qmetaobject.h>
12#include <QtCore/qstring.h>
13
14// clazy:excludeall=qproperty-without-notify
16
17
18class Q_SQL_EXPORT QSqlIndex : public QSqlRecord
19{
20 Q_GADGET
21 Q_PROPERTY(QString name READ name WRITE setName)
22 Q_PROPERTY(QString cursorName READ cursorName WRITE setCursorName)
23
24public:
25 explicit QSqlIndex(const QString &cursorName = QString(), const QString &name = QString());
26 QSqlIndex(const QSqlIndex &other);
27 QSqlIndex(QSqlIndex &&other) noexcept = default;
28 ~QSqlIndex();
29 QSqlIndex &operator=(const QSqlIndex &other);
30 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QSqlIndex)
31
32 void swap(QSqlIndex &other) noexcept {
33 QSqlRecord::swap(other);
34 cursor.swap(other.cursor);
35 nm.swap(other.nm);
36 sorts.swap(other.sorts);
37 }
38
39 void setCursorName(const QString &cursorName);
40 inline QString cursorName() const { return cursor; }
41 void setName(const QString& name);
42 inline QString name() const { return nm; }
43
44 void append(const QSqlField &field);
45 void append(const QSqlField &field, bool desc);
46
47 bool isDescending(int i) const;
48 void setDescending(int i, bool desc);
49
50private:
51 // ### Qt7: move to d-ptr
52 QString cursor;
53 QString nm;
54 QList<bool> sorts;
55};
56
58
59QT_END_NAMESPACE
60
61#endif // QSQLINDEX_H
void qSplitTableQualifier(const QString &qualifier, QString &catalog, QString &schema, QString &table) const
Definition qsql_db2.cpp:443
QList< QVariant * > valueCache
Definition qsql_db2.cpp:115
QSqlRecord recInf
Definition qsql_db2.cpp:114
bool fetchLast() override
Positions the result to the last record (last row) in the result.
Definition qsql_db2.cpp:940
QVariant handle() const override
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVarian...
Definition qsql_db2.cpp:528
void detachFromResultSet() override
void virtual_hook(int id, void *data) override
int numRowsAffected() override
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or i...
bool fetch(int i) override
Positions the result to an arbitrary (zero-based) row index.
Definition qsql_db2.cpp:865
bool isNull(int i) override
Returns true if the field at position index in the current row is null; otherwise returns false.
bool exec() override
Executes the query, returning true if successful; otherwise returns false.
Definition qsql_db2.cpp:613
bool fetchFirst() override
Positions the result to the first record (row 0) in the result.
Definition qsql_db2.cpp:918
int size() override
Returns the size of the SELECT result, or -1 if it cannot be determined or if the query is not a SELE...
bool prepare(const QString &query) override
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
Definition qsql_db2.cpp:588
QSqlRecord record() const override
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
bool fetchNext() override
Positions the result to the next available record (row) in the result.
Definition qsql_db2.cpp:900
bool reset(const QString &query) override
Sets the result to use the SQL statement query for subsequent data retrieval.
Definition qsql_db2.cpp:551
bool nextResult() override
QVariant data(int field) override
Returns the data for field index in the current row as a QVariant.
Definition qsql_db2.cpp:972
\inmodule QtCore \reentrant
Definition qdatetime.h:29
Definition qlist.h:80
The QSqlError class provides SQL database error information.
Definition qsqlerror.h:18
The QSqlField class manipulates the fields in SQL database tables and views.
Definition qsqlfield.h:20
The QSqlIndex class provides functions to manipulate and describe database indexes.
Definition qsqlindex.h:19
\inmodule QtCore \reentrant
Definition qdatetime.h:250
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
static QSqlField qMakeFieldInfo(const QDB2ResultPrivate *d, int i)
Definition qsql_db2.cpp:252
static QSqlField qMakeFieldInfo(const SQLHANDLE hStmt)
Definition qsql_db2.cpp:469
static bool qMakeStatement(QDB2ResultPrivate *d, bool forwardOnly, bool setForwardOnly=true)
Definition qsql_db2.cpp:486
static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLLEN &lengthIndicator, bool &isNull)
Definition qsql_db2.cpp:387
static void qSqlWarning(const QString &message, const T *d)
Definition qsql_db2.cpp:182
static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool &isNull)
Definition qsql_db2.cpp:347
static SQLBIGINT qGetBigIntData(SQLHANDLE hStmt, int column, bool &isNull)
Definition qsql_db2.cpp:330
static int qGetIntData(SQLHANDLE hStmt, int column, bool &isNull)
Definition qsql_db2.cpp:293
static SQLTCHAR * qToTChar(const QString &str)
Definition qsql_db2.cpp:125
static const SQLSMALLINT TABLENAMESIZE
Definition qsql_db2.cpp:40
static const SQLSMALLINT qParamType[4]
Definition qsql_db2.cpp:41
static QString qFromTChar(SQLTCHAR *str)
Definition qsql_db2.cpp:118
static const int COLNAMESIZE
Definition qsql_db2.cpp:36
static QSqlError qMakeError(const QString &err, QSqlError::ErrorType type, const T *p)
Definition qsql_db2.cpp:189
static QMetaType qDecodeDB2Type(SQLSMALLINT sqltype)
Definition qsql_db2.cpp:197
static QString qDB2Warn(const QDB2DriverPrivate *d, QStringList *errorCodes=nullptr)
Definition qsql_db2.cpp:153
static QString qWarnDB2Handle(int handleType, SQLHANDLE handle, int *errorCode)
Definition qsql_db2.cpp:130
static QString qDB2Warn(const QDB2ResultPrivate *d, QStringList *errorCodes=nullptr)
Definition qsql_db2.cpp:169
static double qGetDoubleData(SQLHANDLE hStmt, int column, bool &isNull)
Definition qsql_db2.cpp:311