ClipboardWatcher: Use connectionId when executing search count command

This commit is contained in:
Jonathan Jenne
2020-06-16 15:40:31 +02:00
parent 90015cd7e4
commit 50a158ea5c
4 changed files with 34 additions and 24 deletions

View File

@@ -361,19 +361,25 @@ Public Class ProfileFilter
For Each oRow As DataRow In oDTDataSearches.Rows
Dim oCountCommand = String.Empty
Dim oCountConnectionId = String.Empty
Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
If oCountCommand = String.Empty Then
_Logger.Debug("oCountCommand = String.Empty ==> Continue for")
_Logger.Debug("oCountCommand = String.Empty ==> Continue for")
Continue For
End If
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
_Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]")
oResultData += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
Catch ex As Exception
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
End Try