18 const std::string&
fid,
19 const std::string&
pfn,
20 Io::IoFlag accessmode ) :
26 throw std::runtime_error(
"Could not connect to the database (APR: \" DatabaseHandler::DatabaseHandler \" from \" PersistencySvc \")" );
31 Io::IoFlag mode = Io::INVALID;
51 std::vector< std::string > result;
52 std::vector<const Token*> containerTokens;
54 if( !dbH.
containers(containerTokens,
false).isSuccess() ) {
57 for ( std::vector<const Token*>::const_iterator iToken = containerTokens.begin();
58 iToken != containerTokens.end(); ++iToken ) {
67 std::vector< std::string > allContainers = this->
containers();
68 for ( std::vector< std::string >::const_iterator iName = allContainers.begin();
69 iName != allContainers.end(); ++iName ) {
70 if ( *iName == containerName ) {
97 Token* token =
nullptr;
103 token ).isSuccess() ) {
110 void* result(
object );
119 const std::type_info& typeInfo,
120 const std::string& option ) {
121 DbOption databaseOption( attributeName, option );
123 if( !dbH.
getOption(databaseOption).isSuccess() )
return false;
124 return databaseOption.
i_getValue(typeInfo, data).isSuccess();
129 const std::type_info& typeInfo,
130 const std::string& option ) {
131 DbOption databaseOption( attributeName, option );
132 if( !databaseOption.
i_setValue( typeInfo,
const_cast<void*
>( data ) ).isSuccess() )
return false;
134 return dbH.
setOption(databaseOption).isSuccess();
This file contains the class definition for the Token class (migrated from POOL).
bool commitTransaction()
Commits the transaction.
IStorageSvc & m_storageSvc
IStorageSvc reference.
~DatabaseHandler()
Destructor. Disconnects from the database.
Token * writeObject(const std::string &containerName, long minorTechnology, const void *object, const RootType &type)
Writes an object and returns a token.
Container * container(const std::string &containerName)
Returns a container handle.
void * readObject(const Token &token, void *object=0)
Reads an object given a token.
FileDescriptor m_fileDescriptor
File descriptor for this database.
bool setAttribute(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option)
Sets an attrtibute.
long technology() const
Returns the technology identifier.
std::vector< std::string > containers()
Gives the list of containers.
long m_technology
Technology identifier.
bool disconnectTransaction()
Disconnects the transaction.
Io::IoFlag accessMode() const
Returns the access mode.
DatabaseHandler(IStorageSvc &storageSvc, long technology, const std::string &fid, const std::string &pfn, Io::IoFlag accessmode)
Constructor. Connects to the database.
Io::IoFlag m_accessMode
Current access mode.
bool attribute(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option)
Returns an attribute.
bool commitAndHoldTransaction()
Commits and holds the transaction.
const std::string & fid() const
Returns the file identifier.
const std::string & pfn() const
Returns the physical file name.
Description: Handle managing a DbDatabaseObj, a generic Database object.
StatusCode containers(std::vector< const Token * > &conts, bool intern=false)
Allow access to all known containers.
StatusCode setOption(const DbOption &refOpt)
Set options.
StatusCode getOption(DbOption &refOpt)
Access options.
Description: Definition an option to be supplied to database objects.
StatusCode i_getValue(const std::type_info &typ, void *value) const
Read the option value.
StatusCode i_setValue(const std::type_info &typ, const void *value)
Set the option value.
The IStorageSvc interface is able to handle user request for.
This class provides a token that identifies in a unique way objects on the persistent storage.