The map can save some tables, but the table that fails is keyframes and is empty. After searching for this error string I think the error is on the following function, where it will always return a nullptr because ret is hardcoded to SQLITE_ERROR:
sqlite3_stmt* create_insert_stmt(sqlite3* db,
const std::string& name,
const std::vector<std::pair<std::string, std::string>>& columns) {
int ret = SQLITE_ERROR;
sqlite3_stmt* stmt = nullptr;
if (ret == SQLITE_OK) {
std::string insert_stmt_str = "INSERT INTO " + name + "(id";
for (const auto& column : columns) {
insert_stmt_str += ", " + column.first;
}
insert_stmt_str += ") VALUES(?";
for (size_t i = 0; i < columns.size(); ++i) {
insert_stmt_str += ", ?";
}
insert_stmt_str += ")";
ret = sqlite3_prepare_v2(db, insert_stmt_str.c_str(), -1, &stmt, nullptr);
}
if (!stmt) {
spdlog::error("SQLite error (prepare): {}", sqlite3_errmsg(db));
}
return stmt;
}
Describe the bug
When saving a map with SQLite3 map format, it fails with following error:
To Reproduce
When trying to save a map after executing stella_vslam_ros.
build options:
Expected behavior
Saved the map completly
Screenshots or videos
Environment
Additional context
The map can save some tables, but the table that fails is
keyframes
and is empty. After searching for this error string I think the error is on the following function, where it will always return anullptr
becauseret
is hardcoded toSQLITE_ERROR
: