File indexing completed on 2025-01-18 10:09:19
0001
0002
0003
0004 #ifndef QSQLRESULT_H
0005 #define QSQLRESULT_H
0006
0007 #include <QtSql/qtsqlglobal.h>
0008 #include <QtCore/qvariant.h>
0009 #include <QtCore/qcontainerfwd.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013
0014 class QString;
0015 class QSqlRecord;
0016 class QVariant;
0017 class QSqlDriver;
0018 class QSqlError;
0019 class QSqlResultPrivate;
0020
0021 class Q_SQL_EXPORT QSqlResult
0022 {
0023 Q_DECLARE_PRIVATE(QSqlResult)
0024 friend class QSqlQuery;
0025 friend class QSqlTableModelPrivate;
0026
0027 public:
0028 virtual ~QSqlResult();
0029 virtual QVariant handle() const;
0030
0031 protected:
0032 enum BindingSyntax {
0033 PositionalBinding,
0034 NamedBinding
0035 };
0036
0037 explicit QSqlResult(const QSqlDriver * db);
0038 QSqlResult(QSqlResultPrivate &dd);
0039 int at() const;
0040 QString lastQuery() const;
0041 QSqlError lastError() const;
0042 bool isValid() const;
0043 bool isActive() const;
0044 bool isSelect() const;
0045 bool isForwardOnly() const;
0046 const QSqlDriver* driver() const;
0047 virtual void setAt(int at);
0048 virtual void setActive(bool a);
0049 virtual void setLastError(const QSqlError& e);
0050 virtual void setQuery(const QString& query);
0051 virtual void setSelect(bool s);
0052 virtual void setForwardOnly(bool forward);
0053
0054
0055 virtual bool exec();
0056 virtual bool prepare(const QString& query);
0057 virtual bool savePrepare(const QString& sqlquery);
0058 virtual void bindValue(int pos, const QVariant& val, QSql::ParamType type);
0059 virtual void bindValue(const QString& placeholder, const QVariant& val,
0060 QSql::ParamType type);
0061 void addBindValue(const QVariant& val, QSql::ParamType type);
0062 QVariant boundValue(const QString& placeholder) const;
0063 QVariant boundValue(int pos) const;
0064 QSql::ParamType bindValueType(const QString& placeholder) const;
0065 QSql::ParamType bindValueType(int pos) const;
0066 int boundValueCount() const;
0067 #if QT_SQL_REMOVED_SINCE(6, 6)
0068 QList<QVariant> &boundValues() const;
0069 #endif
0070 QVariantList &boundValues(QT6_DECL_NEW_OVERLOAD);
0071 QVariantList boundValues(QT6_DECL_NEW_OVERLOAD) const;
0072
0073 QString executedQuery() const;
0074 QStringList boundValueNames() const;
0075 QString boundValueName(int pos) const;
0076 void clear();
0077 bool hasOutValues() const;
0078
0079 BindingSyntax bindingSyntax() const;
0080
0081 virtual QVariant data(int i) = 0;
0082 virtual bool isNull(int i) = 0;
0083 virtual bool reset(const QString& sqlquery) = 0;
0084 virtual bool fetch(int i) = 0;
0085 virtual bool fetchNext();
0086 virtual bool fetchPrevious();
0087 virtual bool fetchFirst() = 0;
0088 virtual bool fetchLast() = 0;
0089 virtual int size() = 0;
0090 virtual int numRowsAffected() = 0;
0091 virtual QSqlRecord record() const;
0092 virtual QVariant lastInsertId() const;
0093
0094 enum VirtualHookOperation { };
0095 virtual void virtual_hook(int id, void *data);
0096 virtual bool execBatch(bool arrayBind = false);
0097 virtual void detachFromResultSet();
0098 virtual void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy);
0099 QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const;
0100 void setPositionalBindingEnabled(bool enable);
0101 bool isPositionalBindingEnabled() const;
0102 virtual bool nextResult();
0103 void resetBindCount();
0104
0105 QSqlResultPrivate *d_ptr;
0106
0107 private:
0108 Q_DISABLE_COPY(QSqlResult)
0109 };
0110
0111 QT_END_NAMESPACE
0112
0113 #endif