#include <db.h>
Public Member Functions | |
DB (dba_db db) | |
Wraps an existing dba_db, taking charge of memory allocation. | |
DB (const std::string &dsn, const std::string &user, const std::string &password) | |
Create a dba_db connecting to a database with the given parameters. | |
void | disconnect () |
Explicitly disconnect from the database. | |
void | reset (const std::string &repinfo_file=std::string()) |
Wipe the database and reinitialize it, taking the initial repinfo values from the given file, or from the default repinfo.csv. | |
Cursor | queryAna (const Record &query) |
Query pseudoana information, retrieving the extra pseudoana info for every station. | |
Cursor | query (const Record &query) |
Query data values. | |
Cursor | queryAnaSummary (const Record &query) |
Query pseudoana information, without retrieving the extra pseudoana info. | |
Cursor | queryLevels (const Record &query) |
Query the list of levels present in the database. | |
Cursor | queryTimeRanges (const Record &query) |
Query the list of time ranges for which there is data in the database. | |
Cursor | queryLevelsAndTimeRanges (const Record &query) |
Query the list of levels and time ranges for which there is data in the database. | |
Cursor | queryVariableTypes (const Record &query) |
Query the list of variable types present in the database. | |
Cursor | queryIdents (const Record &query) |
Query the list of movable station identifiers present in the database. | |
Cursor | queryReports (const Record &query) |
Query the report information for which there is data in the database. | |
Cursor | queryDateTimes (const Record &query) |
Query the list of date and times for which there is data in the database. | |
int | attrQuery (int context, dba_varcode var, Record &res) const |
Query the attributes for the given variable in the given context. | |
int | attrQuery (int context, dba_varcode var, const std::vector< dba_varcode > &wanted, Record &res) const |
Query the attributes for the given variable in the given context. | |
int | insert (Record &rec, bool canReplace, bool addToPseudoana, int *anaid=NULL) |
Insert values from a record into the database. | |
void | attrInsert (int context, dba_varcode var, Record &data) |
void | attrInsertCurrent (const Cursor &cur, Record &data) |
void | attrInsertNew (int context, dba_varcode var, Record &data) |
void | attrInsertNewCurrent (const Cursor &cur, Record &data) |
void | remove (const Record &query) |
Remove from the database all the values that match the given query. | |
void | removeOrphans () |
Remove all the pseudoana and context entries which have no data. | |
void | attrRemove (int context, dba_varcode var, dba_varcode attr) |
void | attrRemoveAll (int context, dba_varcode var) |
void | attrRemoveList (int context, dba_varcode var, const std::vector< dba_varcode > &attrs) |
void | exportResults (Record &query, dba_encoding encoding, const std::string &file) |
Export the results of a query to a file, using the given encoding. | |
void | exportResultsAsGeneric (Record &query, dba_encoding encoding, const std::string &file) |
Export the results of a query to a file, using the given encoding and a generic BUFR and CREX template. | |
const dba_db | db () const |
Access the underlying dba_db. | |
dba_db | db () |
Access the underlying dba_db. |
void dballe::DB::disconnect | ( | ) | [inline] |
Explicitly disconnect from the database.
This is normally performed in the contructor, but an explicit disconnect is needed to support language bindings, such as python previously to 2.5, with unpredictable object destruction patterns.
int dballe::DB::insert | ( | Record & | rec, | |
bool | canReplace, | |||
bool | addToPseudoana, | |||
int * | anaid = NULL | |||
) | [inline] |
Insert values from a record into the database.
rec | The record with the values to insert. | |
canReplace | True if existing values can be replaced. | |
addToPseudoana | True if a nonexisting pseudoana entry can be created. |
anaid | If a pseudoana entry has been created, this is its database ID. |
References dballe::Record::rec().