1 #ifndef DBALLE_DB_V6_SQLITE_STATION_H
2 #define DBALLE_DB_V6_SQLITE_STATION_H
4 #include <dballe/db/v6/station.h>
36 bool maybe_get_id(
int lat,
int lon,
const char* ident,
int*
id);
56 int get_id(
int lat,
int lon,
const char* ident=
nullptr)
override;
66 int obtain_id(
int lat,
int lon,
const char* ident=
nullptr,
bool* inserted=NULL)
override;
68 void get_station_vars(
int id_station,
int id_report, std::function<
void(std::unique_ptr<wreport::Var>)> dest)
override;
74 void dump(FILE* out)
override;
dballe::sql::SQLiteConnection & conn
DB connection.
Definition: v6/sqlite/station.h:26
void dump(FILE *out) override
Dump the entire contents of the table to an output stream.
void get_station_vars(int id_station, int id_report, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
dballe::sql::SQLiteStatement * sfstm
Precompiled select fixed station query.
Definition: v6/sqlite/station.h:29
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:17
void read_station_vars(dballe::sql::SQLiteStatement &stm, std::function< void(std::unique_ptr< wreport::Var >)> dest)
Run stm, read its output and generate variables to send to dest.
dballe::sql::SQLiteStatement * istm
Precompiled insert query.
Definition: v6/sqlite/station.h:33
bool maybe_get_id(int lat, int lon, const char *ident, int *id)
Lookup the ID of a station, returning true if it was found, false if not.
void add_station_vars(int id_station, Record &rec) override
Add all station variables (without attributes) to rec.
Precompiled queries to manipulate the station table.
Definition: v6/sqlite/station.h:20
Definition: v6/sqlite/station.h:77
dballe::sql::SQLiteStatement * smstm
Precompiled select mobile station query.
Definition: v6/sqlite/station.h:31
int obtain_id(int lat, int lon, const char *ident=nullptr, bool *inserted=NULL) override
Get the station ID given latitude, longitude and mobile identifier.
SQLite statement.
Definition: sqlite.h:89
int get_id(int lat, int lon, const char *ident=nullptr) override
Get the station ID given latitude, longitude and mobile identifier.
Definition: v6/station.h:19
Database connection.
Definition: sqlite.h:34