Go to the documentation of this file.00001
00004 #ifndef BPSQUERY_H
00005 #define BPSQUERY_H
00006
00007 #include "bpscore_global.h"
00008 #include <QObject>
00009 #include <QScriptable>
00010 #include <QVariant>
00011 #include <qsql.h>
00012
00013 class BpsDatastore;
00014 class BpsSqlValues;
00015 class QSqlQuery;
00016 class QSqlRecord;
00017
00023 class BPSCORE_EXPORT BpsQuery : public QObject, protected QScriptable
00024 {
00025 Q_OBJECT
00026 BPS_PRIVATE(BpsQuery)
00027
00028 public:
00029
00034 BpsQuery(BpsDatastore* aDatastore);
00035
00036 virtual ~BpsQuery();
00037
00041 bool isValid() const;
00042
00046 bool isActive() const;
00047
00051 bool isSelect() const;
00052
00057 bool isForwardOnly() const;
00058
00068 void setForwardOnly(bool aForward = true);
00069
00077 void prepare(const QString& aSql);
00078
00084 void bind(const QVariant& aValue, QSql::ParamType aParamType = QSql::In);
00085
00090 void execute(const QString& aSql = QString());
00091
00098 void execute(const QVariantList& aValues);
00099
00103 BpsDatastore* datastore() const;
00104
00108 void clear();
00109
00117 bool first();
00118
00126 bool last();
00127
00143 bool next();
00144
00159 bool previous();
00160
00184 bool seek(int aIndex, bool aRelative = false);
00185
00191 bool isNull(int aField) const;
00192
00198 int numRowsAffected() const;
00199
00206 int size() const;
00207
00214 int at() const;
00215
00221 QVariant value(int aField) const;
00222
00227 QSqlRecord record() const;
00228
00233 BpsSqlValues values() const;
00234
00239 QVariantMap valuesAsMap() const;
00240
00246 QVariant boundValue(int aField) const;
00247
00251 QString sql() const;
00252
00256 QSqlQuery* query() const;
00257
00258 };
00259
00260 #endif // BPSQUERY_H