39 lines
1.4 KiB
VB.net
39 lines
1.4 KiB
VB.net
Public Class ClassIndexFunctions
|
|
Public Shared Function FileExistsinDropTable(Filename As String)
|
|
Dim oSQL As String
|
|
Dim oHash As String
|
|
|
|
Try
|
|
If Filename.Contains("'") Then
|
|
Filename = Filename.Replace("'", "''")
|
|
End If
|
|
|
|
Try
|
|
oHash = FILESYSTEM.GetChecksum(Filename)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
oHash = ""
|
|
End Try
|
|
|
|
oSQL = "SELECT COUNT(*) FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0"
|
|
Dim oResult = ClassDatabase.Execute_Scalar(oSQL, MyConnectionString, True)
|
|
|
|
If oResult = 0 Then
|
|
oSQL = "SELECT COUNT(*) FROM TBGI_HISTORY WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "')"
|
|
oResult = ClassDatabase.Execute_Scalar(oSQL, MyConnectionString, True)
|
|
|
|
If oResult = 0 Then
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
Else
|
|
Return True
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("Error in FileExistsinDropTable - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & oSQL, MsgBoxStyle.Critical)
|
|
Return Nothing
|
|
End Try
|
|
End Function
|
|
End Class
|