26 #include <dballe/db/mem/repinfo.h>
27 #include <dballe/memdb/memdb.h>
28 #include <wreport/varinfo.h>
60 std::string serialization_dir;
62 size_t m_last_station_id;
67 wreport::Varcode code;
71 VarID(wreport::Varcode code,
bool station,
size_t id) : code(code), station(station), id(
id) {}
88 DB(
const std::string& arg);
91 db::Format
format()
const {
return MEM; }
106 void reset(
const char* repinfo_file = 0);
125 void update_repinfo(
const char* repinfo_file,
int* added,
int* deleted,
int* updated);
143 void insert(
const Record& rec,
bool can_replace,
bool station_can_add);
154 void remove(
const Record& rec);
210 unsigned query_attrs(
int id_data, wreport::Varcode id_var,
const db::AttrList& qcs,
Record& attrs);
227 void attr_remove(
int id_data, wreport::Varcode id_var,
const db::AttrList& qcs);
243 void import_msg(
const Msg& msg,
const char* repmemo,
int flags);
259 void dump(FILE* out);
void dump(FILE *out)
Dump the entire contents of the database to an output stream.
void vacuum()
Remove orphan values from the database.
db::Format format() const
Return the format of this DB.
Definition: mem/db.h:91
void reset(const char *repinfo_file=0)
Reset the database, removing all existing DBALLE tables and re-creating them empty.
std::map< std::string, int > get_repinfo_priorities()
Get a mapping between rep_memo and their priorities.
Storage for related physical data.
Definition: msg.h:119
In-memory database backend.
Definition: memdb.h:78
void raw_query_station_data(const Record &rec, memdb::Results< memdb::StationValue > &res)
Query station data, returning a list of Value IDs.
unsigned query_attrs(int id_data, wreport::Varcode id_var, const db::AttrList &qcs, Record &attrs)
Query attributes.
std::auto_ptr< db::Cursor > query_summary(const Record &rec)
Query a summary of what the result would be for a query.
DB-All.E record.
Definition: record.h:102
void raw_query_data(const Record &rec, memdb::Results< memdb::Value > &res)
Query data, returning a list of Value IDs.
int last_station_id() const
Return the station id for the last data that was inserted.
Functions used to connect to DB-All.e and insert, query and delete data.
void remove_all()
Remove all data from the database.
void import_msg(const Msg &msg, const char *repmemo, int flags)
Import a Msg message into the DB-All.e database.
void export_msgs(const Record &query, MsgConsumer &cons)
Perform the query in `query', and return the results as a NULL-terminated array of dba_msg...
void update_repinfo(const char *repinfo_file, int *added, int *deleted, int *updated)
Update the repinfo table in the database, with the data found in the given file.
void raw_query_stations(const Record &rec, memdb::Results< memdb::Station > &res)
Query stations, returning a list of station IDs.
std::auto_ptr< db::Cursor > query_data(const Record &rec)
Query the database.
void attr_remove(int id_data, wreport::Varcode id_var, const db::AttrList &qcs)
Delete QC data for the variable `var' in record `rec' (coming from a previous dba_query) ...
std::auto_ptr< db::Cursor > query_stations(const Record &query)
Start a query on the station archive.
Store information about the database ID of a variable.
Definition: mem/db.h:65
Definition: db/mem/repinfo.h:33
Consumer interface used to stream messages as they are produced.
Definition: msg.h:478
void disappear()
Remove all our traces from the database, if applicable.
std::vector< VarID > last_insert_varids
Store database variable IDs for all last inserted variables.
Definition: mem/db.h:75
Memdb memdb
In-memory database backend.
Definition: mem/db.h:56
DB-ALLe database connection.
Definition: mem/db.h:52
void attr_insert(wreport::Varcode id_var, const Record &attrs)
Insert new attributes into the database, reusing the reference IDs stored by the last insert...
void insert(const Record &rec, bool can_replace, bool station_can_add)
Insert a record into the database.