diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-23 14:23:10 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-23 14:23:10 -0400 |
commit | 0cb3dab6b0fc4b5ebe00c0afaaceb68dcf98c6dc (patch) | |
tree | 468adce03e77dc837d022d99d0b07260626123c0 /src/include | |
parent | 175c04f2972c2a65e29ba2456ba5d058c35dcf87 (diff) |
Migrating from personal testing framework to Unity
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/engine/file.c | 2 | ||||
-rw-r--r-- | src/include/init.c | 25 | ||||
-rw-r--r-- | src/include/xdbms.h | 9 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/include/engine/file.c b/src/include/engine/file.c index 4ff7263..efc845c 100644 --- a/src/include/engine/file.c +++ b/src/include/engine/file.c @@ -6,7 +6,7 @@ #include "engine.h" static const uint32_t ND_MARK = 0xffffffff; -static const uint32_t V_MARK = 0xfeffffff; +static const uint32_t V_MARK = 0xfefffffe; static const char *HEAD = "XDBF"; diff --git a/src/include/init.c b/src/include/init.c new file mode 100644 index 0000000..76f46a1 --- /dev/null +++ b/src/include/init.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "xdbms.h" +#include "engine/engine.h" + +static tablist_t *db; + +int xdb_init(char *filename) +{ + if (filename == NULL) + fprintf(stderr, "Warning: running in-memory database\n"); + db = readdb(filename); + + tablist_t *tmp = getkeys(db, -1, NULL, 0); + for (int i = 0; i < tmp[0].len; ++i) { + printf("id: %d\n", i); + for (int j = 0; tmp[0].tab[j].flag; ++j) + printf("%s\n", tmp[0].tab[j].key); + } + free(tmp); + delkeys(db, -1, NULL, 0); + free(db); + return 0; +} diff --git a/src/include/xdbms.h b/src/include/xdbms.h index 3438f5e..a18996d 100644 --- a/src/include/xdbms.h +++ b/src/include/xdbms.h @@ -1,6 +1,13 @@ #ifndef XDBMS_H #define XDBMS_H -#include "engine/engine.h" +// init: intialize an XDBMS DB +int xdb_init(char *filename); + +// exec: execute a statement on an XDBMS DB +char *exec(char *stmt); + +// close: close an XDBMS DB +int close(); #endif |