SQLsmith  v1.2.1-5-gfacd7a8
A random SQL query generator
log.hh
Go to the documentation of this file.
1 
4 #ifndef LOG_HH
5 #define LOG_HH
6 
7 #include <exception>
8 #include <pqxx/pqxx>
9 #include <string>
10 
11 #include "prod.hh"
12 #include "dut.hh"
13 
15 struct logger {
16  virtual void generated(prod &query) {(void)query; }
17  virtual void executed(prod &query) {(void)query; }
18  virtual void error(prod &query, const dut::failure &e) {
19  (void)query, (void)e;
20  }
21 };
22 
24 struct query_dumper : logger {
25  virtual void generated(prod &query) {
26  query.out(std::cout);
27  std::cout << ";" << std::endl;
28  }
29 };
30 
33  long queries = 0;
34  float sum_nodes = 0;
35  float sum_height = 0;
36  float sum_retries = 0;
37  virtual void generated(prod &query);
38 };
39 
42  const int columns = 80;
43  std::map<std::string, long> errors;
44  virtual void report();
45  virtual void generated(prod &query);
46  virtual void executed(prod &query);
47  virtual void error(prod &query, const dut::failure &e);
48  void report(prod &p);
49 };
50 
53  long id;
54  std::shared_ptr<pqxx::connection> c;
55  pqxx_logger(std::string target, std::string conninfo, struct schema &s);
56  virtual void generated(prod &query);
57  virtual void error(prod &query, const dut::failure &e);
58 };
59 
60 #endif
Base class for device under test.
Base class for grammar productions.
stderr logger
Definition: log.hh:41
logger base class
Definition: log.hh:15
logger to postgres database
Definition: log.hh:52
Base class for AST nodes.
Definition: prod.hh:17
virtual void out(std::ostream &out)=0
Emit SQL for this production.
logger to dump all generated queries
Definition: log.hh:24
Definition: schema.hh:16
logger for statistics collection
Definition: log.hh:32