summaryrefslogtreecommitdiff
path: root/server/src/queryparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/queryparser.cc')
-rw-r--r--server/src/queryparser.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc
index 38e3037..34c7aa3 100644
--- a/server/src/queryparser.cc
+++ b/server/src/queryparser.cc
@@ -62,7 +62,9 @@ int QueryParser::readData(char *data, size_t size)
return len;
}
-#ifdef TEST_EXTERNALDATAQUERYPARSER
+#ifdef TEST_QUERYPARSER
+
+#include "queryhandler.h"
static std::string loadresultstring(QueryResult &res, std::string group = "")
{
@@ -84,24 +86,21 @@ static std::string loadresultstring(QueryResult &res, std::string group = "")
return s;
}
-char xml[] =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<group name=\"dims\">\n"
- " <value name=\"fisk\" value=\"42\"/>"
- " <value name=\"futte\" value=\"bamse\"/>"
- " <group name=\"dims2\">\n"
- " <value name=\"fisk2\" value=\"42\"/>"
- " <value name=\"futte2\" value=\"bamse\"/>"
- " </group>\n"
- " <group name=\"dims3\">\n"
- " <value name=\"fisk3\" value=\"42\"/>"
- " <value name=\"futte3\" value=\"bamse\"/>"
- " </group>\n"
- "</group>\n";
-
int main()
{
- QueryParser e(xml);
+ TCPSocket s;
+ s.connect("localhost", 11108);
+
+ QueryHandler qh(&s, "2003791613");
+
+ Query q1("lensmeter", "lensmeter");
+ qh.addQuery(q1);
+
+ std::string res = qh.exec();
+
+ printf("%s\n", res.c_str());
+
+ QueryParser e(res);
e.parse();
printf("%s\n", loadresultstring(e.result).c_str());