diff options
Diffstat (limited to 'server/src')
| -rw-r--r-- | server/src/queryhandlerpentominos.cc | 19 | 
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); | 
