Definition at line 348 of file inbox.cpp.
◆ database() [1/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
const fs::path & | path, |
|
|
const bool | writable ) |
|
inline |
Definition at line 350 of file inbox.cpp.
350 {
351 const std::string
native = path.string();
352 const int flags = writable
353 ? SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
354 : SQLITE_OPEN_READONLY | SQLITE_OPEN_FULLMUTEX;
355 if (sqlite3_open_v2(
native.c_str(), &
value_, flags,
nullptr)
356 != SQLITE_OK) {
361 }
362 throw database_error(message);
363 }
364 sqlite3_extended_result_codes(
value_, 1);
365 sqlite3_busy_timeout(
value_, 10'000);
366 execute(
"PRAGMA foreign_keys = ON");
367 statement version(
value_,
"PRAGMA user_version");
369 throw database_error(
370 "product database must use schema version 5"
371 );
372 }
374 }
sqlite3 * native() const noexcept
void execute(const std::string_view sql)
constexpr int current_product_schema
void require_current_product_structure(sqlite3 *const sql)
std::string sqlite_message(sqlite3 *const value, const std::string_view operation)
References arachne::penelope::anonymous_namespace{inbox.cpp}::current_product_schema, arachne::penelope::anonymous_namespace{inbox.cpp}::statement::integer(), arachne::penelope::anonymous_namespace{inbox.cpp}::require_current_product_structure(), arachne::penelope::anonymous_namespace{inbox.cpp}::statement::step(), and value_.
Referenced by arachne::penelope::rebuild_product_merge_hints(), and arachne::penelope::anonymous_namespace{inbox.cpp}::run_inbox().
◆ database() [2/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
const database & | | ) |
|
|
delete |
◆ database() [3/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
database && | | ) |
|
|
delete |
◆ ~database() [1/2]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::~database |
( |
| ) |
|
|
inline |
◆ database() [4/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
const fs::path & | path, |
|
|
const bool | writable ) |
|
inline |
Definition at line 350 of file inbox.cpp.
350 {
351 const std::string
native = path.string();
352 const int flags = writable
353 ? SQLITE_OPEN_READWRITE | SQLITE_OPEN_FULLMUTEX
354 : SQLITE_OPEN_READONLY | SQLITE_OPEN_FULLMUTEX;
355 if (sqlite3_open_v2(
native.c_str(), &
value_, flags,
nullptr)
356 != SQLITE_OK) {
361 }
362 throw database_error(message);
363 }
364 sqlite3_extended_result_codes(
value_, 1);
365 sqlite3_busy_timeout(
value_, 10'000);
366 execute(
"PRAGMA foreign_keys = ON");
367 statement version(
value_,
"PRAGMA user_version");
369 throw database_error(
370 "product database must use schema version 5"
371 );
372 }
374 }
◆ database() [5/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
const database & | | ) |
|
|
delete |
◆ database() [6/6]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::database |
( |
database && | | ) |
|
|
delete |
◆ ~database() [2/2]
| arachne::penelope::anonymous_namespace{inbox.cpp}::database::~database |
( |
| ) |
|
|
inline |
◆ execute() [1/2]
| void arachne::penelope::anonymous_namespace{inbox.cpp}::database::execute |
( |
const std::string_view | sql | ) |
|
|
inline |
Definition at line 387 of file inbox.cpp.
387 {
388 char* error = nullptr;
389 const int status = sqlite3_exec(
390 value_, std::string(sql).c_str(),
nullptr,
nullptr, &error
391 );
392 if (status != SQLITE_OK) {
393 std::string message = error == nullptr
396 sqlite3_free(error);
397 throw database_error(message);
398 }
399 }
References value_.
◆ execute() [2/2]
| void arachne::penelope::anonymous_namespace{inbox.cpp}::database::execute |
( |
const std::string_view | sql | ) |
|
|
inline |
Definition at line 387 of file inbox.cpp.
387 {
388 char* error = nullptr;
389 const int status = sqlite3_exec(
390 value_, std::string(sql).c_str(),
nullptr,
nullptr, &error
391 );
392 if (status != SQLITE_OK) {
393 std::string message = error == nullptr
396 sqlite3_free(error);
397 throw database_error(message);
398 }
399 }
◆ native() [1/2]
| sqlite3 * arachne::penelope::anonymous_namespace{inbox.cpp}::database::native |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ native() [2/2]
| sqlite3 * arachne::penelope::anonymous_namespace{inbox.cpp}::database::native |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ operator=() [1/4]
| database & arachne::penelope::anonymous_namespace{inbox.cpp}::database::operator= |
( |
const database & | | ) |
|
|
delete |
◆ operator=() [2/4]
| database & arachne::penelope::anonymous_namespace{inbox.cpp}::database::operator= |
( |
const database & | | ) |
|
|
delete |
◆ operator=() [3/4]
| database & arachne::penelope::anonymous_namespace{inbox.cpp}::database::operator= |
( |
database && | | ) |
|
|
delete |
◆ operator=() [4/4]
| database & arachne::penelope::anonymous_namespace{inbox.cpp}::database::operator= |
( |
database && | | ) |
|
|
delete |
◆ value_
| sqlite3 * arachne::penelope::anonymous_namespace{inbox.cpp}::database::value_ { nullptr } |
|
private |
The documentation for this class was generated from the following file: