This commit is contained in:
@@ -52,7 +52,7 @@ namespace AyaNova.KPI
|
||||
|
||||
|
||||
JArray jData = new JArray();
|
||||
string sMeta = null;
|
||||
JArray jMeta = new JArray();
|
||||
|
||||
#if (DEBUG && AYSHOWKPIQUERYINFO)
|
||||
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
|
||||
@@ -86,11 +86,9 @@ namespace AyaNova.KPI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(kpi.MetaQuery))
|
||||
{
|
||||
//GET META DATA
|
||||
//GET META DATA ROWS
|
||||
command.CommandText = kpi.MetaQuery;
|
||||
#if (DEBUG && AYSHOWQUERYINFO)
|
||||
stopWatch.Start();
|
||||
@@ -101,14 +99,14 @@ namespace AyaNova.KPI
|
||||
stopWatch.Stop();
|
||||
log.LogInformation($"(debug) KPIFetcher:GetResponse META query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}");
|
||||
#endif
|
||||
if (dr.Read())
|
||||
while (dr.Read())
|
||||
{
|
||||
sMeta = dr.GetString(0);
|
||||
//only one column and it's the zeroth json string column
|
||||
if (!dr.IsDBNull(0))
|
||||
jMeta.Add(JObject.Parse(dr.GetString(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Npgsql.PostgresException e)
|
||||
{
|
||||
@@ -133,17 +131,13 @@ namespace AyaNova.KPI
|
||||
throw new System.Exception("KPIFetcher:GetResponseAsync - unexpected failure see log");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sMeta))
|
||||
return JObject.FromObject(new
|
||||
{
|
||||
meta = JObject.Parse(sMeta),
|
||||
data = jData
|
||||
});
|
||||
else
|
||||
return JObject.FromObject(new
|
||||
{
|
||||
data = jData
|
||||
});
|
||||
|
||||
return JObject.FromObject(new
|
||||
{
|
||||
meta = jMeta,
|
||||
data = jData
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,10 @@ ORDER BY X ASC
|
||||
) t";
|
||||
_metaQuery =
|
||||
@"SELECT row_to_json(t) as res from (
|
||||
select name from auser where id = 10
|
||||
select auser.id as userid, name, uicolor, usertype from auser
|
||||
left outer join auseroptions on auser.id=auseroptions.userid
|
||||
where auser.usertype=1 or auser.usertype=5
|
||||
order by name
|
||||
) t";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user