mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-17 17:29:37 -06:00
Fix handling of databases with a view and a trigger with the same name
This fixes editing and browsing views which have the same name as a trigger in the same database. See issue #2091.
This commit is contained in:
@@ -341,8 +341,9 @@ void DbStructureModel::buildTree(QTreeWidgetItem* parent, const std::string& sch
|
||||
itemTriggers->setText(ColumnName, tr("Triggers (%1)").arg(calc_number_of_objects_by_type(objmap, "trigger")));
|
||||
typeToParentItem.insert({"trigger", itemTriggers});
|
||||
|
||||
// Get all database objects and sort them by their name
|
||||
std::map<std::string, sqlb::ObjectPtr> dbobjs;
|
||||
// Get all database objects and sort them by their name.
|
||||
// This needs to be a multimap because SQLite allows views and triggers with the same name which means that names can appear twice.
|
||||
std::multimap<std::string, sqlb::ObjectPtr> dbobjs;
|
||||
for(const auto& it : objmap)
|
||||
dbobjs.insert({it.second->name(), it.second});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user