libdballe  9.11
driver.h
1 #ifndef DBALLE_DB_V7_DRIVER_H
2 #define DBALLE_DB_V7_DRIVER_H
3 
4 #include <dballe/core/defs.h>
5 #include <dballe/db/defs.h>
6 #include <dballe/sql/fwd.h>
7 #include <dballe/db/v7/fwd.h>
8 #include <dballe/db/v7/data.h>
9 #include <wreport/var.h>
10 #include <memory>
11 #include <functional>
12 #include <vector>
13 #include <cstdio>
14 
15 namespace dballe {
16 namespace db {
17 namespace v7 {
18 
19 struct Driver
20 {
21 public:
22  sql::Connection& connection;
23 
24  Driver(sql::Connection& connection);
25  virtual ~Driver();
26 
28  virtual std::unique_ptr<v7::Repinfo> create_repinfo(v7::Transaction& tr) = 0;
29 
31  virtual std::unique_ptr<v7::Station> create_station(v7::Transaction& tr) = 0;
32 
34  virtual std::unique_ptr<v7::LevTr> create_levtr(v7::Transaction& tr) = 0;
35 
37  virtual std::unique_ptr<v7::StationData> create_station_data(v7::Transaction& tr) = 0;
38 
40  virtual std::unique_ptr<v7::Data> create_data(v7::Transaction& tr) = 0;
41 
43  void create_tables(db::Format format);
44 
46  virtual void create_tables_v7() = 0;
47 
49  void delete_tables(db::Format format);
50 
52  virtual void delete_tables_v7() = 0;
53 
55  void remove_all(db::Format format);
56 
58  virtual void remove_all_v7();
59 
61  virtual void vacuum_v7() = 0;
62 
64  static std::unique_ptr<Driver> create(dballe::sql::Connection& conn);
65 };
66 
67 }
68 }
69 }
70 #endif
Forward declarations for public dballe/sql names.
virtual std::unique_ptr< v7::Station > create_station(v7::Transaction &tr)=0
Precompiled queries to manipulate the station table.
void create_tables(db::Format format)
Create all missing tables for a DB with the given format.
virtual std::unique_ptr< v7::Data > create_data(v7::Transaction &tr)=0
Precompiled queries to manipulate the data table.
virtual std::unique_ptr< v7::Repinfo > create_repinfo(v7::Transaction &tr)=0
Precompiled queries to manipulate the repinfo table.
virtual void remove_all_v7()
Empty all tables for V7 databases, assuming that they exist, without touching the repinfo table...
Definition: cmdline.h:18
void remove_all(db::Format format)
Empty all tables for a DB with the given format.
virtual std::unique_ptr< v7::LevTr > create_levtr(v7::Transaction &tr)=0
Precompiled queries to manipulate the levtr table.
Definition: sql.h:52
Definition: transaction.h:15
virtual std::unique_ptr< v7::StationData > create_station_data(v7::Transaction &tr)=0
Precompiled queries to manipulate the data table.
virtual void vacuum_v7()=0
Perform database cleanup/maintenance on v7 databases.
virtual void create_tables_v7()=0
Create all missing tables for V7 databases.
Common definitions.
virtual void delete_tables_v7()=0
Delete all existing tables for V7 databases.
static std::unique_ptr< Driver > create(dballe::sql::Connection &conn)
Create a Driver for this connection.
void delete_tables(db::Format format)
Delete all existing tables for a DB with the given format.
Definition: driver.h:19