// Databases (hash tables)
const int DB_BUCKETS = 8192;
+ERASEABLE
void db_save(int db, string filename)
{
int fh = fopen(filename, FILE_WRITE);
USING(HashMap, int);
+ERASEABLE
int db_create()
{
return buf_create();
}
#define HM_NEW(this) (this = db_create())
+ERASEABLE
void db_put(int db, string key, string value);
+ERASEABLE
int db_load(string filename)
{
int db = buf_create();
return db;
}
+ERASEABLE
void db_dump(int db, string filename)
{
int fh = fopen(filename, FILE_WRITE);
fclose(fh);
}
+ERASEABLE
void db_close(int db)
{
buf_del(db);
}
#define HM_DELETE(this) db_close(this)
+ERASEABLE
string db_get(int db, string key)
{
int h = crc16(false, key) % DB_BUCKETS;
#define db_remove(db, key) db_put(db, key, "")
+ERASEABLE
void db_put(int db, string key, string value)
{
int h = crc16(false, key) % DB_BUCKETS;
}
#define HM_sets(this, key, val) db_put(this, key, val)
+/*
void db_test()
{
LOG_INFO("LOAD...\n");
db_close(db);
LOG_INFO("CLOSED.\n");
}
+*/