Skip to content
Snippets Groups Projects
Commit 9536f4d6 authored by Steven Murray's avatar Steven Murray
Browse files

Improved SqliteCatalogue::createAndPopulateTempTableFxid()

parent 5522c67d
No related branches found
No related tags found
No related merge requests found
......@@ -198,25 +198,26 @@ void SqliteCatalogue::DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string
// createAndPopulateTempTableFxid
//------------------------------------------------------------------------------
std::string SqliteCatalogue::createAndPopulateTempTableFxid(rdbms::Conn &conn, const TapeFileSearchCriteria &tapeFileSearchCriteria) const {
const std::string tempTableName = "TEMP.DISK_FXIDS";
try {
const std::string tempTableName = "TEMP.DISK_FXIDS";
if(tapeFileSearchCriteria.diskFileIds) {
try {
// Drop any prexisting temporary table and create a new one
conn.executeNonQuery("DROP TABLE IF EXISTS " + tempTableName);
conn.executeNonQuery("CREATE TEMPORARY TABLE " + tempTableName + "(DISK_FILE_ID TEXT)");
// Drop any prexisting temporary table and create a new one
conn.executeNonQuery("DROP TABLE IF EXISTS " + tempTableName);
conn.executeNonQuery("CREATE TEMPORARY TABLE " + tempTableName + "(DISK_FILE_ID TEXT)");
if(tapeFileSearchCriteria.diskFileIds) {
auto stmt = conn.createStmt("INSERT INTO " + tempTableName + " VALUES(:DISK_FILE_ID)");
for(auto &diskFileId : tapeFileSearchCriteria.diskFileIds.value()) {
stmt.bindString(":DISK_FILE_ID", diskFileId);
stmt.executeNonQuery();
}
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
return tempTableName;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
return tempTableName;
}
//------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment