-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vincenzo Innocente
committed
Nov 10, 2009
1 parent
e96ba7f
commit fa1cb82
Showing
7 changed files
with
68 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,31 @@ | ||
#include "CondCore/DBCommon/interface/TechnologyProxyFactory.h" | ||
#include "CondCore/DBCommon/interface/TechnologyProxy.h" | ||
#include "FWCore/PluginManager/interface/PluginManager.h" | ||
#include "FWCore/PluginManager/interface/standard.h" | ||
#include "CondCore/DBCommon/interface/DBSession.h" | ||
#include "CondCore/DBCommon/interface/ConnectionHandler.h" | ||
#include "FWCore/Catalog/interface/SiteLocalConfig.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "CondCore/DBCommon/interface/Exception.h" | ||
#include "CondCore/DBCommon/interface/DbSession.h" | ||
#include <iostream> | ||
int main(){ | ||
edmplugin::PluginManager::Config config; | ||
edmplugin::PluginManager::configure(edmplugin::standard::config()); | ||
/* const char* path = getenv("LD_LIBRARY_PATH"); | ||
std::string spath(path? path: ""); | ||
std::string::size_type last=0; | ||
std::string::size_type i=0; | ||
std::vector<std::string> paths; | ||
while( (i=spath.find_first_of(':',last))!=std::string::npos) { | ||
paths.push_back(spath.substr(last,i-last)); | ||
last = i+1; | ||
std::cout <<paths.back()<<std::endl; | ||
} | ||
paths.push_back(spath.substr(last,std::string::npos)); | ||
config.searchPath(paths); | ||
edmplugin::PluginManager::configure(config); | ||
*/ | ||
|
||
std::cout<<"testing Connection Handler "<<std::endl; | ||
cond::DBSession* session=new cond::DBSession; | ||
static cond::ConnectionHandler& conHandler=cond::ConnectionHandler::Instance(); | ||
conHandler.registerConnection("sqlite_file:mydata.db",*session,0); | ||
conHandler.registerConnection("sqlite_fip:CondCore/SQLiteData/data/mydata.db",*session,0); | ||
session->open(); | ||
conHandler.connect(session); | ||
conHandler.disconnectAll(); | ||
std::auto_ptr<cond::TechnologyProxy> ptr(cond::TechnologyProxyFactory::get()->create("sqlite","sqlite_file:pippo.db")); | ||
std::cout<<ptr->getRealConnectString()<<std::endl; | ||
static cond::ConnectionHandler& conHandler2=cond::ConnectionHandler::Instance(); | ||
conHandler.registerConnection("frontier://cmsfrontier.cern.ch:8000/FrontierDev/CMS_COND_PRESH",*session,0); | ||
std::auto_ptr<cond::TechnologyProxy> ptr2(cond::TechnologyProxyFactory::get()->create("frontier","frontier://cmsfrontier.cern.ch:8000/FrontierDev/CMS_COND_PRESH")); | ||
std::cout<<ptr2->getRealConnectString()<<std::endl; | ||
delete session; | ||
cond::DbConnection conn; | ||
conn.configure( cond::CmsDefaults ); | ||
cond::DbSession session = conn.createSession(); | ||
const char * connects[] = { | ||
"sqlite_file:mydata.db", | ||
"sqlite_fip:CondCore/SQLiteData/data/mydata.db", | ||
"frontier:FrontierDev/CMS_COND_PRESH", | ||
"frontier://cmsfrontier.cern.ch:8000/FrontierDev/CMS_COND_PRESH" | ||
}; | ||
for (int i=0; int<4; ++i) { | ||
try { | ||
session.open(connects[i]); | ||
std::cout << connects[i] << " " << session.connectionString() << std::endl; | ||
} catch ( const cond::Exception & er) { | ||
std::cout << "error " << er.what(); | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|