From: Sebastian Harl Date: Mon, 6 Jan 2014 10:26:21 +0000 (+0100) Subject: frontend: Added simple implementation of sdb_fe_exec(). X-Git-Tag: sysdb-0.1.0~251 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5fca8c1720eaadfacd58ec094a6af12d6b22558d;p=sysdb.git frontend: Added simple implementation of sdb_fe_exec(). This function executes the return value of sdb_fe_parse(). --- 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