Code

frontend: Added simple implementation of sdb_fe_exec().
authorSebastian Harl <sh@tokkee.org>
Mon, 6 Jan 2014 10:26:21 +0000 (11:26 +0100)
committerSebastian Harl <sh@tokkee.org>
Mon, 6 Jan 2014 10:26:21 +0000 (11:26 +0100)
This function executes the return value of sdb_fe_parse().

src/frontend/query.c
src/include/frontend/connection.h

index 675a002eaea897ece7dc4301c5fcd00f2660081a..ffec03aef40bc406a2619cc1972f9630dc5a8505 100644 (file)
  * 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)
 {
index c4478fb327116774114f07ac0e21515b811ecef0..06f52435eeb76fe2e0a5a0d1d870e127ba946a9b 100644 (file)
@@ -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