Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 315019d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ForeignKeyEditorDelegate.cpp
Expand Up @@ -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());
}
}
}
}
Expand Down

0 comments on commit 315019d

Please sign in to comment.