From b7316bf6168ee316a07b616386c9f64c2d5476bd Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 30 Aug 2010 06:59:19 +0000 Subject: Make fieldnames with '.' map correctly to lua-map namespace. --- server/src/luaquerymapper.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/src') 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 +#include 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"; -- cgit v1.2.3