mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Improve foreign key editor when working on tables in non-main schemata
This improves commit 44eb2d4f99 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.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user