MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / loadSessionHeader

Function loadSessionHeader

app/src/Sessions/ReportData.cpp:53–71  ·  view source on GitHub ↗

* @brief Loads the session header row into out, returning false on missing session. */

Source from the content-addressed store, hash-verified

51 * @brief Loads the session header row into out, returning false on missing session.
52 */
53static bool loadSessionHeader(QSqlDatabase& db, int sessionId, Sessions::ReportData& out)
54{
55 QSqlQuery q(db);
56 q.prepare(
57 "SELECT s.project_title, s.started_at, s.ended_at, s.notes, "
58 " (SELECT COUNT(DISTINCT timestamp_ns) FROM readings WHERE session_id = s.session_id) "
59 "FROM sessions s WHERE s.session_id = ?");
60 q.bindValue(0, sessionId);
61 if (!q.exec() || !q.next())
62 return false;
63
64 out.projectTitle = q.value(0).toString();
65 out.startedAt = q.value(1).toString();
66 out.endedAt = q.value(2).toString();
67 out.notes = q.value(3).toString();
68 out.frameCount = q.value(4).toLongLong();
69 out.durationMs = computeDurationMs(out.startedAt, out.endedAt);
70 return true;
71}
72
73/**
74 * @brief Reads the dataset column metadata into a default-initialized DatasetStats vector.

Callers 1

buildFromSessionMethod · 0.85

Calls 4

computeDurationMsFunction · 0.85
execMethod · 0.80
nextMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected