diff --git a/Database/APR/RelationalCollection/CMakeLists.txt b/Database/APR/RelationalCollection/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..956ca4cf3f15217238930887918b7f5be4de0487 --- /dev/null +++ b/Database/APR/RelationalCollection/CMakeLists.txt @@ -0,0 +1,27 @@ +################################################################################ +# Package: RelationalCollection +################################################################################ + +# Declare the package name: +atlas_subdir( RelationalCollection ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PRIVATE + Database/APR/CollectionBase + Database/APR/POOLCore + Database/PersistentDataModel + GaudiKernel + TestPolicy ) + +# External dependencies: +find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) + +# Component(s) in the package: +atlas_add_library( RelationalCollection + src/*.cpp + NO_PUBLIC_HEADERS + PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} CollectionBase POOLCore PersistentDataModel GaudiKernel ) + +# Component list generation: +atlas_generate_componentslist( RelationalCollection ) diff --git a/Database/APR/RelationalCollection/src/RelationalCollection.cpp b/Database/APR/RelationalCollection/src/RelationalCollection.cpp index 201ac157900fad4c507c2c472a81e11e22296758..d5a59cab5eff772170919eb3b190a6b7afb35743 100644 --- a/Database/APR/RelationalCollection/src/RelationalCollection.cpp +++ b/Database/APR/RelationalCollection/src/RelationalCollection.cpp @@ -168,7 +168,7 @@ pool::RelationalCollection::RelationalCollection::open() if( isOpen() ) return; // Get connection service. - auto_ptr<coral::ConnectionService> connectionService( new coral::ConnectionService() ); + unique_ptr<coral::ConnectionService> connectionService( new coral::ConnectionService() ); coral::MessageStream log( "pool::RelationalCollection::open" ); // Retrieve a connection handle. bool readOnly = ( m_mode == pool::ICollection::READ ); @@ -891,7 +891,7 @@ initialize() const string init_procedure = "POOL_COLLECTION_INIT"; bool procedureExists( false ); try { - std::auto_ptr<coral::IQuery> query( m_session->schema("SYS").newQuery() ); + std::unique_ptr<coral::IQuery> query( m_session->schema("SYS").newQuery() ); coral::AttributeList output; output.extend( "count(*)", "int"); query->addToOutputList("count(*)"); @@ -1380,7 +1380,7 @@ retrieveColumnDescriptions( const std::string& fragmentName, // Retrieve column names and types for this fragment and insert into collection description object. coral::ITable& descriptionsTable = nominalSchema.tableHandle( RelationalCollectionNames::nameOfCollectionDescriptionsTable() ); - std::auto_ptr<coral::IQuery> descQuery( descriptionsTable.newQuery() ); + std::unique_ptr<coral::IQuery> descQuery( descriptionsTable.newQuery() ); descQuery->addToOutputList( RelationalCollectionNames::collectionVariableNameVariableInCollectionDescriptionsTable() ); descQuery->addToOutputList( RelationalCollectionNames::collectionVariableTypeVariableInCollectionDescriptionsTable() ); descQuery->addToOutputList( RelationalCollectionNames::collectionVariableMaxSizeVariableInCollectionDescriptionsTable() ); @@ -1484,7 +1484,7 @@ pool::RelationalCollection::RelationalCollection:: createLinkIdToTokenKeyMaps( const std::string& fragmentName ) { // Query the links table. - auto_ptr<coral::IQuery> query( m_session->nominalSchema().newQuery() ); + unique_ptr<coral::IQuery> query( m_session->nominalSchema().newQuery() ); query->addToTableList( m_linksTableNameForCollectionFragmentName[fragmentName] ); // Select all columns from links table and order by link ID. @@ -2221,7 +2221,7 @@ pool::RelationalCollection::RelationalCollection:: retrieveFragmentTableNames( const std::string& fragmentName ) { // Retrieve data and links table names for this collection fragment and insert in private maps. - std::auto_ptr<coral::IQuery> query( + std::unique_ptr<coral::IQuery> query( m_session->nominalSchema().tableHandle( RelationalCollectionNames::nameOfCollectionHeadersTable() ).newQuery() ); query->addToOutputList( RelationalCollectionNames::dataTableNameVariableInCollectionHeadersTable() ); diff --git a/Database/APR/RelationalCollection/src/RelationalCollection.h b/Database/APR/RelationalCollection/src/RelationalCollection.h index dc7b72b274295531cd3a862607b6dbcb1f517849..6bd0fe00b1df22e0abbf1d8376e1acffb97f14dc 100755 --- a/Database/APR/RelationalCollection/src/RelationalCollection.h +++ b/Database/APR/RelationalCollection/src/RelationalCollection.h @@ -15,6 +15,7 @@ #ifdef HAVE_GAUDI_PLUGINSVC #include "Gaudi/PluginService.h" #endif +#include "GAUDI_VERSION.h" #include <map> @@ -50,7 +51,11 @@ namespace pool { { public: #ifdef HAVE_GAUDI_PLUGINSVC -typedef Gaudi::PluginService::Factory3<ICollection*, const ICollectionDescription*, ICollection::OpenMode, ISession*> Factory; + #if GAUDI_VERSION > CALC_GAUDI_VERSION(25, 3) + typedef Gaudi::PluginService::Factory<ICollection*, const ICollectionDescription*, ICollection::OpenMode, ISession*> Factory; + #else + typedef Gaudi::PluginService::Factory3<ICollection*, const ICollectionDescription*, ICollection::OpenMode, ISession*> Factory; + #endif #endif /** diff --git a/Database/APR/RelationalCollection/src/RelationalCollectionMetadata.cpp b/Database/APR/RelationalCollection/src/RelationalCollectionMetadata.cpp index adf3556b2e09be6eb59447a9b7ff23fccaa4e0c3..a2bc0ef57e347df20eacd2987475474c30a12738 100644 --- a/Database/APR/RelationalCollection/src/RelationalCollectionMetadata.cpp +++ b/Database/APR/RelationalCollection/src/RelationalCollectionMetadata.cpp @@ -108,7 +108,7 @@ namespace pool { { if( !m_metadataTable ) return 0; - std::auto_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); + std::unique_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); query->setCondition( RelationalCollectionBindVariables::whereClauseForMetadata(), m_whereDataForMetadata ); query->limitReturnedRows( 1, 0 ); query->addToOutputList( "count(*)"); @@ -129,7 +129,7 @@ namespace pool { map<string,bool>::iterator ki= m_keyInfo.find( key ); if( ki != m_keyInfo.end() ) return ki->second; - std::auto_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); + std::unique_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); m_whereDataForMetadataKey[1].data<std::string>() = key; query->addToOutputList( RelationalCollectionNames::collectionNameColumn() ); query->setCondition( RelationalCollectionBindVariables::whereClauseForMetadataKey(), m_whereDataForMetadataKey ); @@ -146,7 +146,7 @@ namespace pool { { if( !m_metadataTable ) return 0; - std::auto_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); + std::unique_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); m_whereDataForMetadataKey[1].data<std::string>() = key; query->setCondition( RelationalCollectionBindVariables::whereClauseForMetadataKey(), m_whereDataForMetadataKey ); query->limitReturnedRows( 1, 0 ); @@ -314,7 +314,7 @@ namespace pool { { if( !m_metadataTable ) return end(); - std::auto_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); + std::unique_ptr<coral::IQuery> query( m_metadataTable->newQuery() ); coral::AttributeList output; output.extend( "key", "string"); diff --git a/Database/APR/RelationalCollection/tests/WriteUpdate/TestDriver.cpp b/Database/APR/RelationalCollection/tests/WriteUpdate/TestDriver.cpp index 6531a41249af3d13c264fbe945cbf2aeaf6761aa..fc134b92363c827f0239f8b86536f803c235eb13 100644 --- a/Database/APR/RelationalCollection/tests/WriteUpdate/TestDriver.cpp +++ b/Database/APR/RelationalCollection/tests/WriteUpdate/TestDriver.cpp @@ -48,7 +48,7 @@ void TestDriver::write() { cout << "Creationg CollectionService" << endl; - auto_ptr<pool::CollectionService> serviceHandle( new pool::CollectionService() ); + unique_ptr<pool::CollectionService> serviceHandle( new pool::CollectionService() ); cout << "Creating a collection description object" << endl; @@ -118,7 +118,7 @@ TestDriver::write() void TestDriver::update() { - auto_ptr<pool::CollectionService> serviceHandle( new pool::CollectionService ); + unique_ptr<pool::CollectionService> serviceHandle( new pool::CollectionService ); // Create a collection description object. cout << "Getting handle to existing collection" << endl;