summaryrefslogtreecommitdiff
path: root/server/src/queryparser.cc
diff options
context:
space:
mode:
authordeva <deva>2008-05-15 14:19:02 +0000
committerdeva <deva>2008-05-15 14:19:02 +0000
commit63d7e433f104dd13d015df3a048697fad6d43a55 (patch)
tree4dedec10891f4e9866ba5b3f9bfcd136cc0c7e16 /server/src/queryparser.cc
parentdd744c562f2f755a9fcd9ee5341c8c8702a9ee32 (diff)
Added a lot of testcode... and fixed a lot of minor error (-Wall -Werror)
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());