diff options
Diffstat (limited to 'server/src/server.cc')
-rw-r--r-- | server/src/server.cc | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/server/src/server.cc b/server/src/server.cc index b98cc94..5d72098 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -137,15 +137,6 @@ static std::string handleTransaction(Transaction &transaction) else answer += "\"false\""; answer += ">\n"; - /////////////////////////////// - // Send the queries to Pentominos (if any) - TCPSocket s; -#ifndef WITHOUT_PENTOMINOS - s.connect(Conf::pentominos_addr, Conf::pentominos_port); -#endif/*WITHOUT_PENTOMINOS*/ - QueryHandler qh(&s, transaction.cpr); - /////////////////////////////// - if(macro.attributes["name"] == request.macro) { foundmacro = true; @@ -154,15 +145,36 @@ static std::string handleTransaction(Transaction &transaction) mp.parse(); Macro *m = mp.getMacro(); + LUAQueryMapper lqm; + //////////////////////// std::vector< Query >::iterator qi = m->queries.begin(); while(qi != m->queries.end()) { + /////////////////////////////// + // Send the queries to Pentominos (if any) + TCPSocket s; +#ifndef WITHOUT_PENTOMINOS + s.connect(Conf::pentominos_addr, Conf::pentominos_port); +#endif/*WITHOUT_PENTOMINOS*/ + QueryHandler qh(&s, transaction.cpr); + /////////////////////////////// + qh.addQuery(*qi); + + std::string result = qh.exec(); + printf("Got result: [%s]\n", result.c_str()); + ///////////////////////// + + ///////////////////////// + // Parse the result from the queries to pentominos + QueryParser qp(result); + qp.parse(); + // Map the results + lqm.addQueryResult(qp.result); + //////////////////////// + qi++; } - std::string result = qh.exec(); - printf("Got result: [%s]\n", result.c_str()); - ///////////////////////// // Handle scripts if(m->scripts.size()) { @@ -179,14 +191,6 @@ static std::string handleTransaction(Transaction &transaction) answer += " </scripts>\n"; } - ///////////////////////// - // Parse the result from the queries to pentominos - QueryParser qp(result); - qp.parse(); - // Map the results - LUAQueryMapper lqm(qp.result); - //////////////////////// - answer += widgetgenerator(transaction.cpr, *m, lqm, db); } answer += " </macro>\n"; |