Compare commits
3 Commits
88ac9e70b2
...
1c49054844
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c49054844 | ||
|
|
c871b06cc2 | ||
|
|
1a860c9270 |
@@ -191,11 +191,13 @@ Public Class DatabaseWithFallback
|
|||||||
|
|
||||||
' If there is no client, we assume there is no service (configured)
|
' If there is no client, we assume there is no service (configured)
|
||||||
If _Client Is Nothing Then
|
If _Client Is Nothing Then
|
||||||
|
_Logger.Debug("Client is empty, falling back to direct database access.")
|
||||||
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' If ForceFallback flag is set, we go to database immediately
|
' If ForceFallback flag is set, we go to database immediately
|
||||||
If pForceFallback Or _ClientConfig.ForceDirectDatabaseAccess Then
|
If pForceFallback Or _ClientConfig.ForceDirectDatabaseAccess Then
|
||||||
|
_Logger.Debug("ForceFallback is True, falling back to direct database access.")
|
||||||
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -332,26 +334,25 @@ Public Class DatabaseWithFallback
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Function GetDatatableFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As DataTable
|
Private Function GetDatatableFromDatabase(pSQLCommand As String, pDatabaseType As Constants.DatabaseType, pConnectionId As Integer) As DataTable
|
||||||
Try
|
Try
|
||||||
Dim oResult As ExecuteNonQueryResponse = Nothing
|
_Logger.Debug("Fetching data from database [{0}] with Connection Id [{0}]", pDatabaseType.ToString, pConnectionId)
|
||||||
|
|
||||||
Select Case DatabaseType
|
|
||||||
Case Constants.DatabaseType.ECM
|
|
||||||
Return _DatabaseECM.GetDatatable(pSQLCommand)
|
|
||||||
|
|
||||||
|
Select Case pDatabaseType
|
||||||
Case Constants.DatabaseType.IDB
|
Case Constants.DatabaseType.IDB
|
||||||
Return _DatabaseIDB.GetDatatable(pSQLCommand)
|
Return _DatabaseIDB.GetDatatable(pSQLCommand)
|
||||||
|
|
||||||
Case Else
|
Case Else
|
||||||
|
If pConnectionId > 0 Then
|
||||||
|
_Logger.Debug("Retrieving Connection String from Connection Id [{0}]", pConnectionId)
|
||||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||||
If oConnectionString = String.Empty Then
|
|
||||||
Return _DatabaseECM.GetDatatable(pSQLCommand)
|
|
||||||
Else
|
|
||||||
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
||||||
|
Else
|
||||||
|
Return _DatabaseECM.GetDatatable(pSQLCommand)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@@ -397,20 +398,19 @@ Public Class DatabaseWithFallback
|
|||||||
Private Function GetScalarValueFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Object
|
Private Function GetScalarValueFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Object
|
||||||
Try
|
Try
|
||||||
Select Case DatabaseType
|
Select Case DatabaseType
|
||||||
Case Constants.DatabaseType.ECM
|
|
||||||
Return _DatabaseECM.GetScalarValue(pSQLCommand)
|
|
||||||
|
|
||||||
Case Constants.DatabaseType.IDB
|
Case Constants.DatabaseType.IDB
|
||||||
Return _DatabaseIDB.GetScalarValue(pSQLCommand)
|
Return _DatabaseIDB.GetScalarValue(pSQLCommand)
|
||||||
|
|
||||||
Case Else
|
Case Else
|
||||||
|
If pConnectionId > 0 Then
|
||||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||||
If oConnectionString = String.Empty Then
|
|
||||||
Return _DatabaseECM.GetScalarValue(pSQLCommand)
|
|
||||||
Else
|
|
||||||
Return _DatabaseECM.GetScalarValueWithConnection(pSQLCommand, oConnectionString)
|
Return _DatabaseECM.GetScalarValueWithConnection(pSQLCommand, oConnectionString)
|
||||||
|
Else
|
||||||
|
Return _DatabaseECM.GetScalarValue(pSQLCommand)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@@ -455,21 +455,19 @@ Public Class DatabaseWithFallback
|
|||||||
Private Function ExecuteNonQueryFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Boolean
|
Private Function ExecuteNonQueryFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Boolean
|
||||||
Try
|
Try
|
||||||
Select Case DatabaseType
|
Select Case DatabaseType
|
||||||
Case Constants.DatabaseType.ECM
|
|
||||||
Return _DatabaseECM.ExecuteNonQuery(pSQLCommand)
|
|
||||||
|
|
||||||
Case Constants.DatabaseType.IDB
|
Case Constants.DatabaseType.IDB
|
||||||
Return _DatabaseIDB.ExecuteNonQuery(pSQLCommand)
|
Return _DatabaseIDB.ExecuteNonQuery(pSQLCommand)
|
||||||
|
|
||||||
Case Else
|
Case Else
|
||||||
|
If pConnectionId > 0 Then
|
||||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||||
If oConnectionString = String.Empty Then
|
|
||||||
Return _DatabaseECM.ExecuteNonQuery(pSQLCommand)
|
|
||||||
Else
|
|
||||||
Return _DatabaseECM.ExecuteNonQueryWithConnection(pSQLCommand, oConnectionString)
|
Return _DatabaseECM.ExecuteNonQueryWithConnection(pSQLCommand, oConnectionString)
|
||||||
|
Else
|
||||||
|
Return _DatabaseECM.ExecuteNonQuery(pSQLCommand)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Return False
|
Return False
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
|||||||
<Assembly: AssemblyDescription("")>
|
<Assembly: AssemblyDescription("")>
|
||||||
<Assembly: AssemblyCompany("Digital Data")>
|
<Assembly: AssemblyCompany("Digital Data")>
|
||||||
<Assembly: AssemblyProduct("EDMIAPI")>
|
<Assembly: AssemblyProduct("EDMIAPI")>
|
||||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||||
<Assembly: AssemblyTrademark("1.6.0.0")>
|
<Assembly: AssemblyTrademark("1.6.1.0")>
|
||||||
|
|
||||||
<Assembly: ComVisible(False)>
|
<Assembly: ComVisible(False)>
|
||||||
|
|
||||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.6.0.0")>
|
<Assembly: AssemblyVersion("1.6.1.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.6.0.0")>
|
<Assembly: AssemblyFileVersion("1.6.1.0")>
|
||||||
|
|||||||
Reference in New Issue
Block a user