diff --git a/ddsrecorder/test/blackbox/sql/SqlFileCreationTest.cpp b/ddsrecorder/test/blackbox/sql/SqlFileCreationTest.cpp index ce6c2294..f50b50e2 100644 --- a/ddsrecorder/test/blackbox/sql/SqlFileCreationTest.cpp +++ b/ddsrecorder/test/blackbox/sql/SqlFileCreationTest.cpp @@ -91,39 +91,42 @@ class SqlFileCreationTest : public FileCreationTest throw std::runtime_error(error_msg); } - // Guard the statement to ensure it's always finalized - std::unique_ptr stmt_guard(stmt, sqlite3_finalize); - - // Bind the values to the statement - for (int i = 0; i < (int) bind_values.size(); i++) { - const auto bind_ret = sqlite3_bind_text(stmt, i+1, bind_values[i].c_str(), -1, SQLITE_STATIC); - if (bind_ret != SQLITE_OK) + // Guard the statement to ensure it's always finalized + std::unique_ptr stmt_guard(stmt, sqlite3_finalize); + + // Bind the values to the statement + for (int i = 0; i < (int) bind_values.size(); i++) { - const std::string error_msg = utils::Formatter() << "Failed to bind SQL statement to read messages: " - << sqlite3_errmsg(database); + const auto bind_ret = sqlite3_bind_text(stmt, i+1, bind_values[i].c_str(), -1, SQLITE_STATIC); - logError(DDSREPLAYER_SQL_READER_PARTICIPANT, "FAIL_SQL_READ | " << error_msg); - throw std::runtime_error(error_msg); + if (bind_ret != SQLITE_OK) + { + const std::string error_msg = utils::Formatter() << "Failed to bind SQL statement to read messages: " + << sqlite3_errmsg(database); + + logError(DDSREPLAYER_SQL_READER_PARTICIPANT, "FAIL_SQL_READ | " << error_msg); + throw std::runtime_error(error_msg); + } } - } - // Step through the statement and process the rows - int step_ret; + // Step through the statement and process the rows + int step_ret; - while ((step_ret = sqlite3_step(stmt)) == SQLITE_ROW) - { - process_row(stmt); - } + while ((step_ret = sqlite3_step(stmt)) == SQLITE_ROW) + { + process_row(stmt); + } - if (step_ret != SQLITE_DONE) - { - const std::string error_msg = utils::Formatter() << "Failed to fetch data: " - << sqlite3_errmsg(database); + if (step_ret != SQLITE_DONE) + { + const std::string error_msg = utils::Formatter() << "Failed to fetch data: " + << sqlite3_errmsg(database); - logError(DDSREPLAYER_SQL_READER_PARTICIPANT, "FAIL_SQL_READ | " << error_msg); - throw std::runtime_error(error_msg); + logError(DDSREPLAYER_SQL_READER_PARTICIPANT, "FAIL_SQL_READ | " << error_msg); + throw std::runtime_error(error_msg); + } } // Close the database diff --git a/ddsrecorder_participants/src/cpp/replayer/BaseReaderParticipant.cpp b/ddsrecorder_participants/src/cpp/replayer/BaseReaderParticipant.cpp index 66f94e73..2746a677 100644 --- a/ddsrecorder_participants/src/cpp/replayer/BaseReaderParticipant.cpp +++ b/ddsrecorder_participants/src/cpp/replayer/BaseReaderParticipant.cpp @@ -110,7 +110,7 @@ std::unique_ptr BaseReaderParticipant::cr auto data = std::make_unique(); // Store the raw data in a payload - ddspipe::core::types::Payload payload(raw_data_size); + ddspipe::core::types::Payload payload; payload.max_size = raw_data_size; payload.length = raw_data_size; payload.data = (unsigned char*) reinterpret_cast(raw_data);