MS SQL NI

This commit is contained in:
2022-06-23 17:23:57 +02:00
parent 990ce9f01b
commit 146a329171
12 changed files with 460 additions and 304 deletions

View File

@@ -6,6 +6,7 @@ Public Class ClassNIWindream
Private Shared _Logger As DigitalData.Modules.Logging.Logger
Private Shared _MyLogger As LogConfig
Private _selectedProfil As ClassNIProfil
Private database As ClassNIDatenbankzugriff
#Region "+++++ Konstanten +++++"
'Protected Const WMObjectEditModeObject = &H1F
Protected Const WMObjectStreamOpenModeReadWrite = 2
@@ -44,6 +45,7 @@ Public Class ClassNIWindream
MyBase.New(LogConfig)
_MyLogger = LogConfig
_Logger = _MyLogger.GetLogger
database = New ClassNIDatenbankzugriff(LogConfig)
End Sub
Private Function IsNotEmpty(ByVal aValue As Object)
@@ -67,9 +69,9 @@ Public Class ClassNIWindream
Private Function return_type(ByVal _wert As Object)
Return _wert.GetType
End Function
Public Shared Function GetIndex_Type(idxName) As String
Public Function GetIndex_Type(idxName) As String
Try
Dim oAttribute = ClassNIWindream.oWMSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, idxName)
Dim oAttribute = oWMSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, idxName)
'den Variablentyp (String, Integer, ...) auslesen
Dim vType = oAttribute.getVariableValue("dwAttrType")
Dim Type As String
@@ -278,7 +280,7 @@ Public Class ClassNIWindream
Return True
End Try
Else
_Logger.Warn("ACHTUNG: Fehler bei Locken der Datei (ClassNiWindream.RunIndexing): " & ex.Message)
_Logger.Warn($"ACHTUNG: Fehler bei Locken der Datei (ClassNiWindream.RunIndexing): " & ex.Message)
_Logger.Warn("Ergebnis CStr(dwflag): " & CStr(dwflag))
Return True
End If
@@ -289,11 +291,9 @@ Public Class ClassNIWindream
Dim i As Integer = 0
Dim indexname As String
Dim oLengthValues As Integer
Try
If aValues.Length = 1 And aValues(0) = "" Then
_Logger.Info("Indexwert ist leer/Nothing - Keine Nachindexierung 313")
_Logger.Info($"Indexwert ist leer/Nothing - Keine Nachindexierung 313 Dokument [{oDocument.aName}]")
End If
Catch ex As Exception
Try
@@ -312,15 +312,16 @@ Public Class ClassNIWindream
oDocument.aObjectType = Me.oWMSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, Objekttyp)
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
_Logger.Debug("Objekttyp '" & oDocument.aObjectType.aName & "' wurde in '" & Objekttyp & "' geändert.")
Try
oDocument.Save()
Catch ex As Exception
' wenn es einen Fehler beim speichern gab, dann konnte auch kein Dokumenttyp gesetzt werden -> es kann also auch keine
' Indexierung stattfinden und die Indexierung muss nicht fortgesetzt werden
Return False
End Try
End If
Try
oDocument.Save()
Catch ex As Exception
' wenn es einen Fehler beim speichern gab, dann konnte auch kein Dokumenttyp gesetzt werden -> es kann also auch keine
' Indexierung stattfinden und die Indexierung muss nicht fortgesetzt werden
Return False
End Try
'Jetzt jeden Indexwert durchlaufen
For Each aName As String In Indizes
@@ -575,7 +576,7 @@ Public Class ClassNIWindream
For Each DR In DT_VEKTOR.Rows
If DR.Item("IndexName") = aName.ToString Then
myArray(i1) = Convert_IndexValue(vType, value)
myArray(i1) = Convert_IndexValue(vType, DR.Item("Value"))
_Logger.Debug("Value (" & i1 & "): '" & DR.Item("Value").ToString & "'")
i1 = i1 + 1
@@ -589,7 +590,7 @@ Public Class ClassNIWindream
Dim VektorArray
Select Case Me._selectedProfil._links.selectedLink.vktins_state
Case 1
_Logger.Debug("vektInsState = '1' - Vekrotvalues will be replaced")
_Logger.Debug("vektInsState = '1' - Vektovalues will be replaced")
Dim z As Integer = 0
Try
ReDim VektorArray(myArray.Length)
@@ -624,8 +625,8 @@ Public Class ClassNIWindream
ReDim myArray(VektorArray.count - 1)
End Try
Dim oIndex As Integer = 0
For Each oStr As String In VektorArray
myArray(oIndex) = Convert_IndexValue(vType, oStr)
For Each oStr In VektorArray
myArray(oIndex) = oStr
oIndex += 1
Next
@@ -665,9 +666,7 @@ Public Class ClassNIWindream
Next
oDocument.unlock()
If My.Settings.vLogErrorsonly = False Then
_Logger.Debug(">> Unlock durchgeführt)")
End If
_Logger.Debug(">> Unlock durchgeführt)")
Return False
Else
_Logger.Info(">> Dokument ist gesperrt, Indexierung erst im nächsten Durchlauf!")
@@ -916,11 +915,11 @@ Public Class ClassNIWindream
#Region "+++++ Allgemeine Funktionen die Informationen zurückliefern +++++"
Public Function GetSearchDocuments(ByVal wdfLocation As String)
WMSearchIsSQL = False
wdfLocation = wdfLocation.Replace("W:", "\\windream\objects")
wdfLocation = wdfLocation.Replace("X:", "\\windream\objects")
wdfLocation = wdfLocation.Replace("U:", "\\windream\objects")
If System.IO.File.Exists(wdfLocation) Then
Try
Dim ProfileName = wdfLocation.Substring(wdfLocation.LastIndexOf("\") + 1)
Dim ProfilePath = wdfLocation.Substring(0, wdfLocation.Length - ProfileName.Length)
@@ -976,17 +975,22 @@ Public Class ClassNIWindream
_Logger.Debug("KEIN GÜLTIGER WINDREAM-SUCHTYP")
Return Nothing
End Select
Dim WMObjects As Object
'Dim WMObjects As Object
_Logger.Debug("Start der Suche: " & Now)
' System.Threading.Thread.Sleep(200000)
WMObjects = oSearch.Execute
'WMObjects = oSearch.Execute
Return oSearch.execute
Catch ex As Exception
' bei einem Fehler einen Eintrag in der Logdatei machen
_Logger.Error(ex)
Return Nothing
End Try
Else
If wdfLocation.ToUpper.Contains("SELECT") Or wdfLocation.ToUpper.Contains("EXEC") Then
WMSearchIsSQL = True
End If
End If
Return Nothing