internal void RecalcJumpDistancesInLog(DateTime startTime, DateTime endTime)
{
String sqlString;
Dictionary<string, string> retValue = new Dictionary<string, string>();
try
{
sqlString = String.Format(
"update tbLog Lg," +
" (select L1.time As T1, L1.system_id As System_1, " +
" L2.time As T2, L2.system_id As System_2," +
" sqrt(POW(L1.x - L2.x, 2) + POW(L1.y - L2.y, 2) + POW(L1.z - L2.z, 2)) as Distance_Between " +
" from (select L.time, L.system_id, Sy.systemname, Sy.x, Sy.y, Sy.z from tbLog L, tbSystems Sy where L.system_id = sy.id) L1, " +
" (select L.time, L.system_id, Sy.systemname, Sy.x, Sy.y, Sy.z from tbLog L, tbSystems Sy where L.system_id = sy.id) L2" +
" where L1.Time > L2.Time" +
" and L2.Time = (select max(L3.time) from tbLog L3 where L3.time < L1.Time)" +
" and L1.system_id <> L2.system_id" +
" and ((L1.x <> 0.0 AND L1.y <> 0.0 AND L1.Z <> 0.0) Or (L1.Systemname = 'Sol'))" +
" and ((L2.x <> 0.0 AND L2.y <> 0.0 AND L2.Z <> 0.0) Or (L2.Systemname = 'Sol'))" +
" and L1.time >= {0}" +
" and L1.time <= {1}" +
" order by L1.time desc) c" +
" set Lg.distance = c.Distance_Between" +
" where Lg.time = c.T1",
DBConnector.SQLDateTime(startTime),
DBConnector.SQLDateTime(endTime));
Program.DBCon.Execute(sqlString);
}
catch (Exception ex)
{
throw new Exception("Error while recalcing jump distances", ex);
}
}