The list of indexes on a table now also shows the access method (ie btree)
This commit is contained in:
parent
7c4f1a4752
commit
50cb21b6f9
17 changed files with 198 additions and 26 deletions
|
|
@ -84,6 +84,31 @@ private:
|
|||
using PKeyValues = std::vector<std::string>;
|
||||
|
||||
|
||||
class ColumnSort {
|
||||
public:
|
||||
enum Direction { Ascending, Descending };
|
||||
enum NullSorting {
|
||||
Default, ///< Behaves like NULL values are larger then non NULL values ASC NULLS LAST or DESC NULLS FIRST
|
||||
First,
|
||||
Last };
|
||||
|
||||
std::string columnName;
|
||||
Direction direction = Direction::Ascending;
|
||||
NullSorting nulls = NullSorting::Default;
|
||||
|
||||
std::string toSql() const
|
||||
{
|
||||
std::string res = columnName;
|
||||
if (direction == Direction::Descending)
|
||||
res += " DESC";
|
||||
if (nulls == NullSorting::First)
|
||||
res += " NULLS FIRST";
|
||||
else if (nulls == NullSorting::Last)
|
||||
res += " NULLS LAST";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// using RowData = std::vector<std::string>;
|
||||
// using RowDataPtr = std::unique_ptr<RowData>;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void IndexModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgC
|
|||
|
||||
int IndexModel::rowCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return m_indexes.size();
|
||||
return (int)m_indexes.size();
|
||||
}
|
||||
|
||||
int IndexModel::columnCount(const QModelIndex &/*parent*/) const
|
||||
|
|
@ -43,6 +43,9 @@ QVariant IndexModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||
case NameCol:
|
||||
c = tr("Name");
|
||||
break;
|
||||
case AmCol:
|
||||
c = tr("AM");
|
||||
break;
|
||||
case ColumnsCol:
|
||||
c = tr("On");
|
||||
break;
|
||||
|
|
@ -75,6 +78,10 @@ QVariant IndexModel::getData(const QModelIndex &index) const
|
|||
v = getIndexDisplayString(*m_catalog, dat.indexrelid);
|
||||
break;
|
||||
|
||||
case AmCol:
|
||||
v = dat.getAm();
|
||||
break;
|
||||
|
||||
case ColumnsCol:
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,23 @@ public:
|
|||
enum e_Columns : int {
|
||||
TypeCol, /// primary/unique/normal
|
||||
NameCol, ///
|
||||
AmCol, ///< Access Method
|
||||
ColumnsCol, ///
|
||||
ConditionCol,
|
||||
colCount };
|
||||
|
||||
// oid
|
||||
// tablespace
|
||||
// operator class
|
||||
// unique
|
||||
// primary
|
||||
// clustered
|
||||
// valid
|
||||
// constraint
|
||||
// system index
|
||||
// fill factor
|
||||
// comment
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
void setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table);
|
||||
|
||||
|
|
|
|||
|
|
@ -542,18 +542,18 @@ void QueryTab::markError(const Pgsql::ErrorDetails &details)
|
|||
if (details.state == "42703") {
|
||||
std::size_t pos = details.messagePrimary.find('"');
|
||||
if (pos != std::string::npos) {
|
||||
int pos2 = details.messagePrimary.find('"', pos+1);
|
||||
std::size_t pos2 = details.messagePrimary.find('"', pos+1);
|
||||
if (pos2 != std::string::npos) {
|
||||
length = pos2 - pos;
|
||||
length = static_cast<int>(pos2 - pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (details.state == "42P01") {
|
||||
std::size_t pos = details.messagePrimary.find('"');
|
||||
if (pos != std::string::npos) {
|
||||
int pos2 = details.messagePrimary.find('"', pos+1);
|
||||
std::size_t pos2 = details.messagePrimary.find('"', pos+1);
|
||||
if (pos2 != std::string::npos) {
|
||||
length = pos2 - pos;
|
||||
length = static_cast<int>(pos2 - pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -623,11 +623,11 @@ std::vector<QAction*> QueryTab::getToolbarActions()
|
|||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
connect(action, &QAction::triggered, this, &QueryTab::save);
|
||||
actions.push_back(action);
|
||||
// Save as
|
||||
action = new QAction(QIcon(":/icons/script_go.png"), tr("Save SQL as"), this);
|
||||
//action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
connect(action, &QAction::triggered, this, &QueryTab::saveAs);
|
||||
actions.push_back(action);
|
||||
// Save as (menu only)
|
||||
// action = new QAction(QIcon(":/icons/script_save.png"), tr("Save SQL as"), this);
|
||||
// //action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
// connect(action, &QAction::triggered, this, &QueryTab::saveAs);
|
||||
// actions.push_back(action);
|
||||
// Save copy as
|
||||
// Copy
|
||||
// Copy as C-string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue