From 5fca8c1720eaadfacd58ec094a6af12d6b22558d Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 6 Jan 2014 11:26:21 +0100 Subject: [PATCH] frontend: Added simple implementation of sdb_fe_exec(). This function executes the return value of sdb_fe_parse(). --- src/frontend/query.c | 17 +++++++++++++++++ src/include/frontend/connection.h | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/frontend/query.c b/src/frontend/query.c index 675a002..ffec03a 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -38,6 +38,23 @@ * public API */ +int +sdb_fe_exec(sdb_conn_t *conn, sdb_conn_node_t *node) +{ + if (! node) + return -1; + + switch (node->cmd) { + case CONNECTION_LIST: + return sdb_fe_list(conn); + + default: + sdb_log(SDB_LOG_ERR, "frontend: Unknown command %i", node->cmd); + return -1; + } + return -1; +} /* sdb_fe_exec */ + int sdb_fe_list(sdb_conn_t *conn) { diff --git a/src/include/frontend/connection.h b/src/include/frontend/connection.h index c4478fb..06f5243 100644 --- a/src/include/frontend/connection.h +++ b/src/include/frontend/connection.h @@ -121,14 +121,14 @@ sdb_fe_parse(const char *query); /* * sdb_fe_exec: - * Execute the command identified by 'node'. + * Execute the command identified by 'node' on the specified connection. * * Returns: * - 0 on success * - a negative value else */ int -sdb_fe_exec(sdb_conn_node_t *node); +sdb_fe_exec(sdb_conn_t *conn, sdb_conn_node_t *node); /* * session handling -- 2.30.2