43 SQLite(
const SQLite &
from) =
delete;
44 SQLite& operator = (
const SQLite &
from) =
delete;
46 SQLite& operator = (SQLite &&
from)
noexcept { db =
from.db;
from.db = 0;
return *
this; }
48 operator sqlite3 * () {
return db; }
55 void exec(
const std::string & stmt);
57 uint64_t getLastInsertedRowId();
66 sqlite3_stmt * stmt = 0;
69 SQLiteStmt(sqlite3 * db,
const std::string & sql) { create(db, sql); }
70 void create(sqlite3 * db,
const std::string &
s);
72 operator sqlite3_stmt * () {
return stmt; }
79 friend struct SQLiteStmt;
82 unsigned int curArg = 1;
83 Use(SQLiteStmt & stmt);
93 Use &
operator () (
const unsigned char *
data,
size_t len,
bool notNull =
true);
110 std::string getStr(
int col);
111 int64_t getInt(
int col);
112 bool isNull(
int col);
130 SQLiteTxn(sqlite3 * db);
138struct SQLiteError : Error
142 int errNo, extendedErrNo, offset;
144 template<
typename...
Args>
145 [[noreturn]]
static void throw_(sqlite3 * db,
const std::string & fs,
const Args & ...
args) {
149 SQLiteError(
const char *path,
const char *errMsg,
int errNo,
int extendedErrNo,
int offset,
HintFmt && hf);
153 template<
typename...
Args>
154 SQLiteError(
const char *path,
const char *errMsg,
int errNo,
int extendedErrNo,
int offset,
const std::string & fs,
const Args & ...
args)
155 : SQLiteError(path, errMsg, errNo, extendedErrNo, offset,
HintFmt(fs,
args...))
158 [[noreturn]]
static void throw_(sqlite3 * db,
HintFmt && hf);
164void handleSQLiteBusy(
const SQLiteBusy & e, time_t & nextWarning);
170template<
typename T,
typename F>
173 time_t nextWarning = time(0) + 1;
178 }
catch (SQLiteBusy & e) {
179 handleSQLiteBusy(e, nextWarning);
bool next()
Definition sqlite.cc:196
void exec()
Definition sqlite.cc:188
Use & operator()(std::string_view value, bool notNull=true)
Definition sqlite.cc:146
This file defines two main structs/classes used in nix error handling.
return s
Definition lexer.l:459
std::function< void(Sink &)> fun
Definition lexer.l:3485
std::variant< std::string, std::string_view > data
Definition lexer.l:177
std::string std::string_view from
Definition lexer.l:2591
const T & value
Definition lexer.l:492
std::vector< Expr * > args
Definition lexer.l:6126
SQLiteOpenMode
Definition sqlite.hh:14
@ Immutable
Definition sqlite.hh:32
@ NoCreate
Definition sqlite.hh:24
@ Normal
Definition sqlite.hh:19
T retrySQLite(F &&fun)
Definition sqlite.hh:171
void isCache()
Definition sqlite.cc:93
std::string Path
Definition types.hh:22