12#ifndef tutorial_Database_Writable_declared
13#define tutorial_Database_Writable_declared
29 extern const char * schema_string;
30 inline constexpr size_t schema_string_size = 99;
33 class container_of_city;
34 class container_of_person;
45 if (table_id == Table_Id(1))
47 else if (table_id == Table_Id(2))
55 if (table_id == Table_Id(1))
63 else if (table_id == Table_Id(2))
82 if (table_id == Table_Id(1))
84 else if (table_id == Table_Id(2))
103 to_underlying(record_id) < 0 ||
109 if (table_id == Table_Id(1))
115 else if (table_id == Table_Id(2))
128 const std::string& value
132 if (table_id == Table_Id(1))
134 if (field_id == Field_Id(1))
141 if (table_id == Table_Id(2))
143 if (field_id == Field_Id(1))
148 if (field_id == Field_Id(2))
166 if (table_id == Table_Id(2))
168 if (field_id == Field_Id(3))
183 const std::string *value
187 if (table_id == Table_Id(1))
189 if (field_id == Field_Id(1))
196 if (table_id == Table_Id(2))
198 if (field_id == Field_Id(1))
203 if (field_id == Field_Id(2))
222 if (table_id == Table_Id(2))
224 if (field_id == Field_Id(3))
242 if (table_id == Table_Id(1))
245 if (field_id == Field_Id(1))
247 return (
storage_of_city.field_value_of_name.data() + to_underlying(record_id));
251 if (table_id == Table_Id(2))
254 if (field_id == Field_Id(1))
256 return (
storage_of_person.field_value_of_first_name.data() + to_underlying(record_id));
258 if (field_id == Field_Id(2))
260 return (
storage_of_person.field_value_of_last_name.data() + to_underlying(record_id));
276 if (table_id == Table_Id(2))
279 if (field_id == Field_Id(3))
308 schema_file_size < pos ||
309 schema_file_size > detail::schema_string_size ||
313 detail::schema_string + pos,
314 schema_file_size - pos
338 const std::string &name
348 const std::string &name,
356 void drop_field(Table_Id table_id, Field_Id field_id)
override
366 const std::string &name
373 void custom(
const std::string &name)
override
404 throw_exception<joedb::Out_Of_Date>(
"Schema is out of date. Can't upgrade a read-only database.");
bool is_used_vector(Record_Id index, size_t size) const
void replay_log(Writable &writable)
int64_t get_checkpoint() const
void add_field(Table_Id table_id, const std::string &name, Type type) override
void soft_checkpoint() override
void custom(const std::string &name) override
void create_table(const std::string &name) override
void rename_table(Table_Id table_id, const std::string &name) override
void drop_table(Table_Id table_id) override
void rename_field(Table_Id table_id, Field_Id field_id, const std::string &name) override
void drop_field(Table_Id table_id, Field_Id field_id) override
Superclass with all joedb journal event listeners as virtual functions.
virtual void delete_vector(Table_Id table_id, Record_Id record_id, size_t size)=0
implement joedb::Writable in a Database
joedb::index_t max_record_id
joedb::Record_Id * get_own_reference_storage(Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
std::string * get_own_string_storage(Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
void update_vector_reference(Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const joedb::Record_Id *value) override
void set_max_record_id(joedb::index_t record_id)
void initialize_with_readonly_journal(joedb::Readonly_Journal &journal)
void valid_data() override
void rename_table(Table_Id table_id, const std::string &name) override
void custom(const std::string &name) override
void delete_vector(Table_Id table_id, Record_Id record_id, size_t size) override
void drop_field(Table_Id table_id, Field_Id field_id) override
void timestamp(int64_t timestamp) override
Table_Id current_table_id
void drop_table(Table_Id table_id) override
void insert_into(Table_Id table_id, Record_Id record_id) override
void comment(const std::string &comment) override
joedb::Memory_File schema_file
void update_string(Table_Id table_id, Record_Id record_id, Field_Id field_id, const std::string &value) override
void update_reference(Table_Id table_id, Record_Id record_id, Field_Id field_id, joedb::Record_Id value) override
int64_t get_schema_checkpoint() const
void insert_vector(Table_Id table_id, Record_Id record_id, size_t size) override
void add_field(Table_Id table_id, const std::string &name, joedb::Type type) override
void rename_field(Table_Id table_id, Field_Id field_id, const std::string &name) override
void update_vector_string(Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const std::string *value) override
joedb::Writable_Journal schema_journal
void create_table(const std::string &name) override
bool requires_schema_upgrade() const
void delete_from(Table_Id table_id, Record_Id record_id) override
Store all the tables of the database.
void internal_update_vector_person__first_name(Record_Id record_id, size_t size, const std::string *value)
void internal_update_vector_city__name(Record_Id record_id, size_t size, const std::string *value)
void internal_insert_person(Record_Id record_id)
void internal_update_vector_person__home(Record_Id record_id, size_t size, const id_of_city *value)
detail::data_of_city storage_of_city
detail::data_of_person storage_of_person
void internal_update_vector_person__last_name(Record_Id record_id, size_t size, const std::string *value)
void internal_update_person__home(Record_Id record_id, id_of_city field_value_of_home)
bool is_valid_record_id_for_city(Record_Id record_id) const
static void throw_exception(const std::string &message)
bool is_valid_record_id_for_person(Record_Id record_id) const
void internal_update_person__first_name(Record_Id record_id, const std::string &field_value_of_first_name)
void internal_update_person__last_name(Record_Id record_id, const std::string &field_value_of_last_name)
void internal_insert_city(Record_Id record_id)
void internal_update_city__name(Record_Id record_id, const std::string &field_value_of_name)
void internal_delete_person(Record_Id record_id)
void internal_delete_city(Record_Id record_id)
void internal_vector_insert_city(Record_Id record_id, size_t size)
void internal_vector_insert_person(Record_Id record_id, size_t size)
Strongly-typed wrapper around an integer representing a row of the city table.
#define JOEDB_RELEASE_ASSERT(x)
always-tested assertion (release and debug mode)
Automatically generated by joedbc.