mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Fixed "UNIQUE constraint failed: Statistics.id" error when loading a previous map with last id saved in Statistics not in Node table (this happened when ignored locations are not saved to database).
This commit is contained in:
@@ -783,6 +783,15 @@ void DBDriver::getLastNodeId(int & id) const
|
||||
|
||||
_dbSafeAccessMutex.lock();
|
||||
this->getLastIdQuery("Node", id);
|
||||
int statisticsId = 0;
|
||||
if(uStrNumCmp(this->getDatabaseVersion(), "0.11.11") >= 0)
|
||||
{
|
||||
this->getLastIdQuery("Statistics", statisticsId);
|
||||
if(statisticsId > id)
|
||||
{
|
||||
id = statisticsId;
|
||||
}
|
||||
}
|
||||
_dbSafeAccessMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -3163,7 +3163,7 @@ void DBDriverSqlite3::updateOccupancyGridQuery(
|
||||
|
||||
void DBDriverSqlite3::addStatisticsQuery(const Statistics & statistics) const
|
||||
{
|
||||
UDEBUG("");
|
||||
UDEBUG("Ref ID = %d", statistics.refImageId());
|
||||
if(_ppDb)
|
||||
{
|
||||
std::string type;
|
||||
|
||||
Reference in New Issue
Block a user