database.h 778 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * database.h
  3. *
  4. * Created on: Dec 4, 2015
  5. * Author: Philipp Hinz
  6. */
  7. #ifndef DATABASE_H_
  8. #define DATABASE_H_
  9. #include <string>
  10. #include <stdexcept>
  11. #include <cstdio>
  12. #include <stdlib.h>
  13. #include <inttypes.h>
  14. #include <cstdarg>
  15. #include "sqlite/sqlite3.h"
  16. using namespace std;
  17. // Config Keys
  18. typedef enum {
  19. brewcounter = 1,
  20. } config_key_t;
  21. int sqlOpen();
  22. void sqlClose();
  23. int sqlSetup();
  24. int sqlExecute(string query);
  25. char *inttochar(uint8_t *guid);
  26. uint8_t *chartoint(const unsigned char *guid);
  27. uint8_t *int64to8bit(sqlite_int64 guid);
  28. sqlite_int64 int8to64bit(uint8_t *guid);
  29. void sqltest();
  30. std::string string_sprintf(const char* format, ...);
  31. uint64_t sqlGetConf(config_key_t id);
  32. int sqlSetConf(config_key_t id, uint64_t value);
  33. #endif /* DATABASE_H_ */