Commit a49cb17b authored by Steven Murray's avatar Steven Murray
Browse files

Removed unnecessary layering of unique_ptr objects on top of rdbms connection objects

parent adca9df7
......@@ -6550,10 +6550,10 @@ ArchiveFileItor RdbmsCatalogue::getArchiveFilesItor(const TapeFileSearchCriteria
try {
// Create a connection to populate the temporary table (specialised by database type)
std::unique_ptr<rdbms::Conn> conn_p(new rdbms::Conn(m_archiveFileListingConnPool.getConn()));
auto tempDiskFxidsTableName = createAndPopulateTempTableFxid(*conn_p, searchCriteria);
auto conn = m_archiveFileListingConnPool.getConn();
auto tempDiskFxidsTableName = createAndPopulateTempTableFxid(conn, searchCriteria);
// Pass ownership of the connection to the Iterator object
auto impl = new RdbmsCatalogueGetArchiveFilesItor(m_log, conn_p.release(), searchCriteria, tempDiskFxidsTableName);
auto impl = new RdbmsCatalogueGetArchiveFilesItor(m_log, std::move(conn), searchCriteria, tempDiskFxidsTableName);
return ArchiveFileItor(impl);
} catch(exception::UserError &) {
throw;
......
......@@ -78,14 +78,14 @@ namespace {
//------------------------------------------------------------------------------
RdbmsCatalogueGetArchiveFilesItor::RdbmsCatalogueGetArchiveFilesItor(
log::Logger &log,
rdbms::Conn *conn_ptr,
rdbms::Conn conn,
const TapeFileSearchCriteria &searchCriteria,
const std::string &tempDiskFxidsTableName) :
m_log(log),
m_searchCriteria(searchCriteria),
m_rsetIsEmpty(true),
m_hasMoreHasBeenCalled(false),
m_conn_ptr(conn_ptr),
m_conn(std::move(conn)),
m_archiveFileBuilder(log)
{
try {
......@@ -168,7 +168,7 @@ RdbmsCatalogueGetArchiveFilesItor::RdbmsCatalogueGetArchiveFilesItor(
sql += " ORDER BY ARCHIVE_FILE_ID, COPY_NB";
}
m_stmt = m_conn_ptr->createStmt(sql);
m_stmt = m_conn.createStmt(sql);
if(searchCriteria.archiveFileId) {
m_stmt.bindUint64(":ARCHIVE_FILE_ID", searchCriteria.archiveFileId.value());
}
......@@ -207,7 +207,7 @@ RdbmsCatalogueGetArchiveFilesItor::~RdbmsCatalogueGetArchiveFilesItor() {
void RdbmsCatalogueGetArchiveFilesItor::releaseDbResources() noexcept {
m_rset.reset();
m_stmt.reset();
m_conn_ptr->reset();
m_conn.reset();
}
//------------------------------------------------------------------------------
......
......@@ -46,7 +46,7 @@ public:
*/
RdbmsCatalogueGetArchiveFilesItor(
log::Logger &log,
rdbms::Conn *conn,
rdbms::Conn conn,
const TapeFileSearchCriteria &searchCriteria,
const std::string &tempDiskFxidsTableName);
......@@ -94,7 +94,7 @@ private:
/**
* The database connection.
*/
std::unique_ptr<rdbms::Conn> m_conn_ptr;
rdbms::Conn m_conn;
/**
* The database statement.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment