Joedb 10.0.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tutorial::Database_Writable Class Reference

implement joedb::Writable in a Database More...

#include <tutorial/Database_Writable.h>

Inheritance diagram for tutorial::Database_Writable:
Inheritance graph
[legend]
Collaboration diagram for tutorial::Database_Writable:
Collaboration graph
[legend]

Public Member Functions

 Database_Writable ()
 
void set_max_record_id (joedb::index_t record_id)
 
int64_t get_schema_checkpoint () const
 
void initialize_with_readonly_journal (joedb::Readonly_Journal &journal)
 
- Public Member Functions inherited from tutorial::Database
bool is_valid (id_of_city id) const
 
bool is_valid (id_of_person id) const
 
container_of_city get_city_table () const
 
id_of_city next (id_of_city id) const
 
id_of_city previous (id_of_city id) const
 
template<class Comparator >
std::vector< id_of_citysorted_city (Comparator comparator) const
 
const std::string & get_name (id_of_city record) const
 
container_of_person get_person_table () const
 
id_of_person next (id_of_person id) const
 
id_of_person previous (id_of_person id) const
 
template<class Comparator >
std::vector< id_of_personsorted_person (Comparator comparator) const
 
const std::string & get_first_name (id_of_person record) const
 
const std::string & get_last_name (id_of_person record) const
 
id_of_city get_home (id_of_person record) const
 
const std::map< std::string, id_of_city > & get_index_of_city_by_name ()
 
const std::multimap< std::tuple< std::string, std::string >, id_of_person > & get_index_of_person_by_name ()
 
id_of_city next_city_by_name (id_of_city id)
 
id_of_city previous_city_by_name (id_of_city id)
 
id_of_city find_city_by_name (const std::string &field_value_of_name) const
 
range_of_person_by_name find_person_by_name (const std::string &field_value_of_last_name, const std::string &field_value_of_first_name) const
 
- Public Member Functions inherited from joedb::Writable
virtual int64_t get_position () const
 
virtual void start_writing (int64_t position)
 
virtual void end_writing (int64_t position)
 
virtual void soft_checkpoint ()
 
virtual void hard_checkpoint ()
 
virtual void drop_table (Table_Id table_id)
 
virtual void rename_table (Table_Id table_id, const std::string &name)
 
virtual void add_field (Table_Id table_id, const std::string &name, Type type)
 
virtual void drop_field (Table_Id table_id, Field_Id field_id)
 
virtual void rename_field (Table_Id table_id, Field_Id field_id, const std::string &name)
 
virtual void flush ()
 
virtual void insert_into (Table_Id table_id, Record_Id record_id)
 
virtual void delete_from (Table_Id table_id, Record_Id record_id)
 
virtual void insert_vector (Table_Id table_id, Record_Id record_id, size_t size)=0
 
virtual void delete_vector (Table_Id table_id, Record_Id record_id, size_t size)=0
 
virtual void on_blob (Blob blob)
 
virtual bool wants_blob_data () const
 
virtual Blob write_blob (const std::string &data)
 
virtual ~Writable ()=default
 

Protected Member Functions

void delete_from (Table_Id table_id, Record_Id record_id) override
 
void insert_into (Table_Id table_id, Record_Id record_id) override
 
void delete_vector (Table_Id table_id, Record_Id record_id, size_t size) override
 
void insert_vector (Table_Id table_id, Record_Id record_id, size_t size) override
 
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
 
void update_vector_string (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const std::string *value) 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
 
std::string * get_own_string_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
 
joedb::Record_Idget_own_reference_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
 
void comment (const std::string &comment) override
 
void timestamp (int64_t timestamp) override
 
void valid_data () override
 
bool requires_schema_upgrade () const
 
void check_schema ()
 
void create_table (const std::string &name) override
 
void drop_table (Table_Id table_id) override
 
void rename_table (Table_Id table_id, const std::string &name) override
 
void add_field (Table_Id table_id, const std::string &name, joedb::Type type) override
 
void drop_field (Table_Id table_id, Field_Id field_id) override
 
void rename_field (Table_Id table_id, Field_Id field_id, const std::string &name) override
 
void custom (const std::string &name) override
 
- Protected Member Functions inherited from tutorial::Database
bool is_valid_record_id_for_city (Record_Id record_id) const
 
bool is_valid_record_id_for_person (Record_Id record_id) const
 
void remove_index_of_city_by_name (Record_Id record_id)
 
void add_index_of_city_by_name (Record_Id record_id)
 
void remove_index_of_person_by_name (Record_Id record_id)
 
void add_index_of_person_by_name (Record_Id record_id)
 
void internal_delete_city (Record_Id record_id)
 
void internal_delete_person (Record_Id record_id)
 
void internal_insert_city (Record_Id record_id)
 
void internal_vector_insert_city (Record_Id record_id, size_t size)
 
void internal_insert_person (Record_Id record_id)
 
void internal_vector_insert_person (Record_Id record_id, size_t size)
 
void internal_update_city__name (Record_Id record_id, const std::string &field_value_of_name)
 
void internal_update_vector_city__name (Record_Id record_id, size_t size, const std::string *value)
 
void internal_update_person__first_name (Record_Id record_id, const std::string &field_value_of_first_name)
 
void internal_update_vector_person__first_name (Record_Id record_id, size_t size, const std::string *value)
 
void internal_update_person__last_name (Record_Id record_id, const std::string &field_value_of_last_name)
 
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)
 
void internal_update_vector_person__home (Record_Id record_id, size_t size, const id_of_city *value)
 

Protected Attributes

joedb::index_t max_record_id
 
Table_Id current_table_id = Table_Id{0}
 
bool upgrading_schema = false
 
joedb::Memory_File schema_file
 
joedb::Writable_Journal schema_journal
 
- Protected Attributes inherited from tutorial::Database
detail::data_of_city storage_of_city
 
detail::data_of_person storage_of_person
 
std::map< std::string, id_of_cityindex_of_city_by_name
 
std::multimap< std::tuple< std::string, std::string >, id_of_personindex_of_person_by_name
 

Additional Inherited Members

- Static Public Member Functions inherited from tutorial::Database
template<typename E = joedb::Exception>
static void throw_exception (const std::string &message)
 
static id_of_city null_city ()
 
static id_of_person null_person ()
 

Detailed Description

Definition at line 37 of file Database_Writable.h.

Constructor & Destructor Documentation

◆ Database_Writable()

tutorial::Database_Writable::Database_Writable ( )
inline

Definition at line 380 of file Database_Writable.h.

Member Function Documentation

◆ add_field()

void tutorial::Database_Writable::add_field ( Table_Id  table_id,
const std::string &  name,
joedb::Type  type 
)
inlineoverrideprotected

Definition at line 345 of file Database_Writable.h.

◆ check_schema()

void tutorial::Database_Writable::check_schema ( )
inlineprotected

Definition at line 301 of file Database_Writable.h.

◆ comment()

void tutorial::Database_Writable::comment ( const std::string &  comment)
inlineoverrideprotectedvirtual

Reimplemented from joedb::Writable.

Definition at line 288 of file Database_Writable.h.

◆ create_table()

void tutorial::Database_Writable::create_table ( const std::string &  name)
inlineoverrideprotectedvirtual

Reimplemented from joedb::Writable.

Definition at line 322 of file Database_Writable.h.

◆ custom()

void tutorial::Database_Writable::custom ( const std::string &  name)
inlineoverrideprotectedvirtual

Reimplemented from joedb::Writable.

Definition at line 373 of file Database_Writable.h.

◆ delete_from()

void tutorial::Database_Writable::delete_from ( Table_Id  table_id,
Record_Id  record_id 
)
inlineoverrideprotected

Definition at line 43 of file Database_Writable.h.

◆ delete_vector()

void tutorial::Database_Writable::delete_vector ( Table_Id  table_id,
Record_Id  record_id,
size_t  size 
)
inlineoverrideprotected

Definition at line 73 of file Database_Writable.h.

◆ drop_field()

void tutorial::Database_Writable::drop_field ( Table_Id  table_id,
Field_Id  field_id 
)
inlineoverrideprotected

Definition at line 356 of file Database_Writable.h.

◆ drop_table()

void tutorial::Database_Writable::drop_table ( Table_Id  table_id)
inlineoverrideprotected

Definition at line 329 of file Database_Writable.h.

◆ get_own_reference_storage()

joedb::Record_Id * tutorial::Database_Writable::get_own_reference_storage ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
size_t &  capacity 
)
inlineoverrideprotected

Definition at line 267 of file Database_Writable.h.

◆ get_own_string_storage()

std::string * tutorial::Database_Writable::get_own_string_storage ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
size_t &  capacity 
)
inlineoverrideprotected

Definition at line 233 of file Database_Writable.h.

◆ get_schema_checkpoint()

int64_t tutorial::Database_Writable::get_schema_checkpoint ( ) const
inline

Definition at line 390 of file Database_Writable.h.

◆ initialize_with_readonly_journal()

void tutorial::Database_Writable::initialize_with_readonly_journal ( joedb::Readonly_Journal journal)
inline

Definition at line 395 of file Database_Writable.h.

◆ insert_into()

void tutorial::Database_Writable::insert_into ( Table_Id  table_id,
Record_Id  record_id 
)
inlineoverrideprotected

Definition at line 51 of file Database_Writable.h.

◆ insert_vector()

void tutorial::Database_Writable::insert_vector ( Table_Id  table_id,
Record_Id  record_id,
size_t  size 
)
inlineoverrideprotected

Definition at line 94 of file Database_Writable.h.

◆ rename_field()

void tutorial::Database_Writable::rename_field ( Table_Id  table_id,
Field_Id  field_id,
const std::string &  name 
)
inlineoverrideprotected

Definition at line 362 of file Database_Writable.h.

◆ rename_table()

void tutorial::Database_Writable::rename_table ( Table_Id  table_id,
const std::string &  name 
)
inlineoverrideprotected

Definition at line 335 of file Database_Writable.h.

◆ requires_schema_upgrade()

bool tutorial::Database_Writable::requires_schema_upgrade ( ) const
inlineprotected

Definition at line 296 of file Database_Writable.h.

◆ set_max_record_id()

void tutorial::Database_Writable::set_max_record_id ( joedb::index_t  record_id)
inline

Definition at line 385 of file Database_Writable.h.

◆ timestamp()

void tutorial::Database_Writable::timestamp ( int64_t  timestamp)
inlineoverrideprotectedvirtual

Reimplemented from joedb::Writable.

Definition at line 289 of file Database_Writable.h.

◆ update_reference()

void tutorial::Database_Writable::update_reference ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
joedb::Record_Id  value 
)
inlineoverrideprotected

Definition at line 157 of file Database_Writable.h.

◆ update_string()

void tutorial::Database_Writable::update_string ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
const std::string &  value 
)
inlineoverrideprotected

Definition at line 123 of file Database_Writable.h.

◆ update_vector_reference()

void tutorial::Database_Writable::update_vector_reference ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
size_t  size,
const joedb::Record_Id value 
)
inlineoverrideprotected

Definition at line 212 of file Database_Writable.h.

◆ update_vector_string()

void tutorial::Database_Writable::update_vector_string ( Table_Id  table_id,
Record_Id  record_id,
Field_Id  field_id,
size_t  size,
const std::string *  value 
)
inlineoverrideprotected

Definition at line 177 of file Database_Writable.h.

◆ valid_data()

void tutorial::Database_Writable::valid_data ( )
inlineoverrideprotectedvirtual

Reimplemented from joedb::Writable.

Definition at line 290 of file Database_Writable.h.

Member Data Documentation

◆ current_table_id

Table_Id tutorial::Database_Writable::current_table_id = Table_Id{0}
protected

Definition at line 41 of file Database_Writable.h.

◆ max_record_id

joedb::index_t tutorial::Database_Writable::max_record_id
protected

Definition at line 40 of file Database_Writable.h.

◆ schema_file

joedb::Memory_File tutorial::Database_Writable::schema_file
protected

Definition at line 293 of file Database_Writable.h.

◆ schema_journal

joedb::Writable_Journal tutorial::Database_Writable::schema_journal
protected

Definition at line 294 of file Database_Writable.h.

◆ upgrading_schema

bool tutorial::Database_Writable::upgrading_schema = false
protected

Definition at line 292 of file Database_Writable.h.


The documentation for this class was generated from the following file: