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

llnl / dftracer-utils / 23730905027

30 Mar 2026 06:22AM UTC coverage: 51.451% (+0.4%) from 51.022%
23730905027

push

github

rayandrew
chore(docs)!: regenerate C++ API reference pages from Doxygen XML

- Add generate_api_index.py script for automated API doc generation
- Rename core_common.rst to core_infrastructure.rst
- Update all API reference pages with current class/function signatures
- Add doxygen group annotations to public headers

BREAKING CHANGE: API reference page structure reorganized

23019 of 57787 branches covered (39.83%)

Branch coverage included in aggregate %.

20057 of 25936 relevant lines covered (77.33%)

13268.82 hits per line

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

38.67
/src/dftracer/utils/core/sqlite/statement.cpp
1
#include <dftracer/utils/core/sqlite/database.h>
2
#include <dftracer/utils/core/sqlite/error.h>
3
#include <dftracer/utils/core/sqlite/statement.h>
4

5
#include <cstddef>
6
#include <span>
7

8
namespace dftracer::utils::sqlite {
9

10
SqliteStmt::SqliteStmt(const SqliteDatabase &db, const char *sql) {
29,413✔
11
    sqlite3 *raw_db = db.get();
19,609✔
12
    if (sqlite3_prepare_v2(raw_db, sql, -1, &stmt_, nullptr) != SQLITE_OK) {
19,607✔
13
        stmt_ = nullptr;
90✔
14
        throw SqliteError(SqliteError::Type::STATEMENT_ERROR,
135!
15
                          "Failed to prepare SQL statement: " +
135!
16
                              std::string(sqlite3_errmsg(raw_db)));
135!
17
    }
18
}
29,370✔
19

20
SqliteStmt::SqliteStmt(sqlite3 *db, const char *sql) {
1,779✔
21
    if (sqlite3_prepare_v2(db, sql, -1, &stmt_, nullptr) != SQLITE_OK) {
1,186✔
22
        stmt_ = nullptr;
×
23
        throw SqliteError(SqliteError::Type::STATEMENT_ERROR,
×
24
                          "Failed to prepare SQL statement: " +
×
25
                              std::string(sqlite3_errmsg(db)));
×
26
    }
27
}
1,779✔
28

29
SqliteStmt::~SqliteStmt() {
31,056✔
30
    if (stmt_) {
20,705✔
31
        sqlite3_finalize(stmt_);
20,704!
32
    }
10,352✔
33
}
31,059✔
34

35
SqliteStmt::operator sqlite3_stmt *() { return stmt_; }
118,266✔
36

37
sqlite3_stmt *SqliteStmt::get() { return stmt_; }
2,128✔
38

39
void SqliteStmt::reset() { sqlite3_reset(stmt_); }
1,008✔
40

41
void SqliteStmt::bind_int(int index, int value) {
17,215✔
42
    validate_parameter_index(index);
17,215✔
43
    int rc = sqlite3_bind_int(stmt_, index, value);
17,215✔
44
    if (rc != SQLITE_OK) {
17,215✔
45
        throw SqliteError(
×
46
            SqliteError::Type::STATEMENT_ERROR,
47
            "Failed to bind int parameter at index " + std::to_string(index));
×
48
    }
49
}
17,215✔
50

51
void SqliteStmt::bind_int64(int index, int64_t value) {
35,773✔
52
    validate_parameter_index(index);
35,773✔
53
    int rc = sqlite3_bind_int64(stmt_, index, value);
35,773✔
54
    if (rc != SQLITE_OK) {
35,773✔
55
        throw SqliteError(
×
56
            SqliteError::Type::STATEMENT_ERROR,
57
            "Failed to bind int64 parameter at index " + std::to_string(index));
×
58
    }
59
}
35,773✔
60

61
void SqliteStmt::bind_double(int index, double value) {
88✔
62
    validate_parameter_index(index);
88✔
63
    int rc = sqlite3_bind_double(stmt_, index, value);
88✔
64
    if (rc != SQLITE_OK) {
88✔
65
        throw SqliteError(SqliteError::Type::STATEMENT_ERROR,
×
66
                          "Failed to bind double parameter at index " +
×
67
                              std::to_string(index));
×
68
    }
69
}
88✔
70

71
void SqliteStmt::bind_text(int index, const std::string &text) {
7,789✔
72
    validate_parameter_index(index);
7,789✔
73
    int rc =
3,895✔
74
        sqlite3_bind_text(stmt_, index, text.c_str(),
11,683✔
75
                          static_cast<int>(text.length()), SQLITE_TRANSIENT);
7,789✔
76
    if (rc != SQLITE_OK) {
7,790✔
77
        throw SqliteError(
×
78
            SqliteError::Type::STATEMENT_ERROR,
79
            "Failed to bind text parameter at index " + std::to_string(index));
×
80
    }
81
}
7,790✔
82

83
void SqliteStmt::bind_text(int index, std::string_view text) {
2,176✔
84
    validate_parameter_index(index);
2,176✔
85
    int rc = sqlite3_bind_text(stmt_, index, text.data(),
3,264✔
86
                               static_cast<int>(text.size()), SQLITE_TRANSIENT);
2,176✔
87
    if (rc != SQLITE_OK) {
2,176✔
88
        throw SqliteError(
×
89
            SqliteError::Type::STATEMENT_ERROR,
90
            "Failed to bind text parameter at index " + std::to_string(index));
×
91
    }
92
}
2,176✔
93

94
void SqliteStmt::bind_text(int index, const char *text, int length,
112✔
95
                           void (*destructor)(void *)) {
96
    validate_parameter_index(index);
112✔
97
    int rc = sqlite3_bind_text(stmt_, index, text, length, destructor);
112✔
98
    if (rc != SQLITE_OK) {
112✔
99
        throw SqliteError(
×
100
            SqliteError::Type::STATEMENT_ERROR,
101
            "Failed to bind text parameter at index " + std::to_string(index));
×
102
    }
103
}
112✔
104

105
void SqliteStmt::bind_blob(int index, const void *blob, int length) {
3,500✔
106
    validate_parameter_index(index);
3,500✔
107
    int rc = sqlite3_bind_blob(stmt_, index, blob, length, SQLITE_TRANSIENT);
3,500✔
108
    if (rc != SQLITE_OK) {
3,500✔
109
        throw SqliteError(
×
110
            SqliteError::Type::STATEMENT_ERROR,
111
            "Failed to bind blob parameter at index " + std::to_string(index));
×
112
    }
113
}
3,500✔
114

115
void SqliteStmt::bind_blob(int index, std::span<const std::byte> data) {
×
116
    bind_blob(index, data.data(), static_cast<int>(data.size()));
×
117
}
×
118

119
void SqliteStmt::bind_blob(int index, std::span<const unsigned char> data) {
×
120
    bind_blob(index, data.data(), static_cast<int>(data.size()));
×
121
}
×
122

123
void SqliteStmt::bind_blob_static(int index, const void *blob, int length) {
1,078✔
124
    validate_parameter_index(index);
1,078✔
125
    int rc = sqlite3_bind_blob(stmt_, index, blob, length, SQLITE_STATIC);
1,078✔
126
    if (rc != SQLITE_OK) {
1,078✔
127
        throw SqliteError(
×
128
            SqliteError::Type::STATEMENT_ERROR,
129
            "Failed to bind blob parameter at index " + std::to_string(index));
×
130
    }
131
}
1,078✔
132

133
void SqliteStmt::bind_text_static(int index, std::string_view text) {
3,486✔
134
    validate_parameter_index(index);
3,486✔
135
    int rc = sqlite3_bind_text(stmt_, index, text.data(),
5,229✔
136
                               static_cast<int>(text.size()), SQLITE_STATIC);
3,486✔
137
    if (rc != SQLITE_OK) {
3,486✔
138
        throw SqliteError(
×
139
            SqliteError::Type::STATEMENT_ERROR,
140
            "Failed to bind text parameter at index " + std::to_string(index));
×
141
    }
142
}
3,486✔
143

144
void SqliteStmt::bind_null(int index) {
154✔
145
    validate_parameter_index(index);
154✔
146
    int rc = sqlite3_bind_null(stmt_, index);
154✔
147
    if (rc != SQLITE_OK) {
154✔
148
        throw SqliteError(
×
149
            SqliteError::Type::STATEMENT_ERROR,
150
            "Failed to bind null parameter at index " + std::to_string(index));
×
151
    }
152
}
154✔
153

154
void SqliteStmt::clear_bindings() { sqlite3_clear_bindings(stmt_); }
×
155

156
int SqliteStmt::bind_parameter_count() {
×
157
    return sqlite3_bind_parameter_count(stmt_);
×
158
}
159

160
void SqliteStmt::validate_parameter_index(int index) {
71,372✔
161
    if (index < 1) {
71,372✔
162
        throw SqliteError(
×
163
            SqliteError::Type::STATEMENT_ERROR,
164
            "Parameter index must be >= 1 (got " + std::to_string(index) + ")");
×
165
    }
166
    int param_count = sqlite3_bind_parameter_count(stmt_);
71,372✔
167
    if (index > param_count) {
71,372✔
168
        throw SqliteError(SqliteError::Type::STATEMENT_ERROR,
×
169
                          "Parameter index " + std::to_string(index) +
×
170
                              " exceeds parameter count " +
×
171
                              std::to_string(param_count));
×
172
    }
173
}
71,372✔
174

175
}  // 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