summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2010-08-30 06:59:19 +0000
committerdeva <deva>2010-08-30 06:59:19 +0000
commitb7316bf6168ee316a07b616386c9f64c2d5476bd (patch)
tree72826b0b0c7fb93cffcfea2b9c54efc6ad237700
parente90442fe60c1e758709419767970b77cdfd2e3a8 (diff)
Make fieldnames with '.' map correctly to lua-map namespace.
-rw-r--r--server/src/luaquerymapper.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/src/luaquerymapper.cc b/server/src/luaquerymapper.cc
index 8e154ed..aefbabf 100644
--- a/server/src/luaquerymapper.cc
+++ b/server/src/luaquerymapper.cc
@@ -27,6 +27,7 @@
#include "luaquerymapper.h"
#include <sstream>
+#include <string>
static std::string loadresultstring(QueryResult &res, std::string group = "")
{
@@ -35,6 +36,13 @@ static std::string loadresultstring(QueryResult &res, std::string group = "")
std::map< std::string, std::string >::iterator v = res.values.begin();
while(v != res.values.end()) {
+
+ std::string grp = (*v).first;
+ std::string::size_type idx = -1;
+ while((idx = grp.find(".", idx + 1)) != std::string::npos) {
+ s += group + grp.substr(0, idx) + " = {}\n";
+ }
+
s += group + (*v).first + " = {}\n";
s += group + (*v).first + ".value = \"" + (*v).second + "\"\n";
s += group + (*v).first + ".timestamp = " + timestamp.str() + "\n";