Can use the parameter list in the query window now.
Still requires extensive testing for all possible types.
This commit is contained in:
parent
aefc9eb7ba
commit
3af26d915e
14 changed files with 461 additions and 242 deletions
|
|
@ -2,12 +2,29 @@
|
|||
#define PARAMLISTMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <vector>
|
||||
#include "Pgsql_declare.h"
|
||||
|
||||
class ParamListModel : public QAbstractTableModel
|
||||
{
|
||||
class ParamListModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
class Param {
|
||||
public:
|
||||
QString value; ///< the value of the parameter (currently this is passed directly)
|
||||
QString type = InvalidOid; ///< the type of the parameter
|
||||
|
||||
Param() = default;
|
||||
Param(const QString &v, const QString t)
|
||||
: value(v), type(t)
|
||||
{}
|
||||
};
|
||||
|
||||
enum e_Column {
|
||||
ColValue = 0,
|
||||
ColType,
|
||||
ColumnCount // Keep last not a column just the count
|
||||
};
|
||||
|
||||
explicit ParamListModel(QObject *parent = 0);
|
||||
|
||||
// Header:
|
||||
|
|
@ -26,16 +43,15 @@ public:
|
|||
int role = Qt::EditRole) override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
// Add data:
|
||||
// bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
//bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
// Remove data:
|
||||
// bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
//bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
auto begin() const { return m_paramList.begin(); }
|
||||
auto end() const { return m_paramList.end(); }
|
||||
private:
|
||||
|
||||
using t_ParamList = std::vector<Param>;
|
||||
t_ParamList m_paramList;
|
||||
};
|
||||
|
||||
#endif // PARAMLISTMODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue