SensusOracle.DB : Handling of a crash in transaction.Rollback(), ver. 2.31.2009
This commit is contained in:
parent
2b0ee55901
commit
df386a14f8
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("TestBenchFramework")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2023 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.31.2007.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.2007.0")]
|
||||
[assembly: AssemblyVersion("2.31.2009.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.2009.0")]
|
||||
|
||||
@ -627,6 +627,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
public Retv WriteResultsToDB(OracleConnection conn, Results.Entities.Batch bat, WMKind wmKind, bool safeMode)
|
||||
{
|
||||
OracleTransaction transaction;
|
||||
bool savedOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
@ -635,8 +636,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB (phase 1): {1}",
|
||||
bat.BatchNr, exc.Message);
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB (phase 1): {1}", bat.BatchNr, exc.Message);
|
||||
conn.Close();
|
||||
return Retv.Error;
|
||||
}
|
||||
@ -661,18 +661,34 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
savedOK = true;
|
||||
conn.Close();
|
||||
log.ErrorFormat("Results of batch {0} correctly written to ORACLE DB", bat.BatchNr);
|
||||
return Retv.OK;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
conn.Close();
|
||||
savedOK = false;
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB: {1}", bat.BatchNr, exc.Message);
|
||||
return Retv.Error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!savedOK)
|
||||
{
|
||||
try
|
||||
{
|
||||
transaction.Rollback();
|
||||
conn.Close();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Even transaction.Rollback() failed: {0}", exc.Message);
|
||||
}
|
||||
|
||||
return Retv.Error;
|
||||
}
|
||||
|
||||
return Retv.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
Loading…
Reference in New Issue
Block a user