Skip to content
Snippets Groups Projects
Commit 08baeab1 authored by Riccardo Maria Bianchi's avatar Riccardo Maria Bianchi :sunny:
Browse files

Load info from DB and create caches as soon as the DB file is opened

parent 53e95434
No related branches found
No related tags found
1 merge request!199Update GeoModelExamples
...@@ -189,8 +189,16 @@ class GMDBManager { ...@@ -189,8 +189,16 @@ class GMDBManager {
void printAllDBTables(); void printAllDBTables();
/// Get tables and tables' columns from the input DB, if any,
/// and populate the cache that stores them
void createTableDataCaches(); void createTableDataCaches();
/// Get all tables from the input DB, if any,
/// and populate the cache that stores them
void getAllDBTables(); void getAllDBTables();
/// Get tables' columns from the input DB, if any,
/// and populate the cache that stores them
void getAllDBTableColumns(); void getAllDBTableColumns();
int execQuery(std::string queryStr); int execQuery(std::string queryStr);
...@@ -247,12 +255,12 @@ class GMDBManager { ...@@ -247,12 +255,12 @@ class GMDBManager {
/// methods to dump the DB /// methods to dump the DB
std::vector<std::vector<std::string>> getChildrenTable(); std::vector<std::vector<std::string>> getChildrenTable();
//Table names for Aux tables are of the form prefix_suffix // Table names for Aux tables are of the form prefix_suffix
//where prefix depends on the type of data in the table // where prefix depends on the type of data in the table
//and suffix depends on the plugin/publisher that provided it // and suffix depends on the plugin/publisher that provided it
//These two require only the suffix, the prefix is already specified based on the // These two require only the suffix, the prefix is already specified based
//table type being accessed // on the table type being accessed
std::vector<std::vector<std::string>> getPublishedFPVTable( std::vector<std::vector<std::string>> getPublishedFPVTable(
std::string suffix = ""); std::string suffix = "");
std::vector<std::vector<std::string>> getPublishedAXFTable( std::vector<std::vector<std::string>> getPublishedAXFTable(
...@@ -264,10 +272,11 @@ class GMDBManager { ...@@ -264,10 +272,11 @@ class GMDBManager {
std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypes(); std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypes();
std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDs(); std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDs();
std::vector<std::vector<std::string>> getTableRecords(std::string tableName) const; // TODO: should be private? std::vector<std::vector<std::string>> getTableRecords(
std::string tableName) const; // TODO: should be private?
//Test if a given table exists // Test if a given table exists
//This requires the *full* table name (i.e. prefix_suffix) // This requires the *full* table name (i.e. prefix_suffix)
bool checkTable(std::string tableName) const; bool checkTable(std::string tableName) const;
/** /**
...@@ -347,12 +356,14 @@ class GMDBManager { ...@@ -347,12 +356,14 @@ class GMDBManager {
// verbosity level // verbosity level
int m_verbose; int m_verbose;
std::unordered_map<std::string, std::vector<std::string>> /// stores the column names for each table
m_tableNames; /// stores the column names for each table std::unordered_map<std::string, std::vector<std::string>> m_tableNames;
std::unordered_map<std::string, std::string> m_childType_tableName; std::unordered_map<std::string, std::string> m_childType_tableName;
std::vector<std::string> /// cache for the list of tables in the DB
m_cache_tables; /// cache for the list of tables in the DB std::vector<std::string> m_cache_tables;
std::unordered_map<unsigned int, std::string> std::unordered_map<unsigned int, std::string>
m_cache_tableId_tableName; /// cache for tableID-->tableName m_cache_tableId_tableName; /// cache for tableID-->tableName
std::unordered_map<unsigned int, std::string> std::unordered_map<unsigned int, std::string>
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment