Created IndexModel for displaying the indexes on a table. Constraints can now show the SQL to drop and create them.
The keyword list is now directly based of the official keyword list from postgresql.
This commit is contained in:
parent
b436814eb5
commit
97d4e2a1a4
24 changed files with 754 additions and 228 deletions
45
pglab/IndexModel.h
Normal file
45
pglab/IndexModel.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef INDEXMODEL_H
|
||||
#define INDEXMODEL_H
|
||||
|
||||
#include "BaseTableModel.h"
|
||||
#include "PgClass.h"
|
||||
#include "PgIndex.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class PgDatabaseCatalog;
|
||||
|
||||
class IndexModel: public BaseTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
using BaseTableModel::BaseTableModel;
|
||||
|
||||
enum e_Columns : int {
|
||||
TypeCol, /// primary/unique/normal
|
||||
NameCol, ///
|
||||
ColumnsCol, ///
|
||||
ConditionCol,
|
||||
colCount };
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
void setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table);
|
||||
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
protected:
|
||||
virtual Oid getType(int column) const override;
|
||||
virtual QVariant getData(const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const PgDatabaseCatalog> m_catalog;
|
||||
PgClass m_table;
|
||||
|
||||
using t_Indexes = std::vector<PgIndex>;
|
||||
t_Indexes m_indexes;
|
||||
};
|
||||
|
||||
#endif // INDEXMODEL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue