mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
DBDriver: added getDatabaseVersion() method
This commit is contained in:
@@ -99,6 +99,15 @@ long DBDriver::getMemoryUsed() const
|
||||
return bytes;
|
||||
}
|
||||
|
||||
std::string DBDriver::getDatabaseVersion() const
|
||||
{
|
||||
std::string version = "0.0.0";
|
||||
_dbSafeAccessMutex.lock();
|
||||
getDatabaseVersionQuery(version);
|
||||
_dbSafeAccessMutex.unlock();
|
||||
return version;
|
||||
}
|
||||
|
||||
void DBDriver::mainLoop()
|
||||
{
|
||||
this->emptyTrashes();
|
||||
|
||||
@@ -269,7 +269,7 @@ int DBDriverSqlite3::loadOrSaveDb(sqlite3 *pInMemory, const std::string & fileNa
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool DBDriverSqlite3::getVersion(std::string & version) const
|
||||
bool DBDriverSqlite3::getDatabaseVersionQuery(std::string & version) const
|
||||
{
|
||||
version = "0.0.0";
|
||||
if(_ppDb)
|
||||
@@ -370,7 +370,7 @@ bool DBDriverSqlite3::connectDatabaseQuery(const std::string & url, bool overwri
|
||||
schema = uHex2Str(schema);
|
||||
this->executeNoResultQuery(schema.c_str());
|
||||
}
|
||||
UASSERT(this->getVersion(_version)); // must be true!
|
||||
UASSERT(this->getDatabaseVersionQuery(_version)); // must be true!
|
||||
UINFO("Database version = %s", _version.c_str());
|
||||
|
||||
//Set database optimizations
|
||||
|
||||
@@ -53,6 +53,7 @@ private:
|
||||
virtual void disconnectDatabaseQuery();
|
||||
virtual bool isConnectedQuery() const;
|
||||
virtual long getMemoryUsedQuery() const; // In bytes
|
||||
virtual bool getDatabaseVersionQuery(std::string & version) const;
|
||||
|
||||
virtual void executeNoResultQuery(const std::string & sql) const;
|
||||
|
||||
@@ -101,7 +102,6 @@ private:
|
||||
private:
|
||||
void loadLinksQuery(std::list<Signature *> & signatures) const;
|
||||
int loadOrSaveDb(sqlite3 *pInMemory, const std::string & fileName, int isSave) const;
|
||||
bool getVersion(std::string &) const;
|
||||
|
||||
private:
|
||||
sqlite3 * _ppDb;
|
||||
|
||||
@@ -1170,6 +1170,16 @@ int Memory::getDatabaseMemoryUsed() const
|
||||
return memoryUsed;
|
||||
}
|
||||
|
||||
std::string Memory::getDatabaseVersion() const
|
||||
{
|
||||
std::string version = "0.0.0";
|
||||
if(_dbDriver)
|
||||
{
|
||||
version = _dbDriver->getDatabaseVersion();
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
double Memory::getDbSavingTime() const
|
||||
{
|
||||
return _dbDriver?_dbDriver->getEmptyTrashesTime():0;
|
||||
|
||||
Reference in New Issue
Block a user