geostat/ocdb.h

40 wiersze
806 B
C
Czysty Zwykły widok Historia

#pragma once
2019-10-03 22:43:39 +00:00
#include "cache.h"
#include "api.h"
#include <string>
#include <nlohmann/json_fwd.hpp>
typedef struct sqlite3 sqlite3;
typedef struct sqlite3_stmt sqlite3_stmt;
class Okapi;
using json = nlohmann::json;
2019-10-03 22:43:39 +00:00
class OCdb : public Api {
private:
sqlite3* db;
sqlite3_stmt* stmt;
2019-10-06 00:46:07 +00:00
int revision;
bool request(std::string req);
bool init_part(std::string json_file); // read db dump
bool parse_item(json j);
bool update_cache(json j);
bool update_log(json j);
2019-09-30 23:48:49 +00:00
bool read_revision();
2019-11-04 20:44:08 +00:00
public:
OCdb(std::string db_file);
~OCdb();
bool init(std::string json_file); // read db dump
bool update(Okapi& oc); // apply changelog
2019-10-06 00:46:07 +00:00
int get_revision();
void set_revision(int rev);
2019-10-03 22:43:39 +00:00
Caches get_user_caches_not_found(std::string uuid);
2019-10-03 22:43:39 +00:00
Caches get_user_caches(std::string uuid, int count = 0);
};