From 4efd293d8de0834eadc018304986a6e1a3395c79 Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 18 Feb 2011 11:01:26 +0000 Subject: Don't require the (probably repeated) inclusion of datasource definitions, have CommonObjects load them once on demand Fix rdbmsDataSource closing transactions it didn't open Change XML to match the above changes --- project2/commonObjects.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'project2/commonObjects.cpp') diff --git a/project2/commonObjects.cpp b/project2/commonObjects.cpp index 31f81a9..2ca4846 100644 --- a/project2/commonObjects.cpp +++ b/project2/commonObjects.cpp @@ -1,4 +1,6 @@ #include "commonObjects.h" +#include +#include RowSetPtr CommonObjects::getSource(const std::string & name) const @@ -10,4 +12,20 @@ CommonObjects::getSource(const std::string & name) const throw CommonObjects::DataSourceNotFound(name); } +DataSources::index::type::const_iterator +CommonObjects::loadDataSource(const std::string & name) const +{ + xmlpp::DomParser xml("datasources/" + name + ".xml"); + while (xmlXIncludeProcessFlags(xml.get_document()->cobj(), XML_PARSE_NOXINCNODE) > 0); + + LoaderBase loader("http://project2.randomdan.homeip.net", true); + loader.supportedStorers.insert(Storer::into(&datasources)); + loader.collectAll(xml.get_document()->get_root_node(), false); + + DataSources::index::type::const_iterator i = datasources.get().find(name); + if (i == datasources.get().end()) { + throw DataSourceNotFound(name); + } + return i; +} -- cgit v1.2.3