diff --git a/src/core/store.c b/src/core/store.c
index f672c120a3c646b3893f06583a717b13ad9f22cf..7671e9800f13a0ac0a81e2b24817d95b0f0a83ef 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
store_attribute, store_service_attr, store_metric_attr,
};
+/*
+ * TODO: let prepare and execute accept a store object as their user_data
+ * object
+ */
+
+static sdb_object_t *
+prepare_query(sdb_ast_node_t *ast,
+ sdb_strbuf_t __attribute__((unused)) *errbuf,
+ sdb_object_t __attribute__((unused)) *user_data)
+{
+ return SDB_OBJ(sdb_store_query_prepare(ast));
+} /* prepare_query */
+
+static int
+execute_query(sdb_object_t *q,
+ sdb_strbuf_t *buf, sdb_strbuf_t *errbuf,
+ sdb_object_t __attribute__((unused)) *user_data)
+{
+ return sdb_store_query_execute(QUERY(q), buf, errbuf);
+} /* execute_query */
+
+static sdb_store_reader_t store_reader = {
+ prepare_query, execute_query,
+};
+
/*
* public API
*/
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