eliminate some gcc warnings, move register/unregister to be called only once

This commit is contained in:
Aleksandar Fabijanic
2007-05-18 18:37:11 +00:00
parent 0fdc7f42a7
commit 34697be9e4
7 changed files with 38 additions and 37 deletions

View File

@@ -71,15 +71,16 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
{
static bool beenHere = false;
ODBC::Connector::registerConnector();
if (_drivers.empty() || _dataSources.empty())
{
Utility::drivers(_drivers);
Utility::dataSources(_dataSources);
checkODBCSetup();
}
if (!_pSession && !_dbConnString.empty() && !beenHere)
{
ODBC::Connector::registerConnector();
try
{
_pSession = new Session(SessionFactory::instance().create(ODBC::Connector::KEY, _dbConnString));
@@ -91,7 +92,9 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
if (_pSession && _pSession->isConnected())
std::cout << "*** Connected to " << _dsn << '(' << _dbConnString << ')' << std::endl;
if (!_pExecutor) _pExecutor = new SQLExecutor("SQLServer SQL Executor", _pSession);
if (!_pExecutor)
_pExecutor = new SQLExecutor("SQLServer SQL Executor", _pSession);
}
else
if (!_pSession && !beenHere)
@@ -103,7 +106,6 @@ ODBCSQLServerTest::ODBCSQLServerTest(const std::string& name):
ODBCSQLServerTest::~ODBCSQLServerTest()
{
ODBC::Connector::unregisterConnector();
}