Oracle database selection includes 'None', component Simulate mode not required anymore, ver. 2.12.497

This commit is contained in:
Milan Hanajik
2017-03-14 13:31:03 +01:00
parent c46dea3ae7
commit 94eb2909bc
3 changed files with 31 additions and 15 deletions
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015 Sensus Metering Systems /// Copyright (c) 2015-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -69,24 +69,39 @@ namespace TBF.BenchControl.DB.SensusOracle
public void Initialize() public void Initialize()
{ {
connection = (DBCfg.DBUsed == DBUsed.Production) switch (DBCfg.DBUsed)
? new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;") {
: new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;"); case DBUsed.Production:
connection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
break;
case DBUsed.Quality:
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;"); /// TODO: Quality database specification
break;
case DBUsed.Test:
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
break;
default:
connection = null;
break;
}
if (DBCfg.DebugLevel == DebugMode.Simulate) return; if (DBCfg.DebugLevel == DebugMode.Simulate) return;
/// ///
/// Do something with the database to see if the connection works well /// Do something with the database to see if the connection works well
/// ///
connection.Open(); if (connection != null)
{
connection.Open();
string rslt = "none"; string rslt = "none";
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection); OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
OracleDataReader dr = cmd.ExecuteReader(); OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) rslt = dr.GetString(0); if (dr.Read()) rslt = dr.GetString(0);
dr.Close(); dr.Close();
connection.Close(); connection.Close();
}
} }
public void RunDeviceBefore() {} public void RunDeviceBefore() {}
@@ -215,7 +230,7 @@ namespace TBF.BenchControl.DB.SensusOracle
bool anyError = false; bool anyError = false;
#if ORACLE_DB #if ORACLE_DB
if (DBCfg.DebugLevel != DebugMode.Simulate) if (DBCfg.DebugLevel != DebugMode.Simulate && connection != null)
{ {
if (WriteResultsToDatabase(connection, batch, false) == Retv.Error) anyError = true; if (WriteResultsToDatabase(connection, batch, false) == Retv.Error) anyError = true;
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2016 Sensus Metering Systems /// Copyright (c) 2015-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -11,6 +11,7 @@ namespace TBF.BenchControl.DB.SensusOracle
{ {
public enum DBUsed public enum DBUsed
{ {
None,
Production, Production,
Test, Test,
Quality, Quality,
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.12.496.1")] [assembly: AssemblyVersion("2.12.497.1")]
[assembly: AssemblyFileVersion("2.12.496.1")] [assembly: AssemblyFileVersion("2.12.497.1")]