• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llnl / dftracer-utils / 23529483807

25 Mar 2026 07:17AM UTC coverage: 48.515% (-1.6%) from 50.098%
23529483807

Pull #57

github

web-flow
Merge 5b1e117ad into 38f9f3616
Pull Request #57: feat(comparator): add pairwise traces comparator

18829 of 49412 branches covered (38.11%)

Branch coverage included in aggregate %.

1584 of 1933 new or added lines in 14 files covered. (81.95%)

3552 existing lines in 135 files now uncovered.

18474 of 27477 relevant lines covered (67.23%)

241072.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.73
/src/dftracer/utils/core/sqlite/database.cpp
1
#include <dftracer/utils/core/common/filesystem.h>
2
#include <dftracer/utils/core/sqlite/database.h>
3
#include <dftracer/utils/core/sqlite/error.h>
4

5
#include <utility>
6

7
namespace dftracer::utils::sqlite {
8

9
SqliteDatabase::SqliteDatabase() : db_path_(""), db_(nullptr) {}
2,496✔
10

11
SqliteDatabase::SqliteDatabase(const std::string &db_path)
470✔
12
    : db_path_(db_path), db_(nullptr) {
470✔
13
    open(db_path);
235!
14
}
470✔
15

16
SqliteDatabase::~SqliteDatabase() { close(); }
2,968!
17

18
SqliteDatabase::SqliteDatabase(SqliteDatabase &&other) noexcept
2✔
19
    : db_path_(std::move(other.db_path_)), db_(other.db_) {
2✔
20
    other.db_ = nullptr;
1✔
21
}
2✔
22

23
SqliteDatabase &SqliteDatabase::operator=(SqliteDatabase &&other) noexcept {
×
24
    if (this != &other) {
×
25
        close();
×
26
        db_path_ = std::move(other.db_path_);
×
27
        db_ = other.db_;
×
28
        other.db_ = nullptr;
×
UNCOV
29
    }
×
30
    return *this;
×
31
}
32

33
bool SqliteDatabase::open(const std::string &db_path) {
1,471✔
34
    if (is_open()) {
1,471!
35
        close();
×
UNCOV
36
    }
×
37

38
    db_path_ = db_path;
1,471✔
39

40
    // Ensure parent directory exists (SQLite cannot create it)
41
    std::error_code ec;
1,471✔
42
    fs::create_directories(fs::path(db_path_).parent_path(), ec);
1,471!
43

44
    if (sqlite3_open(db_path_.c_str(), &db_) != SQLITE_OK) {
1,471!
45
        throw SqliteError(
×
46
            SqliteError::Type::OPEN_ERROR,
47
            "Failed to open database: " + std::string(sqlite3_errmsg(db_)));
×
48
    }
49
    return true;
1,471✔
UNCOV
50
}
×
51

52
void SqliteDatabase::close() {
2,720✔
53
    if (db_) {
2,720✔
54
        sqlite3_close(db_);
1,471✔
55
        db_ = nullptr;
1,471✔
56
    }
1,471✔
57
}
2,720✔
58

59
sqlite3 *SqliteDatabase::get() const { return db_; }
11,379✔
60

61
bool SqliteDatabase::is_open() const { return db_ != nullptr; }
1,493✔
62

63
bool SqliteDatabase::open_with_vfs(const std::string &db_path,
×
64
                                   const char *vfs_name) {
65
    if (is_open()) {
×
66
        close();
×
UNCOV
67
    }
×
68
    db_path_ = db_path;
×
69

70
    std::error_code ec;
×
71
    fs::create_directories(fs::path(db_path_).parent_path(), ec);
×
72

UNCOV
73
    int rc =
×
74
        sqlite3_open_v2(db_path_.c_str(), &db_,
×
UNCOV
75
                        SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, vfs_name);
×
76
    if (rc != SQLITE_OK) {
×
77
        throw SqliteError(SqliteError::Type::OPEN_ERROR,
×
78
                          "Failed to open database with VFS '" +
×
79
                              std::string(vfs_name) +
×
80
                              "': " + std::string(sqlite3_errmsg(db_)));
×
81
    }
82
    return true;
×
UNCOV
83
}
×
84

85
}  // namespace dftracer::utils::sqlite
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc