Commit adca9df7 authored by Michael Davis's avatar Michael Davis
Browse files

[catalogue] GetArchiveFileItor stores conn as a unique_ptr

parent 91656e83
......@@ -6553,7 +6553,7 @@ ArchiveFileItor RdbmsCatalogue::getArchiveFilesItor(const TapeFileSearchCriteria
std::unique_ptr<rdbms::Conn> conn_p(new rdbms::Conn(m_archiveFileListingConnPool.getConn()));
auto tempDiskFxidsTableName = createAndPopulateTempTableFxid(*conn_p, searchCriteria);
// Pass ownership of the connection to the Iterator object
auto impl = new RdbmsCatalogueGetArchiveFilesItor(m_log, std::move(*(conn_p.release())), searchCriteria, tempDiskFxidsTableName);
auto impl = new RdbmsCatalogueGetArchiveFilesItor(m_log, conn_p.release(), searchCriteria, tempDiskFxidsTableName);
return ArchiveFileItor(impl);
} catch(exception::UserError &) {
throw;
......
......@@ -78,14 +78,14 @@ namespace {
//------------------------------------------------------------------------------
RdbmsCatalogueGetArchiveFilesItor::RdbmsCatalogueGetArchiveFilesItor(
log::Logger &log,
rdbms::Conn &&conn,
rdbms::Conn *conn_ptr,
const TapeFileSearchCriteria &searchCriteria,
const std::string &tempDiskFxidsTableName) :
m_log(log),
m_searchCriteria(searchCriteria),
m_rsetIsEmpty(true),
m_hasMoreHasBeenCalled(false),
m_conn(std::move(conn)),
m_conn_ptr(conn_ptr),
m_archiveFileBuilder(log)
{
try {
......@@ -168,7 +168,7 @@ RdbmsCatalogueGetArchiveFilesItor::RdbmsCatalogueGetArchiveFilesItor(
sql += " ORDER BY ARCHIVE_FILE_ID, COPY_NB";
}
m_stmt = m_conn.createStmt(sql);
m_stmt = m_conn_ptr->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.reset();
m_conn_ptr->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.
*/
rdbms::Conn m_conn;
std::unique_ptr<rdbms::Conn> m_conn_ptr;
/**
* 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