Permalink
Browse files

Improve foreign key editor when working on tables in non-main schemata

This improves commit 44eb2d4 by
allowing to choose tables from other schemata than "main" in the foreign
key editor in the Edit Table dialog. This still isn't perfect as only
tables from the schema of the current table should be shown but with
some care it should work for all use cases.
  • Loading branch information...
MKleusberg committed Sep 4, 2017
1 parent fbaf78e commit 315019dd9ce028331caa1d6f8863829a8ce25e9d
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/ForeignKeyEditorDelegate.cpp
@@ -81,11 +81,15 @@ ForeignKeyEditorDelegate::ForeignKeyEditorDelegate(const DBBrowserDB& db, sqlb::
, m_db(db)
, m_table(table)
{
const auto objects = m_db.getBrowsableObjects("main");
for (auto& obj : objects) {
if (obj->type() == sqlb::Object::Types::Table) {
QString tableName = obj->name();
m_tablesIds.insert(tableName, obj.dynamicCast<sqlb::Table>()->fieldNames());
for(auto it=m_db.schemata.constBegin();it!=m_db.schemata.constEnd();++it)
{
for(auto jt=it->constBegin();jt!=it->constEnd();++jt)
{
if((*jt)->type() == sqlb::Object::Types::Table)
{
QString tableName = (*jt)->name();
m_tablesIds.insert(tableName, (*jt).dynamicCast<sqlb::Table>()->fieldNames());
}
}
}
}

0 comments on commit 315019d

Please sign in to comment.