libdballe
9.11
|
Public Member Functions | |
virtual db::Format | format () const =0 |
Return the format of this DB. | |
virtual void | disappear ()=0 |
Remove all our traces from the database, if applicable. More... | |
virtual void | reset (const char *repinfo_file=0)=0 |
Reset the database, removing all existing Db-All.e tables and re-creating them empty. More... | |
virtual std::shared_ptr< dballe::db::Transaction > | test_transaction (bool readonly=false)=0 |
Same as transaction(), but the resulting transaction will throw an exception if commit is called. More... | |
virtual void | vacuum ()=0 |
Perform database cleanup operations. More... | |
virtual void | attr_query_station (int data_id, std::function< void(std::unique_ptr< wreport::Var >)> &&dest) |
Query attributes on a station value. More... | |
virtual void | attr_query_data (int data_id, std::function< void(std::unique_ptr< wreport::Var >)> &&dest) |
Query attributes on a data value. More... | |
void | attr_insert_station (int data_id, const Values &attrs) |
Insert new attributes on a station value. More... | |
void | attr_insert_data (int data_id, const Values &attrs) |
Insert new attributes on a data value. More... | |
void | attr_remove_station (int data_id, const db::AttrList &attrs) |
Delete attributes from a station value. More... | |
void | attr_remove_data (int data_id, const db::AttrList &attrs) |
Delete attributes from a data value. More... | |
void | dump (FILE *out) |
Dump the entire contents of the database to an output stream. | |
virtual void | print_info (FILE *out) |
Print informations about the database to the given output stream. | |
![]() | |
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. | |
virtual std::shared_ptr< CursorStation > | query_stations (const Query &query) |
Start a query on the station variables archive. More... | |
virtual std::shared_ptr< CursorStationData > | query_station_data (const Query &query) |
Query the station variables in the database. More... | |
virtual std::shared_ptr< CursorData > | query_data (const Query &query) |
Query the database. More... | |
virtual std::shared_ptr< CursorSummary > | query_summary (const Query &query) |
Query a summary of what the result would be for a query. More... | |
virtual std::shared_ptr< CursorMessage > | query_messages (const Query &query) |
Query the database returning the matching data as Message objects. More... | |
void | remove_all () |
Remove all data from the database. More... | |
void | remove_station_data (const Query &query) |
Remove data from the database. More... | |
void | remove_data (const Query &query) |
Remove data from the database. More... | |
void | import_message (const Message &message, const DBImportOptions &opts=DBImportOptions::defaults) |
Import a Message into the DB-All.e database. More... | |
void | import_messages (const std::vector< std::shared_ptr< Message >> &messages, const DBImportOptions &opts=DBImportOptions::defaults) |
Import Messages into the DB-All.e database. More... | |
void | insert_station_data (Data &vals, const DBInsertOptions &opts=DBInsertOptions::defaults) |
Insert station values into the database. More... | |
void | insert_data (Data &vals, const DBInsertOptions &opts=DBInsertOptions::defaults) |
Insert data values into the database. More... | |
Static Public Member Functions | |
static db::Format | get_default_format () |
static void | set_default_format (db::Format format) |
static std::shared_ptr< DB > | connect_from_file (const char *pathname) |
Create from a SQLite file pathname. More... | |
static std::shared_ptr< DB > | connect_memory () |
Create an in-memory database. | |
static std::shared_ptr< DB > | create (std::shared_ptr< sql::Connection > conn) |
Create a database from an open Connection. | |
static bool | is_url (const char *str) |
Return TRUE if the string looks like a DB URL. More... | |
static const char * | default_repinfo_file () |
Return the default repinfo file pathname. | |
static std::unique_ptr< db::DB > | downcast (std::unique_ptr< dballe::DB > db) |
Downcast a unique_ptr pointer. | |
static std::shared_ptr< db::DB > | downcast (std::shared_ptr< dballe::DB > db) |
Downcast a shared_ptr pointer. | |
![]() | |
static std::shared_ptr< DB > | connect (const DBConnectOptions &opts) |
Create a new DB. | |
void dballe::db::DB::attr_insert_data | ( | int | data_id, |
const Values & | attrs | ||
) |
Insert new attributes on a data value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
attrs | The attributes to be added |
void dballe::db::DB::attr_insert_station | ( | int | data_id, |
const Values & | attrs | ||
) |
Insert new attributes on a station value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
attrs | The attributes to be added |
|
virtual |
Query attributes on a data value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
dest | The function that will be called on each resulting attribute |
|
virtual |
Query attributes on a station value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
dest | The function that will be called on each resulting attribute |
void dballe::db::DB::attr_remove_data | ( | int | data_id, |
const db::AttrList & | attrs | ||
) |
Delete attributes from a data value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
attrs | Array of WMO codes of the attributes to delete. If empty, all attributes associated to the value will be deleted. |
void dballe::db::DB::attr_remove_station | ( | int | data_id, |
const db::AttrList & | attrs | ||
) |
Delete attributes from a station value.
data_id | The id (returned by Cursor::attr_reference_id()) used to refer to the value |
attrs | Array of WMO codes of the attributes to delete. If empty, all attributes associated to the value will be deleted. |
|
static |
Create from a SQLite file pathname.
pathname | The pathname to a SQLite file |
|
pure virtual |
Remove all our traces from the database, if applicable.
After this has been called, all other DB methods except for reset() will fail.
Implemented in dballe::db::v7::DB.
|
static |
Return TRUE if the string looks like a DB URL.
str | The string to test |
|
pure virtual |
Reset the database, removing all existing Db-All.e tables and re-creating them empty.
repinfo_file | The name of the CSV file with the report type information data to load. The file is in CSV format with 6 columns: report code, mnemonic id, description, priority, descriptor, table A category. If repinfo_file is NULL, then the default of /etc/dballe/repinfo.csv is used. |
Implemented in dballe::db::v7::DB.
|
pure virtual |
Same as transaction(), but the resulting transaction will throw an exception if commit is called.
Used for tests.
Implemented in dballe::db::v7::DB.
|
pure virtual |
Perform database cleanup operations.
Orphan values are currently:
Depending on database size, this routine can take a few minutes to execute.
Implemented in dballe::db::v7::DB.