Dump McConfig and Memspec into db file

Instead of inserting the relative paths to the McConfig and
Memspec files, dump their contents into the database directly.
This commit is contained in:
2021-08-13 11:35:42 +02:00
parent d1c528bd9d
commit 78327626d0
2 changed files with 11 additions and 4 deletions

View File

@@ -342,8 +342,15 @@ void TlmRecorder::insertGeneralInfo()
sqlite3_bind_int(insertGeneralInfoStatement, 5, static_cast<int>(Configuration::getInstance().memSpec->numberOfBanks));
sqlite3_bind_int(insertGeneralInfoStatement, 6, static_cast<int>(Configuration::getInstance().memSpec->tCK.value()));
sqlite3_bind_text(insertGeneralInfoStatement, 7, "PS", 2, nullptr);
sqlite3_bind_text(insertGeneralInfoStatement, 8, mcconfig.c_str(), static_cast<int>(mcconfig.length()), nullptr);
sqlite3_bind_text(insertGeneralInfoStatement, 9, memspec.c_str(), static_cast<int>(memspec.length()), nullptr);
std::fstream mcconfig_stream, memspec_stream;
mcconfig_stream.open(mcconfig, std::ios::in);
memspec_stream.open(memspec, std::ios::in);
std::string mcconfig_dump((std::istreambuf_iterator<char>(mcconfig_stream)), (std::istreambuf_iterator<char>()));
std::string memspec_dump((std::istreambuf_iterator<char>(memspec_stream)), (std::istreambuf_iterator<char>()));
sqlite3_bind_text(insertGeneralInfoStatement, 8, mcconfig_dump.c_str(), static_cast<int>(mcconfig_dump.length()), nullptr);
sqlite3_bind_text(insertGeneralInfoStatement, 9, memspec_dump.c_str(), static_cast<int>(memspec_dump.length()), nullptr);
sqlite3_bind_text(insertGeneralInfoStatement, 10, traces.c_str(), static_cast<int>(traces.length()), nullptr);
if (!Configuration::getInstance().enableWindowing)
sqlite3_bind_int64(insertGeneralInfoStatement, 11, 0);

View File

@@ -17,7 +17,7 @@ class MCConfig(object):
cursor = dbconnection.cursor()
cursor.execute("SELECT MCconfig FROM GeneralInfo")
result = cursor.fetchone()
self.jsonMCConfig = json.load(open(result[0]))
self.jsonMCConfig = json.loads(result[0])
class MemSpec(object):
@@ -39,7 +39,7 @@ class MemSpec(object):
cursor = dbconnection.cursor()
cursor.execute("SELECT Memspec FROM GeneralInfo")
result = cursor.fetchone()
self.jsonMemSpec = json.load(open(result[0]))
self.jsonMemSpec = json.loads(result[0])
def getClock(dbconnection):