summaryrefslogtreecommitdiff
path: root/project2/sql/rdbmsDataSource.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-12-16 20:05:52 +0000
committerrandomdan <randomdan@localhost>2011-12-16 20:05:52 +0000
commit6b69aea029b3c2978995c3fad017194a1a4927d8 (patch)
tree09e86723b406d9d5e73e27390069670507d96b88 /project2/sql/rdbmsDataSource.cpp
parentImprovements to the handling of command line arguments (diff)
downloadproject2-6b69aea029b3c2978995c3fad017194a1a4927d8.tar.bz2
project2-6b69aea029b3c2978995c3fad017194a1a4927d8.tar.xz
project2-6b69aea029b3c2978995c3fad017194a1a4927d8.zip
Improved connection failure logging and instantiation
Diffstat (limited to 'project2/sql/rdbmsDataSource.cpp')
-rw-r--r--project2/sql/rdbmsDataSource.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp
index 4c6ae17..305f1d7 100644
--- a/project2/sql/rdbmsDataSource.cpp
+++ b/project2/sql/rdbmsDataSource.cpp
@@ -159,6 +159,8 @@ RdbmsDataSource::connectTo(const ConnectionInfo & dsn)
return db;
}
catch (const DB::ConnectionError & e) {
+ Logger()->messagef(LOG_NOTICE, "%s: connection error message to '%s' -> %s",
+ __PRETTY_FUNCTION__, dsn.dsn.c_str(), e.what());
failedhosts.insert(FailedHosts::value_type(dsn, e));
throw;
}
@@ -190,10 +192,10 @@ RdbmsDataSource::RdbmsConnection::isExpired() const
return (time(NULL) > lastUsedTime + keepAliveTime);
}
-RdbmsDataSource::ConnectionInfo::ConnectionInfo(ScriptNodePtr node)
+RdbmsDataSource::ConnectionInfo::ConnectionInfo(ScriptNodePtr node) :
+ dsn(node->value("dsn").as<std::string>()),
+ typeId(LoaderBase::getLoader<ConnectionLoader, UnknownConnectionProvider>(node->value("provider")))
{
- typeId = LoaderBase::getLoader<ConnectionLoader, UnknownConnectionProvider>(node->value("provider"));
- dsn = node->value("dsn").as<std::string>();
}
DB::Connection *