From: Adam Dickmeiss Date: Tue, 15 Jun 2010 10:55:42 +0000 (+0200) Subject: virt_db refactor code WRT target select X-Git-Tag: v1.1.5~4 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=4d1c3148cb6a658fb66e99a1385cc0067b6b2938;p=metaproxy-moved-to-github.git virt_db refactor code WRT target select --- diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index e8b30f5..10d3f3d 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -267,7 +267,6 @@ void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req) for (i = 0; inum_databaseNames; i++) databases.push_back(req->databaseNames[i]); - BackendPtr b; // null for now Sets_it sets_it = m_sets.find(req->resultSetName); if (sets_it != m_sets.end()) { @@ -286,39 +285,22 @@ void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req) return; } sets_it->second.m_backend->m_number_of_sets--; - - // pick up any existing backend with a database match - std::list::const_iterator map_it; - map_it = m_backend_list.begin(); - for (; map_it != m_backend_list.end(); map_it++) - { - BackendPtr tmp = *map_it; - if (tmp->m_frontend_databases == databases && - (tmp->m_named_result_sets || - tmp->m_number_of_sets == 0)) - break; - } - if (map_it != m_backend_list.end()) - b = *map_it; } - else + // pick up any existing database with named result sets .. + // or one which has no result sets.. yet. + BackendPtr b; // null for now + std::list::const_iterator map_it; + map_it = m_backend_list.begin(); + for (; map_it != m_backend_list.end(); map_it++) { - // new result set. - - // pick up any existing database with named result sets .. - // or one which has no result sets.. yet. - std::list::const_iterator map_it; - map_it = m_backend_list.begin(); - for (; map_it != m_backend_list.end(); map_it++) + BackendPtr tmp = *map_it; + if (tmp->m_frontend_databases == databases && + (tmp->m_named_result_sets || + tmp->m_number_of_sets == 0)) { - BackendPtr tmp = *map_it; - if (tmp->m_frontend_databases == databases && - (tmp->m_named_result_sets || - tmp->m_number_of_sets == 0)) - break; - } - if (map_it != m_backend_list.end()) b = *map_it; + break; + } } if (!b) // no backend yet. Must create a new one {