4 #include <dballe/fwd.h> 5 #include <wreport/var.h> 41 static std::unique_ptr<DBConnectOptions>
create(
const std::string&
url);
47 static std::unique_ptr<DBConnectOptions>
test_create(
const char* backend=
nullptr);
101 static std::unique_ptr<DBImportOptions> create();
136 static std::unique_ptr<DBInsertOptions> create();
149 class Transaction :
public std::enable_shared_from_this<Transaction>
155 virtual void commit() = 0;
202 virtual std::shared_ptr<CursorData>
query_data(
const Query& query) = 0;
296 class DB:
public std::enable_shared_from_this<DB>
310 virtual std::shared_ptr<dballe::Transaction>
transaction(
bool readonly=
false) = 0;
virtual void rollback()=0
Roll back this transaction.
virtual std::shared_ptr< CursorMessage > query_messages(const Query &query)=0
Query the database returning the matching data as Message objects.
bool overwrite
Replace existing data.
Definition: db.h:94
std::vector< wreport::Varcode > varlist
If not empty, import only the given data values.
Definition: db.h:99
bool can_add_stations
If false, it will not create a missing station record, and only data for existing stations can be add...
Definition: db.h:134
virtual std::shared_ptr< CursorStationData > query_station_data(const Query &query)
Query the station variables in the database.
Options controlling how messages are imported in the database.
Definition: db.h:64
std::string report
Report name to use to import data.
Definition: db.h:73
virtual std::shared_ptr< CursorMessage > query_messages(const Query &query)
Query the database returning the matching data as Message objects.
bool import_attributes
Import variable attributes.
Definition: db.h:76
virtual void import_message(const Message &message, const DBImportOptions &opts=DBImportOptions::defaults)=0
Import a Message into the DB-All.e database.
virtual std::shared_ptr< CursorSummary > query_summary(const Query &query)=0
Query a summary of what the result would be for a query.
bool update_station
Update station information.
Definition: db.h:85
void insert_data(Data &vals, const DBInsertOptions &opts=DBInsertOptions::defaults)
Insert data values into the database.
virtual std::shared_ptr< CursorStation > query_stations(const Query &query)
Start a query on the station variables archive.
virtual std::shared_ptr< CursorSummary > query_summary(const Query &query)
Query a summary of what the result would be for a query.
virtual void insert_data(Data &data, const DBInsertOptions &opts=DBInsertOptions::defaults)=0
Insert data values into the database.
bool wipe
Wipe database on connection.
Definition: db.h:28
virtual std::shared_ptr< CursorStation > query_stations(const Query &query)=0
Start a query on the station variables archive.
Options controlling how values are inserted in the database.
Definition: db.h:122
virtual void rollback_nothrow() noexcept=0
Roll back this transaction.
void reset_actions()
Disable all the one-off actions set to perform on connection.
virtual void remove_station_data(const Query &query)=0
Remove data from the database.
A bulletin that has been decoded and physically interpreted.
Definition: message.h:28
void remove_station_data(const Query &query)
Remove data from the database.
static std::shared_ptr< DB > connect(const DBConnectOptions &opts)
Create a new DB.
Key/value store where keys are strings and values are wreport variables.
Definition: data.h:17
virtual void insert_station_data(Data &data, const DBInsertOptions &opts=DBInsertOptions::defaults)=0
Insert station values into the database.
virtual std::shared_ptr< dballe::Transaction > transaction(bool readonly=false)=0
Begin a transaction on this database, and return a Transaction object that can be used to commit it...
void remove_data(const Query &query)
Remove data from the database.
std::string url
URL to use to connect to the database.
Definition: db.h:25
virtual void import_messages(const std::vector< std::shared_ptr< Message >> &messages, const DBImportOptions &opts=DBImportOptions::defaults)
Import Messages into the DB-All.e database.
virtual void commit()=0
Commit this transaction.
virtual std::shared_ptr< CursorData > query_data(const Query &query)
Query the database.
void import_messages(const std::vector< std::shared_ptr< Message >> &messages, const DBImportOptions &opts=DBImportOptions::defaults)
Import Messages into the DB-All.e database.
virtual std::shared_ptr< CursorStationData > query_station_data(const Query &query)=0
Query the station variables in the database.
virtual std::shared_ptr< CursorData > query_data(const Query &query)=0
Query the database.
virtual void remove_all()=0
Remove all data from the database.
virtual void remove_data(const Query &query)=0
Remove data from the database.
bool can_replace
If true, then existing data can be rewritten, else data can only be added.
Definition: db.h:126
void remove_all()
Remove all data from the database.
Query used to filter DB-All.e data.
Definition: query.h:14
void import_message(const Message &message, const DBImportOptions &opts=DBImportOptions::defaults)
Import a Message into the DB-All.e database.
void insert_station_data(Data &vals, const DBInsertOptions &opts=DBInsertOptions::defaults)
Insert station values into the database.
static std::unique_ptr< DBConnectOptions > create(const std::string &url)
Create a DBConnectOptions parsing the given URL.
Options controlling how to connect to a database.
Definition: db.h:17
static std::unique_ptr< DBConnectOptions > test_create(const char *backend=nullptr)
Create a DBConnectOptions for running unit tests.