use correct connectionstring when querying for documents
This commit is contained in:
parent
a6b9e5c8c1
commit
425c4be388
@ -362,48 +362,58 @@ Public Class ProfileFilter
|
|||||||
For Each oRow As DataRow In oDTDataSearches.Rows
|
For Each oRow As DataRow In oDTDataSearches.Rows
|
||||||
Dim oCountCommand = String.Empty
|
Dim oCountCommand = String.Empty
|
||||||
Dim oCountConnectionId = String.Empty
|
Dim oCountConnectionId = String.Empty
|
||||||
|
|
||||||
Try
|
Try
|
||||||
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
||||||
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
|
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
|
||||||
|
|
||||||
If oCountCommand = String.Empty Then
|
If oCountCommand = String.Empty Then
|
||||||
_Logger.Debug("oCountCommand = String.Empty ==> Continue for")
|
_Logger.Debug("Data SQL Query is empty. Skipping.")
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
_Logger.Debug("Count-Command DATA BEFORE Replace: [{0}]", oCountCommand)
|
||||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||||
|
|
||||||
_Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]")
|
_Logger.Debug("Count-Command DATA before execute: [{0}]", oCountCommand)
|
||||||
|
|
||||||
Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
|
Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
|
||||||
|
|
||||||
oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
|
oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
|
||||||
|
|
||||||
|
_Logger.Debug("Datarows returned from search: [{0}]", oResultData)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
_Logger.Error(ex)
|
||||||
|
_Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand)
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
For Each oRow As DataRow In oDTDocSearches.Rows
|
For Each oRow As DataRow In oDTDocSearches.Rows
|
||||||
Dim oCountCommand = String.Empty
|
Dim oCountCommand = String.Empty
|
||||||
|
Dim oCountConnectionId = String.Empty
|
||||||
|
|
||||||
Try
|
Try
|
||||||
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
||||||
|
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
|
||||||
|
|
||||||
If oCountCommand = String.Empty Then
|
If oCountCommand = String.Empty Then
|
||||||
|
_Logger.Debug("Document SQL Query is empty. Skipping.")
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
_Logger.Debug($"Count-Command DOCS BEFORE Replace: {oCountCommand}")
|
|
||||||
|
_Logger.Debug("Count-Command for Documents BEFORE Replace: [{0}]", oCountCommand)
|
||||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||||
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceInternalValues: {oCountCommand}")
|
|
||||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||||
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceUserValues: {oCountCommand}")
|
|
||||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||||
_Logger.Debug($"Count-Command DOCS BEFORE execute: {oCountCommand}")
|
|
||||||
oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
_Logger.Debug("Count-Command for Documents BEFORE execute: [{0}]", oCountCommand)
|
||||||
_Logger.Debug($"oResultDocs: {oResultDocs}")
|
Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
|
||||||
|
oResultDocs += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
|
||||||
|
|
||||||
|
_Logger.Debug("Documents returned from search: [{0}]", oResultDocs)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
_Logger.Error(ex)
|
||||||
|
_Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand)
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@ -414,7 +424,7 @@ Public Class ProfileFilter
|
|||||||
For Each oProfile In Profiles
|
For Each oProfile In Profiles
|
||||||
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
|
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
|
||||||
oProfiles.Add(oProfile)
|
oProfiles.Add(oProfile)
|
||||||
_Logger.Info("Profile {0} matched in FilterProfilesBySearchResults!", oProfile.Name)
|
_Logger.Info("Profile [{0}] matched in FilterProfilesBySearchResults!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user