Commit cb6f7efa authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Do not re-generate SQL request each time

parent 4e318b48
...@@ -54,7 +54,7 @@ class Cache ...@@ -54,7 +54,7 @@ class Cache
auto it = Store.find( key ); auto it = Store.find( key );
if ( it != Store.end() ) if ( it != Store.end() )
return it->second; return it->second;
std::string req = "SELECT * FROM" + TABLEPOLICY::Name + static const std::string req = "SELECT * FROM" + TABLEPOLICY::Name +
" WHERE " + TABLEPOLICY::CacheColumn + " = ?"; " WHERE " + TABLEPOLICY::CacheColumn + " = ?";
auto res = SqliteTools::fetchOne<IMPL>( dbConnection, req.c_str(), key ); auto res = SqliteTools::fetchOne<IMPL>( dbConnection, req.c_str(), key );
Store[key] = res; Store[key] = res;
...@@ -69,7 +69,7 @@ class Cache ...@@ -69,7 +69,7 @@ class Cache
*/ */
static bool fetchAll( sqlite3* dbConnection, std::vector<std::shared_ptr<INTF>>& res ) static bool fetchAll( sqlite3* dbConnection, std::vector<std::shared_ptr<INTF>>& res )
{ {
std::string req = "SELECT * FROM " + TABLEPOLICY::Name; static const std::string req = "SELECT * FROM " + TABLEPOLICY::Name;
return SqliteTools::fetchAll<IMPL, INTF>( dbConnection, req.c_str(), res ); return SqliteTools::fetchAll<IMPL, INTF>( dbConnection, req.c_str(), res );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment