2016-12-26 16:06:55 +01:00
|
|
|
|
#ifndef QUERYRESULTMODEL_H
|
|
|
|
|
|
#define QUERYRESULTMODEL_H
|
|
|
|
|
|
|
2018-01-15 12:23:41 +01:00
|
|
|
|
#include <QAbstractTableModel>
|
2022-04-09 07:10:29 +02:00
|
|
|
|
#include "catalog/models/BaseTableModel.h"
|
2017-08-26 11:45:50 +02:00
|
|
|
|
#include "Pgsql_Connection.h"
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
2017-12-13 18:49:58 +01:00
|
|
|
|
class PgDatabaseCatalog;
|
|
|
|
|
|
|
2018-01-15 12:23:41 +01:00
|
|
|
|
class QueryResultModel : public QAbstractTableModel
|
2016-12-26 16:06:55 +01:00
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
2017-12-13 18:49:58 +01:00
|
|
|
|
QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Result> r, std::shared_ptr<PgDatabaseCatalog> cat);
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
2019-02-08 10:10:11 +01:00
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
2018-09-18 11:53:19 +02:00
|
|
|
|
std::shared_ptr<const Pgsql::Result> GetPgsqlResult() const { return result; }
|
2017-12-09 19:47:33 +01:00
|
|
|
|
protected:
|
2018-01-15 12:23:41 +01:00
|
|
|
|
// virtual Oid getType(int column) const override;
|
|
|
|
|
|
// virtual QVariant getData(const QModelIndex &index) const override;
|
2016-12-26 16:06:55 +01:00
|
|
|
|
private:
|
2017-01-08 09:58:34 +01:00
|
|
|
|
std::shared_ptr<Pgsql::Result> result;
|
2017-12-13 18:49:58 +01:00
|
|
|
|
std::shared_ptr<PgDatabaseCatalog> catalog;
|
2016-12-26 16:06:55 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // QUERYRESULTMODEL_H
|