12#ifndef settings_Writable_Database_declared
13#define settings_Writable_Database_declared
26 class Memory_Database;
31 friend class detail::Client_Data;
42 void check_single_row();
48 const std::string &name,
52 void create_table(
const std::string &name)
override;
58 bool perform_initialization
110 journal.
insert_into(Table_Id(1), result.get_record_id());
114 void insert_settings(id_of_settings
id)
119 journal.
insert_into(Table_Id(1),
id.get_record_id());
122 id_of_settings new_settings
124 bool field_value_of_dark_mode,
125 std::string_view field_value_of_host,
126 std::string_view field_value_of_user
129 auto result = new_settings();
131 set_host(result, field_value_of_host);
132 set_user(result, field_value_of_user);
140 journal.update_boolean(Table_Id(1), record.
get_record_id(), Field_Id(1), field_value_of_dark_mode);
151 journal.update_string(Table_Id(1), record.
get_record_id(), Field_Id(2), field_value_of_host);
154 void set_host(std::string_view field_value_of_host)
162 journal.update_string(Table_Id(1), record.
get_record_id(), Field_Id(3), field_value_of_user);
165 void set_user(std::string_view field_value_of_user)
std::string read_blob(Blob blob) const
const Abstract_File & get_file() const
void soft_checkpoint() override
int64_t ahead_of_checkpoint() const noexcept
void hard_checkpoint() override
void insert_into(Table_Id table_id, Record_Id record_id) override
Blob write_blob(std::string_view data) override
Handle concurrent access to a joedb::Abstract_File using a joedb::Connection.
implement joedb::Writable in a Database
void comment(const std::string &comment) override
void timestamp(int64_t timestamp) override
static constexpr id_of_settings the_settings()
void internal_update_settings__dark_mode(Record_Id record_id, bool field_value_of_dark_mode)
void internal_insert_settings(Record_Id record_id)
void internal_update_settings__user(Record_Id record_id, std::string_view field_value_of_user)
void internal_update_settings__host(Record_Id record_id, std::string_view field_value_of_host)
detail::data_of_settings storage_of_settings
Shortcut to directly build a Writable_Database with a Memory_File.
Write simultaneously to the database and the file (ignore schema changes)
A Database that contains a joedb::Writable_Journal and keeps them in sync.
void set_dark_mode(id_of_settings record, bool field_value_of_dark_mode)
void set_dark_mode(bool field_value_of_dark_mode)
void set_host(id_of_settings record, std::string_view field_value_of_host)
void write_comment(const std::string &comment)
std::string read_blob(joedb::Blob blob) const
const joedb::Readonly_Journal & get_journal() const
void set_user(std::string_view field_value_of_user)
joedb::Blob write_blob(std::string_view data) override
void set_host(std::string_view field_value_of_host)
void set_user(id_of_settings record, std::string_view field_value_of_user)
void soft_checkpoint() override
int64_t ahead_of_checkpoint() const
void hard_checkpoint() override
Strongly-typed wrapper around an integer representing a row of the settings table.
constexpr Record_Id get_record_id() const
Automatically generated by joedbc.