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

tstack / lnav / 17589970077-2502

09 Sep 2025 05:00PM UTC coverage: 65.196% (-5.0%) from 70.225%
17589970077-2502

push

github

tstack
[format] add fields for source file/line

Knowing the source file/line context in a log
message can help find log messages when using
log2src.

56 of 70 new or added lines in 2 files covered. (80.0%)

13954 existing lines in 210 files now uncovered.

45516 of 69814 relevant lines covered (65.2%)

404154.37 hits per line

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

89.66
/src/sqlitepp.hh
1
/**
2
 * Copyright (c) 2022, Timothy Stack
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are met:
8
 *
9
 * * Redistributions of source code must retain the above copyright notice, this
10
 * list of conditions and the following disclaimer.
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 * this list of conditions and the following disclaimer in the documentation
13
 * and/or other materials provided with the distribution.
14
 * * Neither the name of Timothy Stack nor the names of its contributors
15
 * may be used to endorse or promote products derived from this software
16
 * without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * @file sqlitepp.hh
30
 */
31

32
#ifndef lnav_sqlitepp_hh
33
#define lnav_sqlitepp_hh
34

35
#include <string>
36

37
#include <sqlite3.h>
38

39
#include "base/auto_mem.hh"
40
#include "base/intern_string.hh"
41
#include "base/types.hh"
42

43
/* XXX figure out how to do this with the template */
44
void sqlite_close_wrapper(void* mem);
45

46
using auto_sqlite3 = auto_mem<sqlite3, sqlite_close_wrapper>;
47

48
namespace sqlitepp {
49

50
inline auto_mem<char>
51
quote(const std::optional<std::string>& str)
42✔
52
{
53
    auto_mem<char> retval(sqlite3_free);
42✔
54

55
    if (str) {
42✔
56
        retval = sqlite3_mprintf("%Q", str.value().c_str());
31✔
57
    } else {
58
        retval = sqlite3_mprintf("NULL");
11✔
59
    }
60

61
    return retval;
42✔
62
}
×
63

64
extern const char* ERROR_PREFIX;
65

66
struct bind_visitor {
67
    bind_visitor(sqlite3_stmt* stmt, int index) : bv_stmt(stmt), bv_index(index)
120✔
68
    {
69
    }
120✔
70

71
    void operator()(const std::string& str) const
87✔
72
    {
73
        sqlite3_bind_text(this->bv_stmt,
87✔
74
                          this->bv_index,
87✔
75
                          str.c_str(),
76
                          str.size(),
87✔
77
                          SQLITE_TRANSIENT);
78
    }
87✔
79

80
    void operator()(const string_fragment& str) const
2✔
81
    {
82
        sqlite3_bind_text(this->bv_stmt,
2✔
83
                          this->bv_index,
2✔
84
                          str.data(),
85
                          str.length(),
86
                          SQLITE_TRANSIENT);
87
    }
2✔
88

89
    void operator()(null_value_t) const
1✔
90
    {
91
        sqlite3_bind_null(this->bv_stmt, this->bv_index);
1✔
92
    }
1✔
93

94
    void operator()(int64_t value) const
29✔
95
    {
96
        sqlite3_bind_int64(this->bv_stmt, this->bv_index, value);
29✔
97
    }
29✔
98

99
    void operator()(double value) const
1✔
100
    {
101
        sqlite3_bind_double(this->bv_stmt, this->bv_index, value);
1✔
102
    }
1✔
103

UNCOV
104
    void operator()(bool value) const
×
105
    {
UNCOV
106
        sqlite3_bind_int(this->bv_stmt, this->bv_index, value);
×
107
    }
108

109
    sqlite3_stmt* bv_stmt;
110
    int bv_index;
111
};
112

113
}  // namespace sqlitepp
114

115
#endif
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