store id in DB
This commit is contained in:
@@ -33,7 +33,7 @@ constexpr char DB_NAME[] = "data.db";
|
||||
struct sqlite3;
|
||||
struct sqlite3_stmt;
|
||||
|
||||
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
|
||||
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
|
||||
#define SQL_DONE 101
|
||||
#define SQL_NULL 5
|
||||
#define SQLITE_OK 0
|
||||
@@ -44,6 +44,7 @@ namespace sql
|
||||
void init();
|
||||
void shutdown();
|
||||
int open(const char *filename, sqlite3 **ppDb);
|
||||
int exec(sqlite3 *db, const char *sql, int (*callback)(void *, int, char **, char **), void *first_arg, char **errmsg);
|
||||
int prepare_v2(sqlite3 *db, const char *zSql, int nByte, sqlite3_stmt **pStmt, const char **pzTail);
|
||||
int bind_int64(sqlite3_stmt *pStmt, int column, int64_t value);
|
||||
int step(sqlite3_stmt *pStmt);
|
||||
|
||||
20
shared/inc/values/DnaDB.hpp
Normal file
20
shared/inc/values/DnaDB.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <cinttypes>
|
||||
#include <vector>
|
||||
|
||||
struct sqlite3;
|
||||
|
||||
class DnaDB
|
||||
{
|
||||
sqlite3 *db;
|
||||
|
||||
public:
|
||||
void init(const char *db_name = "data.db");
|
||||
void deinit();
|
||||
std::vector<int64_t> getUserIds();
|
||||
int insertUser(int64_t id, int64_t max_gen);
|
||||
int updateUser(int64_t id, int64_t max_gen);
|
||||
|
||||
void getGenerations();
|
||||
void getLikesForGeneration();
|
||||
void getVectorForGeneration();
|
||||
};
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
enum Liked
|
||||
{
|
||||
tbd,
|
||||
yes,
|
||||
no
|
||||
tbd = 0,
|
||||
yes = 1,
|
||||
no = 2,
|
||||
};
|
||||
|
||||
struct UiUnit
|
||||
|
||||
Reference in New Issue
Block a user