EDMIService: Improve logging, avoid confusion with import file methods

This commit is contained in:
Jonathan Jenne
2022-04-20 13:38:59 +02:00
parent 4e07e23c88
commit 70807ee06f
5 changed files with 89 additions and 10 deletions

View File

@@ -76,19 +76,22 @@ Namespace IDB
Public Function TestFileChecksumExists(pChecksum As String) As Long
Try
Logger.Debug("Checking for Checksum [{0}]..", pChecksum)
Dim oChecksumSQL = $"SELECT IDB_OBJ_ID FROM TBIDB_FILE_OBJECT WHERE FILE_HASH = '{pChecksum}'"
Dim oExistingObjectId As Long = Database.GetScalarValue(oChecksumSQL)
If oExistingObjectId > 0 Then
Logger.Info("Returning early with ObjectId [{0}] because Checksum [{1}] already exists.", oExistingObjectId, pChecksum)
Logger.Info("Returning with ObjectId [{0}] because Checksum [{1}] already exists.", oExistingObjectId, pChecksum)
Return oExistingObjectId
End If
Return Nothing
Logger.Debug("Checksum does not exist.")
Return 0
Catch ex As Exception
Logger.Error(ex)
Return Nothing
Return 0
End Try
End Function