Overview of triggers extended with function name and arguments.
Did a lot of refactoring on the catalog to keep things clean.
This commit is contained in:
parent
35813ae926
commit
fcb191f2cc
44 changed files with 797 additions and 404 deletions
|
|
@ -225,7 +225,7 @@ QVariant ColumnTableModel::data(const QModelIndex &index, int role) const
|
|||
QVariant v;
|
||||
const auto &t = m_columns[index.row()];
|
||||
auto c = m_catalog->types()->getByKey(t.typid);
|
||||
switch (c.category) {
|
||||
switch (c->category) {
|
||||
case TypCategory::Boolean:
|
||||
v = QBrush(Qt::darkGreen);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "CreateDatabaseDialog.h"
|
||||
#include "CreateDatabaseDialog.h"
|
||||
#include "ui_CreateDatabaseDialog.h"
|
||||
|
||||
CreateDatabaseDialog::CreateDatabaseDialog(QWidget *parent) :
|
||||
|
|
@ -12,3 +12,14 @@ CreateDatabaseDialog::~CreateDatabaseDialog()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//CREATE DATABASE name
|
||||
// [ [ WITH ] [ OWNER [=] user_name ]
|
||||
// [ TEMPLATE [=] template ]
|
||||
// [ ENCODING [=] encoding ]
|
||||
// [ LC_COLLATE [=] lc_collate ]
|
||||
// [ LC_CTYPE [=] lc_ctype ]
|
||||
// [ TABLESPACE [=] tablespace_name ]
|
||||
// [ ALLOW_CONNECTIONS [=] allowconn ]
|
||||
// [ CONNECTION LIMIT [=] connlimit ]
|
||||
// [ IS_TEMPLATE [=] istemplate ] ]
|
||||
|
|
|
|||
|
|
@ -15,102 +15,117 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Encoding</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Collation order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_3"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Character classification</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBox_4"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Connection limit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinBox"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Tablespace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboBox_5"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Owner</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="comboBox_6"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Template database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>Allow connections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QTabWidget" name="">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Input" native="true">
|
||||
<attribute name="title">
|
||||
<string>Input</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Template</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Encoding</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Collation order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBox_3"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Character classification</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBox_4"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Connection limit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSpinBox" name="spinBox"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Tablespace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="comboBox_5"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_6"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Owner</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Template database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="text">
|
||||
<string>Allow connections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>SQL</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "MainWindow.h"
|
||||
#include "ResultTableModelUtil.h"
|
||||
#include "PgLabItemDelegate.h"
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
CrudTab::CrudTab(MainWindow *parent)
|
||||
|
|
@ -23,6 +24,12 @@ CrudTab::CrudTab(MainWindow *parent)
|
|||
|
||||
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->tableView->addAction(ui->actionRemove_rows);
|
||||
|
||||
auto horizontal_header = ui->tableView->horizontalHeader();
|
||||
horizontal_header->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
|
||||
connect(horizontal_header, &QHeaderView::customContextMenuRequested,
|
||||
this, &CrudTab::headerCustomContextMenu);
|
||||
|
||||
//auto selection_model = ui->tableView->selectionModel();
|
||||
// connect(ui->tableView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
// &CrudTab::tableView_currentRowChanged);
|
||||
|
|
@ -79,3 +86,16 @@ std::vector<QAction*> CrudTab::getToolbarActions()
|
|||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
void CrudTab::headerCustomContextMenu(const QPoint &pos)
|
||||
{
|
||||
auto menu = new QMenu(this);
|
||||
|
||||
QAction *action = new QAction(QIcon(":/icons/script_go.png"), tr("Refresh"), this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_F5));
|
||||
connect(action, &QAction::triggered, this, &CrudTab::refresh);
|
||||
menu->addAction(action);
|
||||
|
||||
auto horizontal_header = ui->tableView->horizontalHeader();
|
||||
menu->popup(horizontal_header->mapToGlobal(pos));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ private:
|
|||
private slots:
|
||||
// void tableView_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void on_actionRemove_rows_triggered();
|
||||
void headerCustomContextMenu(const QPoint &pos);
|
||||
};
|
||||
|
||||
#endif // CRUDTAB_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Pgsql::Params QueryParamListController::params() const
|
|||
Pgsql::Params params;
|
||||
auto types = m_openDatabase->catalogue()->types();
|
||||
for (auto e : m_paramList.GetParams()) {
|
||||
Oid oid = types->getByName(e.type).oid;
|
||||
Oid oid = types->getByName(e.type)->oid;
|
||||
params.add(e.value, oid);
|
||||
}
|
||||
return params;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ void TriggerPage::tableView_selectionChanged(const QItemSelection &/*selected*/,
|
|||
QString creates;
|
||||
for (auto rij : rijen) {
|
||||
auto&& t = m_model->trigger(rij);
|
||||
drops += t.dropSql(*m_catalog) % "\n";
|
||||
creates += t.createSql(*m_catalog) % "\n";
|
||||
drops += t.dropSql() % "\n";
|
||||
creates += t.createSql() % "\n";
|
||||
}
|
||||
m_definitionView->setPlainText(drops % "\n" % creates);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ QVariant TriggerTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
case InitiallyCol: return tr("ID");
|
||||
case ForCol: return tr("For");
|
||||
case CondCol: return tr("Cond.");
|
||||
case ReferencingCol: return tr("Referencing");
|
||||
// case ReferencingCol: return tr("Referencing");
|
||||
case ProcedureCol: return tr("Function");
|
||||
}
|
||||
}
|
||||
|
|
@ -91,9 +91,9 @@ QVariant TriggerTableModel::getData(const QModelIndex &index) const
|
|||
case DeferrableCol: return t.deferrable;
|
||||
case InitiallyCol: return t.initdeferred;
|
||||
case ForCol: return t.forEach();
|
||||
// case CondCol: return tr("Cond.");
|
||||
case CondCol: return t.whenclause;
|
||||
// case ReferencingCol: return tr("Referencing");
|
||||
// case ProcedureCol: return tr("Function");
|
||||
case ProcedureCol: return t.procedure();
|
||||
|
||||
}
|
||||
return QVariant();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
InitiallyCol,
|
||||
ForCol,
|
||||
CondCol,
|
||||
ReferencingCol,
|
||||
//ReferencingCol,
|
||||
ProcedureCol,
|
||||
colCount
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue