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

Function loadSampleCounts

app/src/Sessions/ReportData.cpp:540–558  ·  view source on GitHub ↗

* @brief Numeric-sample count per parameter, keyed by @c unique_id. */

Source from the content-addressed store, hash-verified

538 * @brief Numeric-sample count per parameter, keyed by @c unique_id.
539 */
540static std::map<int, qint64> loadSampleCounts(QSqlDatabase& db, int sessionId)
541{
542 std::map<int, qint64> counts;
543
544 QSqlQuery q(db);
545 q.prepare("SELECT unique_id, COUNT(*) FROM readings "
546 "WHERE session_id = ? AND is_numeric = 1 GROUP BY unique_id");
547 q.bindValue(0, sessionId);
548
549 if (!q.exec()) {
550 qWarning() << "[Sessions::ReportData] sample-count query failed:" << q.lastError().text();
551 return counts;
552 }
553
554 while (q.next())
555 counts.emplace(q.value(0).toInt(), q.value(1).toLongLong());
556
557 return counts;
558}
559
560/**
561 * @brief Loads downsampled numeric time-series for every parameter.

Callers 1

loadChartSeriesMethod · 0.85

Calls 5

execMethod · 0.80
nextMethod · 0.80
textMethod · 0.45
lastErrorMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected