summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/DatabaseCache.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-10-07 18:18:37 +0200
committerBenoit Foucher <benoit@zeroc.com>2009-10-07 18:18:37 +0200
commit5fc2dc27228263e4c56ba3a49852ab3f8c724299 (patch)
treea1340491094705a1e604a3df22ec4dad0c8d1a8e /cpp/src/IceGrid/DatabaseCache.cpp
parentBug 4251 - add IceUtil::Time double initializers (diff)
downloadice-5fc2dc27228263e4c56ba3a49852ab3f8c724299.tar.bz2
ice-5fc2dc27228263e4c56ba3a49852ab3f8c724299.tar.xz
ice-5fc2dc27228263e4c56ba3a49852ab3f8c724299.zip
- Bug 4286: added support for IceStorm/IceGrid database plugins
- Fixed IceGrid database code to first save to the database and then do state changes.
Diffstat (limited to 'cpp/src/IceGrid/DatabaseCache.cpp')
-rw-r--r--cpp/src/IceGrid/DatabaseCache.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/cpp/src/IceGrid/DatabaseCache.cpp b/cpp/src/IceGrid/DatabaseCache.cpp
deleted file mode 100644
index 12f544ded7a..00000000000
--- a/cpp/src/IceGrid/DatabaseCache.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#include <IceGrid/DatabaseCache.h>
-#ifdef QTSQL
-# include <Ice/Communicator.h>
-#endif
-
-using namespace IceGrid;
-using namespace std;
-
-#ifdef QTSQL
-
-DatabaseCache::DatabaseCache(const Ice::CommunicatorPtr& communicator,
- const string&,
- const string& instanceName,
- const string& replicaName) :
- IceSQL::DatabaseCache(communicator,
- communicator->getProperties()->getProperty("IceGrid.SQL.DatabaseType"),
- communicator->getProperties()->getProperty("IceGrid.SQL.DatabaseName"),
- communicator->getProperties()->getProperty("IceGrid.SQL.HostName"),
- communicator->getProperties()->getProperty("IceGrid.SQL.UserName"),
- communicator->getProperties()->getProperty("IceGrid.SQL.Password"),
- true)
-{
- string tablePrefix = instanceName + "_" + replicaName;
- replace(tablePrefix.begin(), tablePrefix.end(), '.', '_');
- replace(tablePrefix.begin(), tablePrefix.end(), '-', '_');
- replace(tablePrefix.begin(), tablePrefix.end(), ' ', '_');
- replace(tablePrefix.begin(), tablePrefix.end(), ';', '_');
-
- IceSQL::DatabaseConnectionPtr connection = getConnection();
- IceSQL::TransactionHolder txn(connection);
-
- const_cast<SqlStringApplicationInfoDictPtr&>(applications) =
- new SqlStringApplicationInfoDict(connection, tablePrefix + "_Applications", _communicator);
- const_cast<SqlStringAdapterInfoDictPtr&>(adapters) =
- new SqlStringAdapterInfoDict(connection, tablePrefix + "_Adapters", _communicator);
- const_cast<SqlIdentityObjectInfoDictPtr&>(objects) =
- new SqlIdentityObjectInfoDict(connection, tablePrefix + "_Objects", _communicator);
- const_cast<SqlIdentityObjectInfoDictPtr&>(internalObjects) =
- new SqlIdentityObjectInfoDict(connection, tablePrefix + "_InternalObjects", _communicator);
-
- txn.commit();
-}
-
-#else
-
-DatabaseCache::DatabaseCache(const Ice::CommunicatorPtr& communicator,
- const string& envName,
- const string&,
- const string&) :
- _communicator(communicator),
- _envName(envName),
- _connection(Freeze::createConnection(communicator, envName))
-{
-}
-
-DatabaseConnectionPtr
-DatabaseCache::getConnection()
-{
- return _connection;
-}
-
-DatabaseConnectionPtr
-DatabaseCache::newConnection()
-{
- return Freeze::createConnection(_communicator, _envName);
-}
-
-#endif