You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

2 years ago
  1. #include <sqlite_orm/sqlite_orm.h>
  2. #include <string>
  3. struct Query {
  4. std::string src_ip;
  5. uint16_t src_port;
  6. uint16_t txn_id;
  7. uint32_t tv_sec;
  8. uint32_t tv_usec;
  9. std::string name;
  10. uint16_t type;
  11. };
  12. int main(int, char**) {
  13. using namespace sqlite_orm;
  14. auto storage = make_storage("synchronous.sqlite",
  15. make_table("queries",
  16. make_column("tv_sec", &Query::tv_sec),
  17. make_column("tv_usec", &Query::tv_usec),
  18. make_column("name", &Query::name),
  19. make_column("type", &Query::type),
  20. make_column("src_ip", &Query::src_ip),
  21. make_column("src_port", &Query::src_port),
  22. make_column("txn_id", &Query::txn_id)));
  23. storage.sync_schema();
  24. storage.pragma.synchronous(0);
  25. storage.remove_all<Query>();
  26. return 0;
  27. }