summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 182112c)
raw | patch | inline | side by side (parent: 182112c)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 5 Aug 2015 08:45:11 +0000 (10:45 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 5 Aug 2015 08:45:11 +0000 (10:45 +0200) |
The built-in store is registered as a reader automatically at the moment.
src/core/store.c | patch | blob | history | |
src/frontend/connection-private.h | patch | blob | history | |
src/frontend/query.c | patch | blob | history | |
src/parser/parser.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 2d32e0d2cdbbb7419c54094d607c3eb771d99a8f..7671e9800f13a0ac0a81e2b24817d95b0f0a83ef 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
sdb_log(SDB_LOG_ERR, "store: Failed to allocate store");
return -1;
}
- return sdb_plugin_register_writer("memstore",
- &store_writer, SDB_OBJ(global_store));
+ if (sdb_plugin_register_writer("memstore",
+ &store_writer, SDB_OBJ(global_store)))
+ return -1;
+ return sdb_plugin_register_reader("memstore",
+ &store_reader, SDB_OBJ(global_store));
} /* sdb_store_init */
void
index 94c3b4a576ef443602b14ebf4e0b969cd0a22cfd..acdc699c107f11294905fc58fc8ed655551ba49e 100644 (file)
#include "frontend/connection.h"
#include "core/object.h"
-#include "core/store.h"
#include "core/timeseries.h"
#include "utils/ssl.h"
#include "utils/strbuf.h"
diff --git a/src/frontend/query.c b/src/frontend/query.c
index 97698fd300be6af87607c13d9b7c2336cea54b48..9315582292fa181b19e2f663a1591ff5fddda592 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
#include "sysdb.h"
-#include "core/store.h"
+#include "core/plugin.h"
#include "frontend/connection-private.h"
#include "parser/ast.h"
#include "parser/parser.h"
static int
query_exec(sdb_conn_t *conn, sdb_ast_node_t *ast)
{
- sdb_store_query_t *q;
sdb_strbuf_t *buf;
int status;
return -1;
}
- q = sdb_store_query_prepare(ast);
- if (! q) {
- /* this shouldn't happen */
- sdb_strbuf_sprintf(conn->errbuf, "failed to compile AST");
- sdb_log(SDB_LOG_ERR, "frontend: failed to compile AST");
- return -1;
- }
-
buf = sdb_strbuf_create(1024);
if (! buf) {
sdb_strbuf_sprintf(conn->errbuf, "Out of memory");
- sdb_object_deref(SDB_OBJ(q));
return -1;
}
- status = sdb_store_query_execute(q, buf, conn->errbuf);
+ status = sdb_plugin_query(ast, buf, conn->errbuf);
if (status < 0) {
char query[conn->cmd_len + 1];
strncpy(query, sdb_strbuf_string(conn->buf), conn->cmd_len);
(uint32_t)sdb_strbuf_len(buf), sdb_strbuf_string(buf));
sdb_strbuf_destroy(buf);
- sdb_object_deref(SDB_OBJ(q));
return status < 0 ? status : 0;
} /* query_exec */
diff --git a/src/parser/parser.c b/src/parser/parser.c
index e3073a9a627534d6ea5c5ca2e6ac3859a0eeeafc..2e0b864a9132e78c644e6b3316fa5724afde327b 100644 (file)
--- a/src/parser/parser.c
+++ b/src/parser/parser.c
#include "sysdb.h"
-#include "core/store.h"
-
#include "parser/ast.h"
#include "parser/parser.h"
#include "parser/grammar.h"