add: save/load for uuid and name
This commit is contained in:
parent
270c87e0bc
commit
db7a377250
11 changed files with 208 additions and 82 deletions
34
main.c
34
main.c
|
@ -1,3 +1,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <lmdb.h>
|
||||
|
||||
#include <models/controller.h>
|
||||
|
||||
int
|
||||
|
@ -5,8 +10,33 @@ main(int argc, char** argv)
|
|||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
controller *this = controller_read();
|
||||
controller_save(this);
|
||||
|
||||
int err;
|
||||
|
||||
MDB_env *mdb_env;
|
||||
|
||||
if(mdb_env_create(&mdb_env) != 0)
|
||||
{
|
||||
perror("Can't create mdb handle");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((err = mdb_env_set_maxdbs(mdb_env, MDB_MAXDBS)) != 0)
|
||||
{
|
||||
fprintf(stderr, "mdb_env_set_maxdbs error %s\n", mdb_strerror(err));
|
||||
}
|
||||
|
||||
if(mdb_env_open(mdb_env, "db.lmdb", MDB_NOSUBDIR, 0700) != 0)
|
||||
{
|
||||
perror("Can't open mdb file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
controller *this = controller_read(mdb_env);
|
||||
(void)this;
|
||||
//controller_save(this);
|
||||
|
||||
mdb_env_close(mdb_env);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue