#include <ReadBase.h>
Public Member Functions | |
ReadBase () | |
virtual void | run ()=0 |
void | setVerbosityLevel (coral::MsgLevel level) |
virtual | ~ReadBase () |
Protected Member Functions | |
coral::ISessionProxy * | connect (const std::string &connectionString, const std::string &user, const std::string &password) |
Private Attributes | |
coral::ConnectionService | m_connectionService |
Definition at line 22 of file ReadBase.h.
ReadBase::ReadBase | ( | ) |
Definition at line 12 of file ReadBase.cc.
: m_connectionService() { //coral::Context& context = coral::Context::instance(); //context.loadComponent( "CORAL/RelationalPlugins/oracle" ); //coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>( "CORAL/RelationalPlugins/oracle" ); //if ( ! domain.isValid() ) // throw std::runtime_error( "Could not load the OracleAccess plugin" ); }
ReadBase::~ReadBase | ( | ) | [virtual] |
Definition at line 21 of file ReadBase.cc.
{
//if ( m_connection ) delete m_connection;
}
coral::ISessionProxy * ReadBase::connect | ( | const std::string & | connectionString, |
const std::string & | user, | ||
const std::string & | password | ||
) | [protected] |
Definition at line 26 of file ReadBase.cc.
References m_connectionService.
{ //coral::Context& ctx = coral::Context::instance(); //coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle"); //if ( ! iHandle.isValid() ) // throw std::runtime_error( "Could not load the OracleAccess plugin" ); // //std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString ); //if ( ! m_connection ) // m_connection = iHandle->newConnection( connectionAndSchema.first ); //if ( ! m_connection->isConnected() ) // m_connection->connect(); //coral::ISession* session = m_connection->newSession( connectionAndSchema.second ); //if ( session ) // session->startUserSession( user, pass ); std::string userEnv("CORAL_AUTH_USER="+user); std::string passEnv("CORAL_AUTH_PASSWORD="+pass); ::putenv( const_cast<char*>(userEnv.c_str())); ::putenv( const_cast<char*>(passEnv.c_str())); m_connectionService.configuration().setAuthenticationService("CORAL/Services/EnvironmentAuthenticationService"); return m_connectionService.connect( connectionString ); }
virtual void ReadBase::run | ( | ) | [pure virtual] |
void ReadBase::setVerbosityLevel | ( | coral::MsgLevel | level | ) |
Definition at line 53 of file ReadBase.cc.
{ coral::MessageStream::setMsgVerbosity(level); }
coral::ConnectionService ReadBase::m_connectionService [private] |
Definition at line 34 of file ReadBase.h.
Referenced by connect().