13 #include "CoralKernel/Context.h"
14 #include "GaudiKernel/MsgStream.h"
17 #include "RelationalAccess/IAuthenticationCredentials.h"
18 #include "RelationalAccess/IAuthenticationService.h"
19 #include "RelationalAccess/IConnectionService.h"
20 #include "RelationalAccess/ICursor.h"
21 #include "RelationalAccess/IQuery.h"
22 #include "RelationalAccess/IRelationalDomain.h"
23 #include "RelationalAccess/IRelationalService.h"
24 #include "RelationalAccess/ISchema.h"
25 #include "RelationalAccess/ISessionProxy.h"
26 #include "RelationalAccess/ITable.h"
27 #include "RelationalAccess/ITableDataEditor.h"
28 #include "RelationalAccess/ITransaction.h"
29 #include "RelationalAccess/SchemaException.h"
39 m_connection_string(ConnectionString),
40 m_working_schema(WorkingSchema),
44 m_transaction(false) {
45 coral::IHandle<coral::IConnectionService> lookSvcH =
m_context->query<coral::IConnectionService>();
46 if (!lookSvcH.isValid()) {
47 m_context->loadComponent(
"CORAL/Services/ConnectionService");
48 lookSvcH =
m_context->query<coral::IConnectionService>();
50 if (!lookSvcH.isValid()) {
return; }
51 m_context->loadComponent(
"CORAL/Services/XMLAuthenticationService");
52 m_context->loadComponent(
"CORAL/Services/RelationalService");
59 if (*
it) {
delete (*it); }
74 coral::IHandle<coral::IConnectionService> lookSvcH =
m_context->query<coral::IConnectionService>();
75 m_context->loadComponent(
"CORAL/Services/ConnectionService");
76 lookSvcH =
m_context->query<coral::IConnectionService>();
78 if (!lookSvcH.isValid()) {
79 throw std::runtime_error(
80 Form(
"File: %s, Line: %d\nCalibDbConnection::OpenConnection() - Could not locate the connection service!", __FILE__,
88 }
catch (coral::SchemaException&
e) {
90 log << MSG::WARNING <<
"Schema exception : " <<
e.what() <<
endmsg;
139 log << MSG::WARNING <<
"No Session open!" <<
endmsg;
143 coral::IQuery*
query = workingSchema.newQuery();
159 coral::IHandle<coral::IRelationalService> relationalService =
m_context->query<coral::IRelationalService>();
160 if (!relationalService.isValid()) {
161 throw std::runtime_error(
162 Form(
"File: %s, Line: %d\nCalibDbConnection::domain() - Could not locate the relational service!", __FILE__, __LINE__));
165 coral::IHandle<coral::IAuthenticationService> authenticationService =
m_context->query<coral::IAuthenticationService>();
166 if (!authenticationService.isValid()) {
167 throw std::runtime_error(
168 Form(
"File: %s, Line: %d\nCalibDbConnection::domain() - Could not locate the authentication service!", __FILE__, __LINE__));
171 const coral::IAuthenticationCredentials& credentials = authenticationService->credentials(connectionString);
172 m_username = credentials.valueForItem(
"user");
173 m_password = credentials.valueForItem(
"password");
176 return relationalService->domainForConnection(connectionString);