summaryrefslogtreecommitdiff
path: root/server/src/queryhandlerpentominos.cc
diff options
context:
space:
mode:
authordeva <deva>2010-04-14 13:18:20 +0000
committerdeva <deva>2010-04-14 13:18:20 +0000
commitab82eb1e61def329879bc407906301583034ec5f (patch)
treeb172fb2d4833da02117901acdc35d1e3042d3960 /server/src/queryhandlerpentominos.cc
parent4aa86d54143d81dd0f819805aeac2b8e5a26488b (diff)
Updated libartefact interface.
Diffstat (limited to 'server/src/queryhandlerpentominos.cc')
-rw-r--r--server/src/queryhandlerpentominos.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/server/src/queryhandlerpentominos.cc b/server/src/queryhandlerpentominos.cc
index 33609cc..a8d6c07 100644
--- a/server/src/queryhandlerpentominos.cc
+++ b/server/src/queryhandlerpentominos.cc
@@ -74,23 +74,30 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
{
atf_transaction_t* atft = atf_new_transaction(atfc, cpr.c_str());
- atf_id id = atf_add_query(atft, query.attributes["class"].c_str(), 0, "xml");
+ atf_id id = atf_add_query(atft, query.attributes["class"].c_str(),
+ FILTER_LATEST, USE_NONE, 0, 0);
atf_reply_t *reply = atf_commit(atft);
- atf_status_t status = atf_get_reply_status(reply, id);
+ if(atf_get_num_results(reply, id) != 1) {
+ // ... error ...
+ }
+
+ atf_result_t *result = atf_get_result(reply, id, 0);
+
+ atf_status_t status = atf_get_result_status(result, NULL, 0);
if(status != ATF_STATUS_OK) { return QueryResult(); }
- time_t timestamp = atf_get_reply_timestamp(reply, id);
+ time_t timestamp = atf_get_result_timestamp(result);
- atf_result_node_t *root = atf_get_result_node(reply, id);
+ atf_result_node_t *root = atf_get_result_node(result);
QueryResult rroot;
rroot.timestamp = timestamp;
rroot.source = "pentominos";
- QueryResult result = node2result(root, timestamp);
- if(root) rroot.groups[query.attributes["class"]] = result;
+ QueryResult qresult = node2result(root, timestamp);
+ if(root) rroot.groups[query.attributes["class"]] = qresult;
atf_free_result_node(root);
atf_free_reply(reply);