Rework of catalog objects. Several of them are now inheriting from common
base classes that implement common functionality.
This commit is contained in:
parent
840af1e0a9
commit
73c4cf4790
45 changed files with 340 additions and 265 deletions
|
|
@ -35,7 +35,7 @@ void ColumnTableModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, con
|
|||
m_table = table;
|
||||
m_catalog = cat;
|
||||
if (m_table) {
|
||||
m_columns = cat->attributes()->getColumnsForRelation(table->oid);
|
||||
m_columns = cat->attributes()->getColumnsForRelation(table->oid());
|
||||
// hide system and dropped columns
|
||||
auto column_filter_pred = table->hasoids ? ColumnFilterWithOidsPred : ColumnFilterWithoutOidsPred;
|
||||
auto si = std::remove_if(m_columns.begin(), m_columns.end(), column_filter_pred);
|
||||
|
|
@ -51,12 +51,12 @@ void ColumnTableModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, con
|
|||
|
||||
|
||||
if (m_table) {
|
||||
m_indexes = m_catalog->indexes()->getIndexesForTable(table->oid);
|
||||
m_indexes = m_catalog->indexes()->getIndexesForTable(table->oid());
|
||||
std::sort(m_indexes.begin(), m_indexes.end(),
|
||||
[] (const auto &l, const auto &r) -> bool
|
||||
{
|
||||
return l.isprimary > r.isprimary
|
||||
|| (l.isprimary == r.isprimary && l.indexrelid < r.indexrelid);
|
||||
|| (l.isprimary == r.isprimary && l.oid() < r.oid());
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
@ -109,7 +109,7 @@ QVariant ColumnTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
if (section >= colCount) {
|
||||
const auto &tbl_idx = m_indexes[section - colCount];
|
||||
//auto idx_cls = m_catalog->classes()->getByKey(tbl_idx.indexrelid);
|
||||
auto idx_class_name = getClassDisplayString(*m_catalog, tbl_idx.indexrelid);
|
||||
auto idx_class_name = tbl_idx.objectName(); // getClassDisplayString(*m_catalog, tbl_idx.indexrelid);
|
||||
QString s;
|
||||
if (tbl_idx.isprimary)
|
||||
s = tr("Primary key");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue