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:30:01 +01:00
parent c46dea3ae7
commit 94eb2909bc
3 changed files with 31 additions and 15 deletions

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@ -69,24 +69,39 @@ namespace TBF.BenchControl.DB.SensusOracle
public void Initialize()
{
connection = (DBCfg.DBUsed == DBUsed.Production)
? new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;")
: new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
switch (DBCfg.DBUsed)
{
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;
///
/// Do something with the database to see if the connection works well
///
connection.Open();
if (connection != null)
{
connection.Open();
string rslt = "none";
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) rslt = dr.GetString(0);
dr.Close();
string rslt = "none";
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read()) rslt = dr.GetString(0);
dr.Close();
connection.Close();
connection.Close();
}
}
public void RunDeviceBefore() {}
@ -215,7 +230,7 @@ namespace TBF.BenchControl.DB.SensusOracle
bool anyError = false;
#if ORACLE_DB
if (DBCfg.DebugLevel != DebugMode.Simulate)
if (DBCfg.DebugLevel != DebugMode.Simulate && connection != null)
{
if (WriteResultsToDatabase(connection, batch, false) == Retv.Error) anyError = true;
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@ -11,6 +11,7 @@ namespace TBF.BenchControl.DB.SensusOracle
{
public enum DBUsed
{
None,
Production,
Test,
Quality,

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.12.496.1")]
[assembly: AssemblyFileVersion("2.12.496.1")]
[assembly: AssemblyVersion("2.12.497.1")]
[assembly: AssemblyFileVersion("2.12.497.1")]