+ bool first_route = true;
+
+ std::map<std::string,bool> targets_dedup;
+ for (; db_it != databases.end(); db_it++)
+ {
+ std::map<std::string, VirtualDB::Map>::iterator map_it;
+ map_it = m_p->m_maps.find(mp::util::database_name_normalize(*db_it));
+ if (map_it == m_p->m_maps.end()) // database not found
+ {
+ error_code = YAZ_BIB1_DATABASE_DOES_NOT_EXIST;
+ addinfo = *db_it;
+ BackendPtr ptr;
+ return ptr;
+ }
+ std::list<std::string>::const_iterator t_it =
+ map_it->second.m_targets.begin();
+ for (; t_it != map_it->second.m_targets.end(); t_it++) {
+ if (!targets_dedup[*t_it])
+ {
+ targets_dedup[*t_it] = true;
+ b->m_targets.push_back(*t_it);
+ }
+ }
+
+ // see if we have a route conflict.
+ if (!first_route && b->m_route != map_it->second.m_route)
+ {
+ // we have a conflict..
+ error_code = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP;
+ BackendPtr ptr;
+ return ptr;
+ }
+ b->m_route = map_it->second.m_route;
+ first_route = false;
+ }