libdballe  9.11
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
dballe::db::v7::DataCommon< Traits > Class Template Referenceabstract

Public Member Functions

 DataCommon (v7::Transaction &tr)
 
virtual void read_attrs (Tracer<> &trc, int id_data, std::function< void(std::unique_ptr< wreport::Var >)> dest)=0
 Load from the database all the attributes for var. More...
 
void merge_attrs (Tracer<> &trc, int id_data, const Values &attrs)
 Merge the given attributes with the existing attributes of the given variable: More...
 
void remove_attrs (Tracer<> &trc, int data_id, const db::AttrList &attrs)
 Remove the given attributes from the given variable, if they exist.
 
virtual void update (Tracer<> &trc, std::vector< typename Traits::BatchValue > &vars, bool with_attrs)=0
 Bulk variable update.
 
virtual void remove (Tracer<> &trc, const v7::IdQueryBuilder &qb)=0
 Run the query to delete all records selected by the given QueryBuilder.
 
virtual void remove_by_id (Tracer<> &trc, int id)=0
 Run the query to delete the record with the given ID.
 
virtual void dump (FILE *out)=0
 Dump the entire contents of the table to an output stream.
 
virtual void clear_cache ()=0
 

Protected Types

typedef Traits::BatchValue BatchValue
 

Protected Member Functions

void read_attrs_into_values (Tracer<> &trc, int id_data, Values &values)
 Load attributes from the database into a Values.
 
void read_attrs_into_values (Tracer<> &trc, int id_data, Values &values, const db::AttrList &exclude)
 Load attributes from the database into a Values, except those whose Varcode is in exclude
 
virtual void write_attrs (Tracer<> &trc, int id_data, const Values &values)=0
 Replace the attributes of a variable with those in Values.
 
virtual void remove_all_attrs (Tracer<> &trc, int id_data)=0
 Remove all attributes from a variable.
 

Protected Attributes

v7::Transactiontr
 

Static Protected Attributes

static const char * table_name
 

Member Function Documentation

◆ merge_attrs()

template<typename Traits>
void dballe::db::v7::DataCommon< Traits >::merge_attrs ( Tracer<> &  trc,
int  id_data,
const Values attrs 
)

Merge the given attributes with the existing attributes of the given variable:

  • Existing attributes not in attrs are preserved.
  • Existing attributes in attrs are overwritten.
  • New attributes in attrs are inesrted.

◆ read_attrs()

template<typename Traits>
virtual void dballe::db::v7::DataCommon< Traits >::read_attrs ( Tracer<> &  trc,
int  id_data,
std::function< void(std::unique_ptr< wreport::Var >)>  dest 
)
pure virtual

Load from the database all the attributes for var.

Parameters
trcOperation tracer using for debugging and diagnostics
id_dataID of the data row for the value of which we will read attributes
destFunction that will be called to consume the attrbutes as they are loaded.

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