From: Michael Friedrich Date: Fri, 12 Jul 2013 14:32:13 +0000 (+0200) Subject: livestatus: join csv arrays into comma seperated string X-Git-Tag: v0.0.3~849 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b5f4dcde7811309689a662460e2c84a6fec9730;p=icinga2 livestatus: join csv arrays into comma seperated string refs #4374 --- diff --git a/components/livestatus/query.cpp b/components/livestatus/query.cpp index 9c19b3ac1..74513257e 100644 --- a/components/livestatus/query.cpp +++ b/components/livestatus/query.cpp @@ -280,7 +280,22 @@ void Query::PrintResultSet(std::ostream& fp, const std::vector& columns, else fp << ";"; - fp << Convert::ToString(value); + if (value.IsObjectType()) { + bool first_inner = true; + Array::Ptr arr = static_cast(value); + + ObjectLock rlock(arr); + BOOST_FOREACH(const Value& arr_val, arr) { + if (first_inner) + first_inner = false; + else + fp << ","; + + fp << Convert::ToString(arr_val); + } + } else { + fp << Convert::ToString(value); + } } fp << "\n";