libdballe  9.11
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dballe::db::v7::LevTr Struct Referenceabstract

Precompiled queries to manipulate the lev_tr table. More...

#include <levtr.h>

Inheritance diagram for dballe::db::v7::LevTr:
dballe::db::v7::mysql::MySQLLevTr dballe::db::v7::postgresql::PostgreSQLLevTr dballe::db::v7::sqlite::SQLiteLevTr

Public Member Functions

 LevTr (v7::Transaction &tr)
 
void clear_cache ()
 Invalidate the LevTrEntry cache. More...
 
virtual void prefetch_ids (Tracer<> &trc, const std::set< int > &ids)=0
 Given a set of IDs, load LevTr information for them and add it to the cache.
 
impl::msg::Contextto_msg (Tracer<> &trc, int id, impl::Message &msg)
 Get/create a Context in the Msg for this level/timerange. More...
 
const LevTrEntrylookup_cache (int id)
 Lookup a LevTr entry from the cache, throwing an exception if it is not found.
 
virtual const LevTrEntrylookup_id (Tracer<> &trc, int id)=0
 Look up a LevTr from the database given its ID.
 
virtual int obtain_id (Tracer<> &trc, const LevTrEntry &desc)=0
 Look up a LevTr from the database given its description. More...
 
void dump (FILE *out)
 Dump the entire contents of the table to an output stream.
 

Protected Member Functions

virtual void _dump (std::function< void(int, const Level &, const Trange &)> out)=0
 

Protected Attributes

v7::Transactiontr
 
LevTrCache cache
 

Detailed Description

Precompiled queries to manipulate the lev_tr table.

Member Function Documentation

◆ clear_cache()

void dballe::db::v7::LevTr::clear_cache ( )

Invalidate the LevTrEntry cache.

Further accesses will be done via the database, and slowly repopulate the cache from scratch.

◆ obtain_id()

virtual int dballe::db::v7::LevTr::obtain_id ( Tracer<> &  trc,
const LevTrEntry desc 
)
pure virtual

Look up a LevTr from the database given its description.

Insert a new one if not found.

Implemented in dballe::db::v7::sqlite::SQLiteLevTr, dballe::db::v7::mysql::MySQLLevTr, and dballe::db::v7::postgresql::PostgreSQLLevTr.

◆ to_msg()

impl::msg::Context* dballe::db::v7::LevTr::to_msg ( Tracer<> &  trc,
int  id,
impl::Message msg 
)

Get/create a Context in the Msg for this level/timerange.

Returns
the context, or 0 if the id is not valid.

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