From a310b5e864571d4d3232604d8ee2cda6f6fed123 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sat, 25 Jun 2016 13:28:26 -0400 Subject: [PATCH] DB: Added error when loading a database with version more recent than installed rtabmap version --- corelib/src/DBDriverSqlite3.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/corelib/src/DBDriverSqlite3.cpp b/corelib/src/DBDriverSqlite3.cpp index 11d48b42..aaabe60f 100644 --- a/corelib/src/DBDriverSqlite3.cpp +++ b/corelib/src/DBDriverSqlite3.cpp @@ -373,6 +373,15 @@ bool DBDriverSqlite3::connectDatabaseQuery(const std::string & url, bool overwri UASSERT(this->getDatabaseVersionQuery(_version)); // must be true! UINFO("Database version = %s", _version.c_str()); + if(uStrNumCmp(_version, RTABMAP_VERSION) > 0) + { + UERROR("Opened database version (%s) is more recent than rtabmap " + "installed version (%s). Please update rtabmap to new version!", + _version.c_str(), RTABMAP_VERSION); + this->disconnectDatabaseQuery(false); + return false; + } + //Set database optimizations this->setCacheSize(_cacheSize); // this will call the SQL this->setJournalMode(_journalMode); // this will call the SQL