/*
 * database.h
 *
 *  Created on: Dec 4, 2015
 *      Author: Philipp Hinz
 */

#ifndef DATABASE_H_
#define DATABASE_H_
#include <string>
#include <stdexcept>
#include <cstdio>
#include <stdlib.h>
#include <inttypes.h>
#include <cstdarg>
#include "sqlite/sqlite3.h"

using namespace std;

// Config Keys
typedef enum {
	CFGbrewcounter = 1,
	CFGHeatingTime = 2,
	CFGdisplaylang = 3
} config_key_t;

int sqlOpen();
void sqlClose();
int sqlSetup();
int sqlExecute(string query);
char *inttochar(uint8_t *guid);
uint8_t *chartoint(const unsigned char *guid);
uint8_t *int64to8bit(sqlite_int64 guid);
sqlite_int64 int8to64bit(uint8_t *guid);
void sqltest();
std::string string_sprintf(const char* format, ...);
uint64_t sqlGetConf(config_key_t id);
int sqlSetConf(config_key_t id, uint64_t value);

#endif /* DATABASE_H_ */
