Skip to content
Permalink
Browse files

don't crash the whole server if storing the report result does not work.

fixes #390
  • Loading branch information...
tpokorra committed Sep 30, 2019
1 parent 8355f81 commit ae431d6b327741af440f39eac8b01e67e12fffb7
Showing with 36 additions and 25 deletions.
  1. +36 −25 csharp/ICT/Petra/Server/lib/MReporting/connect/WebConnector.cs
@@ -189,31 +189,42 @@ private static void Run(string ASessionID, string AReportID, TRptDataCalculator
}
*/

// store the report result
db.WriteTransaction(ref Transaction,
ref Submit,
delegate
{
// delete report results that are expired.
string sql = "DELETE FROM PUB_s_report_result WHERE s_valid_until_d < NOW()";
db.ExecuteNonQuery(sql, Transaction);

// TODO: only keep maximum of 10 report results per user (s_created_by_c)

// store success, store parameter list, store html document
SReportResultTable table = new SReportResultTable();
SReportResultRow row = table.NewRowTyped();
row.ReportId = AReportID;
row.SessionId = TSession.GetSessionID();
row.ValidUntil = DateTime.Now.AddHours(12);
row.ParameterList = AParameterList.ToJson();
row.ResultHtml = HTMLOutput;
row.Success = Success;
row.ErrorMessage = ErrorMessage;
table.Rows.Add(row);
SReportResultAccess.SubmitChanges(table, Transaction);
Submit = true;
});
try
{
// store the report result
db.WriteTransaction(ref Transaction,
ref Submit,
delegate
{
// delete report results that are expired.
string sql = "DELETE FROM PUB_s_report_result WHERE s_valid_until_d < NOW()";
db.ExecuteNonQuery(sql, Transaction);

// TODO: only keep maximum of 10 report results per user (s_created_by_c)

// store success, store parameter list, store html document
SReportResultTable table = new SReportResultTable();
SReportResultRow row = table.NewRowTyped();
row.ReportId = AReportID;
row.SessionId = TSession.GetSessionID();
row.ValidUntil = DateTime.Now.AddHours(12);
row.ParameterList = AParameterList.ToJson();
row.ResultHtml = HTMLOutput;
row.Success = Success;
row.ErrorMessage = ErrorMessage;
table.Rows.Add(row);
SReportResultAccess.SubmitChanges(table, Transaction);
Submit = true;
});
}
catch (Exception Exc)
{
TLogging.Log("Problem storing report result: " + Exc.ToString());
TLogging.Log(Exc.StackTrace, TLoggingType.ToLogfile);

Success = false;
ErrorMessage = Exc.Message;
}

db.CloseDBConnection();

0 comments on commit ae431d6

Please sign in to comment.
You can’t perform that action at this time.