pgLab/pglab/QueryResultModel.h
eelke f5145f36ed wip: codegenerator, basic widget present for showing the generated code and specifying
parameters. Some code is also generated but it is not complete yet.

minimum still required
- field assignments
- properly format and escape the query string
2018-09-18 11:54:43 +02:00

31 lines
1.1 KiB
C++

#ifndef QUERYRESULTMODEL_H
#define QUERYRESULTMODEL_H
#include <QAbstractTableModel>
#include "BaseTableModel.h"
#include "Pgsql_Connection.h"
class PgDatabaseCatalog;
class QueryResultModel : public QAbstractTableModel
{
Q_OBJECT
public:
QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Result> r, std::shared_ptr<PgDatabaseCatalog> cat);
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;
// virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
std::shared_ptr<const Pgsql::Result> GetPgsqlResult() const { return result; }
protected:
// virtual Oid getType(int column) const override;
// virtual QVariant getData(const QModelIndex &index) const override;
private:
std::shared_ptr<Pgsql::Result> result;
std::shared_ptr<PgDatabaseCatalog> catalog;
};
#endif // QUERYRESULTMODEL_H