Add logging
This commit is contained in:
@@ -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,14 +334,17 @@ 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
|
||||||
Select Case DatabaseType
|
_Logger.Debug("Fetching data from database [{0}] with Connection Id [{0}]", pDatabaseType.ToString, pConnectionId)
|
||||||
|
|
||||||
|
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
|
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)
|
||||||
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
||||||
Else
|
Else
|
||||||
|
|||||||
Reference in New Issue
Block a user