12#ifndef settings_Writable_Database_declared
13#define settings_Writable_Database_declared
31 friend class detail::Client_Data;
41 void check_single_row();
47 const std::string &name,
51 void create_table(
const std::string &name)
override;
57 bool perform_initialization
109 journal.
insert_into(Table_Id(1), result.get_record_id());
113 id_of_settings new_settings
115 bool field_value_of_dark_mode,
116 const std::string& field_value_of_host,
117 const std::string& field_value_of_user
120 auto result = new_settings();
122 set_host(result, field_value_of_host);
123 set_user(result, field_value_of_user);
131 journal.update_boolean(Table_Id(1), record.
get_record_id(), Field_Id(1), field_value_of_dark_mode);
136 std::exception_ptr exception;
139 catch (...) {exception = std::current_exception();}
141 journal.update_vector_boolean(Table_Id(1), record.
get_record_id(), Field_Id(1), size, (span.
begin()));
143 std::rethrow_exception(exception);
149 journal.update_string(Table_Id(1), record.
get_record_id(), Field_Id(2), field_value_of_host);
154 std::exception_ptr exception;
157 catch (...) {exception = std::current_exception();}
159 journal.update_vector_string(Table_Id(1), record.
get_record_id(), Field_Id(2), size, (span.
begin()));
161 std::rethrow_exception(exception);
167 journal.update_string(Table_Id(1), record.
get_record_id(), Field_Id(3), field_value_of_user);
172 std::exception_ptr exception;
175 catch (...) {exception = std::current_exception();}
177 journal.update_vector_string(Table_Id(1), record.
get_record_id(), Field_Id(3), size, (span.
begin()));
179 std::rethrow_exception(exception);
const Buffered_File & get_file() const
void soft_checkpoint() override
Blob write_blob(const std::string &data) override
int64_t ahead_of_checkpoint() const noexcept
void hard_checkpoint() override
void insert_into(Table_Id table_id, Record_Id record_id) override
Handle concurrent access to a joedb::Buffered_File using a joedb::Connection.
implement joedb::Writable in a Database
void comment(const std::string &comment) override
void timestamp(int64_t timestamp) override
void internal_update_vector_settings__dark_mode(Record_Id record_id, size_t size, const char *value)
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_vector_settings__user(Record_Id record_id, size_t size, const std::string *value)
void internal_update_settings__host(Record_Id record_id, const std::string &field_value_of_host)
void internal_update_vector_settings__host(Record_Id record_id, size_t size, const std::string *value)
detail::data_of_settings storage_of_settings
void internal_update_settings__user(Record_Id record_id, const std::string &field_value_of_user)
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 write_comment(const std::string &comment)
std::string read_blob(joedb::Blob blob) const
const joedb::Readonly_Journal & get_journal() const
void update_vector_of_dark_mode(id_of_settings record, size_t size, F f)
void set_user(id_of_settings record, const std::string &field_value_of_user)
void update_vector_of_host(id_of_settings record, size_t size, F f)
joedb::Blob write_blob(const std::string &data) override
void set_host(id_of_settings record, const std::string &field_value_of_host)
void soft_checkpoint() override
int64_t ahead_of_checkpoint() const
void hard_checkpoint() override
void update_vector_of_user(id_of_settings record, size_t size, F f)
Strongly-typed wrapper around an integer representing a row of the settings table.
constexpr Record_Id get_record_id() const
constexpr auto get_id() const
Automatically generated by joedbc.