diff options
author | randomdan <randomdan@localhost> | 2011-12-14 21:42:31 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-12-14 21:42:31 +0000 |
commit | bc8dbfb89265694cba39a5553e3ee15407587c99 (patch) | |
tree | 4b0a3414ba881a3118630c41ca24129d23f996df /project2/sql/rdbmsDataSource.cpp | |
parent | Don't write JSON numbers in scientific notation, use native C++ boolalpha for... (diff) | |
download | project2-bc8dbfb89265694cba39a5553e3ee15407587c99.tar.bz2 project2-bc8dbfb89265694cba39a5553e3ee15407587c99.tar.xz project2-bc8dbfb89265694cba39a5553e3ee15407587c99.zip |
Pluggable script engines
XML script parser moved to XML module
Script parsing object multiple instantiation bug fix
Scripts changed to match new standardized format and layout
Diffstat (limited to 'project2/sql/rdbmsDataSource.cpp')
-rw-r--r-- | project2/sql/rdbmsDataSource.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp index 20ccaec..4c6ae17 100644 --- a/project2/sql/rdbmsDataSource.cpp +++ b/project2/sql/rdbmsDataSource.cpp @@ -1,7 +1,6 @@ #include <pch.hpp> #include "rdbmsDataSource.h" #include "connectionLoader.h" -#include <libxml++/nodes/textnode.h> #include <sys/utsname.h> #include "logger.h" #include <errno.h> @@ -40,16 +39,13 @@ RdbmsDataSource::DBHosts RdbmsDataSource::dbhosts; RdbmsDataSource::FailedHosts RdbmsDataSource::failedhosts; RdbmsDataSource::DSNSet RdbmsDataSource::changedDSNs; -RdbmsDataSource::RdbmsDataSource(const xmlpp::Element * p) : +RdbmsDataSource::RdbmsDataSource(ScriptNodePtr p) : DataSource(p), - masterDsn(dynamic_cast<const xmlpp::Element *>(p->find("masterdsn").front())), - preferLocal(p->get_attribute_value("preferlocal") != "false") + masterDsn(p->child("masterdsn")), + preferLocal(p->value("preferlocal", true)) { - BOOST_FOREACH(const xmlpp::Node * node, p->find("readonly/dsn")) { - const xmlpp::Element * elem = dynamic_cast<const xmlpp::Element *>(node); - if (elem) { - roDSNs.insert(ReadonlyDSNs::value_type(elem->get_attribute_value("host"), elem)); - } + BOOST_FOREACH(ScriptNodePtr node, p->childrenIn("readonly")) { + roDSNs.insert(ReadonlyDSNs::value_type(node->value("host"), node)); } } @@ -194,12 +190,10 @@ RdbmsDataSource::RdbmsConnection::isExpired() const return (time(NULL) > lastUsedTime + keepAliveTime); } -RdbmsDataSource::ConnectionInfo::ConnectionInfo(const xmlpp::Element * n) +RdbmsDataSource::ConnectionInfo::ConnectionInfo(ScriptNodePtr node) { - BOOST_FOREACH(const xmlpp::Node * node, n->get_children()) { - typeId = LoaderBase::getLoader<ConnectionLoader, UnknownConnectionProvider>(node->get_name()); - dsn = dynamic_cast<const xmlpp::Element *>(node)->get_child_text()->get_content(); - } + typeId = LoaderBase::getLoader<ConnectionLoader, UnknownConnectionProvider>(node->value("provider")); + dsn = node->value("dsn").as<std::string>(); } DB::Connection * |