diff --git a/src/DbStructureModel.cpp b/src/DbStructureModel.cpp index e9623548..040eed3a 100644 --- a/src/DbStructureModel.cpp +++ b/src/DbStructureModel.cpp @@ -303,27 +303,27 @@ void DbStructureModel::buildTree(QTreeWidgetItem* parent, const QString& schema) // Get all database objects and sort them by their name QMultiMap dbobjs; - for(auto it=objmap.constBegin(); it != objmap.constEnd(); ++it) - dbobjs.insert((*it)->name(), (*it)); + for(auto it : objmap) + dbobjs.insert(it->name(), it); // Add the database objects to the tree nodes - for(auto it=dbobjs.constBegin();it!=dbobjs.constEnd();++it) + for(auto it : dbobjs) { // Object node - QTreeWidgetItem* item = addNode(typeToParentItem.value(sqlb::Object::typeToString((*it)->type())), *it, schema); + QTreeWidgetItem* item = addNode(typeToParentItem.value(sqlb::Object::typeToString(it->type())), it, schema); // If it is a table or view add the field nodes, add an extra node for the browsable section - if((*it)->type() == sqlb::Object::Types::Table || (*it)->type() == sqlb::Object::Types::View) - addNode(browsablesRootItem, *it, schema); + if(it->type() == sqlb::Object::Types::Table || it->type() == sqlb::Object::Types::View) + addNode(browsablesRootItem, it, schema); // Add field nodes if there are any - sqlb::FieldInfoList fieldList = (*it)->fieldInformation(); + sqlb::FieldInfoList fieldList = it->fieldInformation(); if(!fieldList.empty()) { QStringList pk_columns; - if((*it)->type() == sqlb::Object::Types::Table) + if(it->type() == sqlb::Object::Types::Table) { - sqlb::FieldVector pk = (*it).dynamicCast()->primaryKey(); + sqlb::FieldVector pk = it.dynamicCast()->primaryKey(); for(const sqlb::FieldPtr& pk_col : pk) pk_columns.push_back(pk_col->name()); diff --git a/src/EditIndexDialog.cpp b/src/EditIndexDialog.cpp index 3b7b0e98..8c8ed760 100644 --- a/src/EditIndexDialog.cpp +++ b/src/EditIndexDialog.cpp @@ -33,10 +33,10 @@ EditIndexDialog::EditIndexDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& } } else { // If this is an existing index, only offer tables of the current database schema QList tables = pdb.schemata[curIndex.schema()].values("table"); - for(auto it=tables.constBegin();it!=tables.constEnd();++it) + for(auto it : tables) { // Only show the schema name for non-main schemata - sqlb::ObjectIdentifier obj(curIndex.schema(), (*it)->name()); + sqlb::ObjectIdentifier obj(curIndex.schema(), it->name()); dbobjs.insert(obj.toDisplayString(), obj); } } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 759f8a06..3df89026 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -427,11 +427,11 @@ void MainWindow::populateStructure(const QString& old_table) for(auto it=db.schemata.constBegin();it!=db.schemata.constEnd();++it) { objectMap tab = db.getBrowsableObjects(it.key()); - for(auto it=tab.constBegin();it!=tab.constEnd();++it) + for(auto it : tab) { - QString objectname = (*it)->name(); + QString objectname = it->name(); - sqlb::FieldInfoList fi = (*it)->fieldInformation(); + sqlb::FieldInfoList fi = it->fieldInformation(); for(const sqlb::FieldInfo& f : fi) tablesToColumnsMap[objectname].append(f.name); } diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp index 23b146ac..ada6b4b6 100644 --- a/src/sqlitedb.cpp +++ b/src/sqlitedb.cpp @@ -1205,16 +1205,16 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb // Save all indices, triggers and views associated with this table because SQLite deletes them when we drop the table in the next step QStringList otherObjectsSql; - for(auto it=schemata[tablename.schema()].constBegin();it!=schemata[tablename.schema()].constEnd();++it) + for(auto it : schemata[tablename.schema()]) { // If this object references the table and it's not the table itself save it's SQL string - if((*it)->baseTable() == tablename.name() && (*it)->type() != sqlb::Object::Types::Table) + if(it->baseTable() == tablename.name() && it->type() != sqlb::Object::Types::Table) { // If this is an index, update the fields first. This highly increases the chance that the SQL statement won't throw an // error later on when we try to recreate it. - if((*it)->type() == sqlb::Object::Types::Index) + if(it->type() == sqlb::Object::Types::Index) { - sqlb::IndexPtr idx = (*it).dynamicCast(); + sqlb::IndexPtr idx = it.dynamicCast(); // Are we updating a field name or are we removing a field entirely? if(to) @@ -1238,7 +1238,7 @@ bool DBBrowserDB::alterTable(const sqlb::ObjectIdentifier& tablename, const sqlb } else { // If it's a view or a trigger we don't have any chance to corrections yet. Just store the statement as is and // hope for the best. - otherObjectsSql << (*it)->originalSql().trimmed() + ";"; + otherObjectsSql << it->originalSql().trimmed() + ";"; } } } @@ -1352,10 +1352,10 @@ objectMap DBBrowserDB::getBrowsableObjects(const QString& schema) const const sqlb::ObjectPtr DBBrowserDB::getObjectByName(const sqlb::ObjectIdentifier& name) const { - for(auto it=schemata[name.schema()].constBegin();it!=schemata[name.schema()].constEnd();++it) + for(auto it : schemata[name.schema()]) { - if((*it)->name() == name.name()) - return *it; + if(it->name() == name.name()) + return it; } return sqlb::ObjectPtr(nullptr); }