1#ifndef DBALLE_DB_V7_TRANSACTION_H
2#define DBALLE_DB_V7_TRANSACTION_H
5#include <dballe/db/v7/fwd.h>
6#include <dballe/db/v7/data.h>
7#include <dballe/db/v7/batch.h>
33 void track_cursor(std::weak_ptr<dballe::Cursor> cursor);
38 std::shared_ptr<v7::DB> db;
83 void remove_station_data_by_id(
int id);
84 void remove_data_by_id(
int id);
93 void update_repinfo(const
char* repinfo_file,
int* added,
int* deleted,
int* updated) override;
97 void dump(FILE* out) override;
102 using Transaction::Transaction;
Cursor iterating over messages.
Definition: cursor.h:118
Options controlling how messages are imported in the database.
Definition: db.h:65
Options controlling how values are inserted in the database.
Definition: db.h:123
A bulletin that has been decoded and physically interpreted.
Definition: message.h:29
Query used to filter DB-All.e data.
Definition: query.h:15
DB-ALLe database connection for database format V7.
Definition: db/v7/db.h:21
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:46
Functions used to connect to DB-All.e and insert, query and delete data.
Forward declarations for public dballe/sql names.
Collection of Value objects, indexed by wreport::Varcode.
Definition: values.h:177
Definition: db/v7/data.h:156
Precompiled queries to manipulate the lev_tr table.
Definition: levtr.h:21
Fast cached access to the repinfo table.
Definition: repinfo.h:72
Definition: db/v7/data.h:140
Definition: transaction.h:101
void commit() override
Commit this transaction.
Definition: transaction.h:16
void remove_all() override
Remove all data from the database.
v7::LevTr & levtr()
Access the levtr table.
std::shared_ptr< dballe::CursorStationData > query_station_data(const Query &query) override
Query the station variables in the database.
void remove_data(const Query &query) override
Remove data from the database.
void attr_query_data(int data_id, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Query attributes on a data value.
void import_messages(const std::vector< std::shared_ptr< Message > > &msgs, const dballe::DBImportOptions &opts) override
Import Messages into the DB-All.e database.
std::shared_ptr< dballe::CursorMessage > query_messages(const Query &query)
Query the database returning the matching data as Message objects.
void insert_station_data(dballe::Data &vals, const dballe::DBInsertOptions &opts=dballe::DBInsertOptions::defaults) override
Insert station values into the database.
void clear_cached_state() override
Clear state information cached during the transaction.
v7::StationData * m_station_data
Station data.
Definition: transaction.h:25
void attr_query_station(int data_id, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Query attributes on a station value.
v7::Repinfo & repinfo()
Access the repinfo table.
void attr_insert_data(int data_id, const Values &attrs) override
Insert new attributes on a data value.
void dump(FILE *out) override
Dump the entire contents of the database to an output stream.
void remove_station_data(const Query &query) override
Remove data from the database.
void update_repinfo(const char *repinfo_file, int *added, int *deleted, int *updated) override
Update the repinfo table in the database, with the data found in the given file.
v7::Tracer< v7::trace::Transaction > trc
Tracing system.
Definition: transaction.h:46
v7::Station & station()
Access the station table.
v7::Data * m_data
Variable data.
Definition: transaction.h:27
std::vector< std::weak_ptr< dballe::Cursor > > tracked_cursors
Track active cursors to invalidate them on commit/rollback.
Definition: transaction.h:30
void rollback() override
Roll back this transaction.
v7::StationData & station_data()
Access the station_data table.
void import_message(const Message &message, const dballe::DBImportOptions &opts) override
Import a Message into the DB-All.e database.
std::shared_ptr< dballe::CursorSummary > query_summary(const Query &query)
Query a summary of what the result would be for a query.
void attr_remove_data(int data_id, const db::AttrList &attrs) override
Delete attributes from a data value.
void rollback_nothrow() noexcept override
Roll back this transaction.
void attr_insert_station(int data_id, const Values &attrs) override
Insert new attributes on a station value.
v7::Data & data()
Access the data table.
void commit() override
Commit this transaction.
void attr_remove_station(int data_id, const db::AttrList &attrs) override
Delete attributes from a station value.
v7::Station * m_station
Station information.
Definition: transaction.h:21
bool fired
True if commit or rollback have already been called on this transaction.
Definition: transaction.h:42
void insert_data(dballe::Data &vals, const dballe::DBInsertOptions &opts=dballe::DBInsertOptions::defaults) override
Insert data values into the database.
std::shared_ptr< dballe::CursorStation > query_stations(const Query &query)
Start a query on the station variables archive.
v7::Repinfo * m_repinfo
Report information.
Definition: transaction.h:19
std::shared_ptr< dballe::sql::Transaction > sql_transaction
SQL-side transaction.
Definition: transaction.h:40
std::shared_ptr< dballe::CursorData > query_data(const Query &query)
Query the database.
v7::LevTr * m_levtr
Level/timerange information.
Definition: transaction.h:23
v7::Batch batch
Batch importer.
Definition: transaction.h:44