blob: eb6193e17d262eec738737fe7bc440f656031cd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <stdio.h>
#include <stdlib.h>
#include "engine/engine.h"
#include "xml/xml.h"
#include "xdbms.h"
static tablist_t *db;
int xdb_init(char *filename) {
if (filename == NULL)
fprintf(stderr, "Warning: running in-memory database\n");
db = readdb(filename);
if (db == NULL) {
fprintf(stderr, "Error: Invalid DB file\n");
return 1;
}
return 0;
}
void xdb_close(void) {
delkeys(db, -1, NULL, 0);
free(db);
}
char *xdb_stmt(char *stmt) {
map_t *decoded = decode(stmt);
printf("%s\n", encode(decoded));
freemap(decoded);
return NULL;
}
|