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

llnl / dftracer-utils / 23531027933

25 Mar 2026 08:05AM UTC coverage: 48.592% (-1.5%) from 50.098%
23531027933

Pull #57

github

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

18900 of 49456 branches covered (38.22%)

Branch coverage included in aggregate %.

1604 of 1954 new or added lines in 25 files covered. (82.09%)

3407 existing lines in 135 files now uncovered.

18487 of 27485 relevant lines covered (67.26%)

240991.5 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,469✔
34
    if (is_open()) {
1,469!
35
        close();
×
UNCOV
36
    }
×
37

38
    db_path_ = db_path;
1,469✔
39

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

44
    if (sqlite3_open(db_path_.c_str(), &db_) != SQLITE_OK) {
1,469!
45
        throw SqliteError(
×
46
            SqliteError::Type::OPEN_ERROR,
47
            "Failed to open database: " + std::string(sqlite3_errmsg(db_)));
×
48
    }
49
    return true;
1,469✔
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,389✔
60

61
bool SqliteDatabase::is_open() const { return db_ != nullptr; }
1,486✔
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