Compare commits
4 Commits
737320d886
...
7b035bd3f7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b035bd3f7 | ||
|
|
8a0b849479 | ||
|
|
43ba8e534e | ||
|
|
1c4b05d8d2 |
@@ -1,6 +1,7 @@
|
|||||||
Imports FirebirdSql.Data.FirebirdClient
|
Imports FirebirdSql.Data.FirebirdClient
|
||||||
Imports System.Text.RegularExpressions
|
Imports System.Text.RegularExpressions
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports System.ComponentModel
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' MODULE: Firebird
|
''' MODULE: Firebird
|
||||||
@@ -56,8 +57,11 @@ Public Class Firebird
|
|||||||
Public _DBInitialized As Boolean = False
|
Public _DBInitialized As Boolean = False
|
||||||
|
|
||||||
Public Enum TransactionMode
|
Public Enum TransactionMode
|
||||||
|
<Description("Use no transaction, neither internal nor external")>
|
||||||
NoTransaction
|
NoTransaction
|
||||||
|
<Description("Use the transaction supplied in the Transaction Parameter")>
|
||||||
ExternalTransaction
|
ExternalTransaction
|
||||||
|
<Description("Create an internal transaction on the fly")>
|
||||||
WithTransaction
|
WithTransaction
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
|
|||||||
@@ -271,17 +271,24 @@ Public Class ImportZUGFeRDFiles
|
|||||||
End If
|
End If
|
||||||
Dim oDelSQL = $"DELETE FROM TBEDMI_ITEM_VALUE where REFERENCE_GUID = '{oMessageId}'"
|
Dim oDelSQL = $"DELETE FROM TBEDMI_ITEM_VALUE where REFERENCE_GUID = '{oMessageId}'"
|
||||||
Dim oStep As String
|
Dim oStep As String
|
||||||
|
|
||||||
|
|
||||||
|
oStep = "Firebird TBEDMI_ITEM_VALUE Delete messageID Items"
|
||||||
Try
|
Try
|
||||||
oStep = "Firebird TBEDMI_ITEM_VALUE Delete messageID Items"
|
|
||||||
_firebird.ExecuteNonQueryWithConnection(oDelSQL, oConnection, Firebird.TransactionMode.WithTransaction)
|
_firebird.ExecuteNonQueryWithConnection(oDelSQL, oConnection, Firebird.TransactionMode.WithTransaction)
|
||||||
If oArgs.InsertIntoSQLServer = True Then
|
|
||||||
oStep = "MSSQL TBEDMI_ITEM_VALUE Delete messageID Items"
|
|
||||||
_mssql.ExecuteNonQuery(oDelSQL)
|
|
||||||
End If
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Warn($"Delete Command [{oDelSQL}] was not successful.")
|
_logger.Error(ex)
|
||||||
|
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
If oArgs.InsertIntoSQLServer = True Then
|
||||||
|
oStep = "MSSQL TBEDMI_ITEM_VALUE Delete messageID Items"
|
||||||
|
Try
|
||||||
|
_mssql.ExecuteNonQuery(oDelSQL)
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
For Each oProperty In oCheckResult.ValidProperties
|
For Each oProperty In oCheckResult.ValidProperties
|
||||||
Dim oGroupCounterValue = oProperty.GroupCounter
|
Dim oGroupCounterValue = oProperty.GroupCounter
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.3.0.8")>
|
<Assembly: AssemblyVersion("1.3.0.9")>
|
||||||
<Assembly: AssemblyFileVersion("1.3.0.8")>
|
<Assembly: AssemblyFileVersion("1.3.0.9")>
|
||||||
|
|||||||
@@ -27,36 +27,66 @@ Public Class JobListener
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub ReplaceExistingTable(Name As String, Table As DataTable, DataSet As DataSet, Optional ChildTable As DataTable = Nothing)
|
Public Sub ReplaceExistingTable(Name As String, Table As DataTable, DataSet As DataSet, Optional ChildTable As DataTable = Nothing)
|
||||||
Dim oDatatableNameTemp As String = Name & "-TEMP"
|
Try
|
||||||
|
Dim oDatatableNameTemp As String = Name & "-TEMP"
|
||||||
|
|
||||||
_Logger.Debug("DataTable [{0}] exists, renaming and replacing in DataSet", Name)
|
_Logger.Debug("DataTable [{0}] exists, renaming and replacing in DataSet", Name)
|
||||||
' Rename the new table, add TEMP suffix
|
|
||||||
Table.TableName = oDatatableNameTemp
|
|
||||||
|
|
||||||
' If child table exists, remove all connections to it
|
' Rename the new table, add TEMP suffix
|
||||||
If ChildTable IsNot Nothing Then
|
_Logger.Debug("Renaming new table [{0}] to [{1}]", Name, oDatatableNameTemp)
|
||||||
' Get name for relations and constraints
|
Table.TableName = oDatatableNameTemp
|
||||||
Dim oRelationName = GetRelationName(Name, ChildTable.TableName)
|
|
||||||
|
|
||||||
' Remove the relation
|
' If child table exists, remove all connections to it
|
||||||
Dim oRelation As DataRelation = DataSet.Relations.Item(oRelationName)
|
If ChildTable IsNot Nothing Then
|
||||||
DataSet.Relations.Remove(oRelation)
|
_Logger.Debug("Removing relations/constraints on [{0}] and [{1}]", ChildTable.TableName, Name)
|
||||||
|
|
||||||
' Remove the constraint
|
' Remove relations/constraints on child table
|
||||||
Dim oConstraint As Constraint = ChildTable.Constraints.Item(oRelationName)
|
Dim oChildTable As DataTable = DataSet.Tables.Item(ChildTable.TableName)
|
||||||
ChildTable.Constraints.Remove(oConstraint)
|
If oChildTable IsNot Nothing Then
|
||||||
End If
|
oChildTable.Constraints.Clear()
|
||||||
|
oChildTable.ChildRelations.Clear()
|
||||||
|
End If
|
||||||
|
|
||||||
' Remove the temp table if it exists
|
' Remove relations/constraints on parent table
|
||||||
If DataSet.Tables.Contains(oDatatableNameTemp) Then
|
Dim oParentTable As DataTable = DataSet.Tables.Item(Name)
|
||||||
DataSet.Tables.Remove(Table)
|
If oParentTable IsNot Nothing Then
|
||||||
End If
|
oParentTable.Constraints.Clear()
|
||||||
|
oParentTable.ChildRelations.Clear()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
' Add the new table to the dataset
|
' Remove the temp table if it exists
|
||||||
DataSet.Tables.Add(Table)
|
If DataSet.Tables.Contains(oDatatableNameTemp) Then
|
||||||
|
_Logger.Debug("Removing Table [{0}]", oDatatableNameTemp)
|
||||||
|
|
||||||
' Rename the new table
|
DataSet.Tables.Item(oDatatableNameTemp).ChildRelations.Clear()
|
||||||
DataSet.Tables.Item(oDatatableNameTemp).TableName = Name
|
DataSet.Tables.Item(oDatatableNameTemp).Constraints.Clear()
|
||||||
|
DataSet.Tables.Remove(oDatatableNameTemp)
|
||||||
|
Else
|
||||||
|
_Logger.Debug("Table [{0}] does not exist, skipping removal.", oDatatableNameTemp)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Remove the current Table
|
||||||
|
If DataSet.Tables.Contains(Name) Then
|
||||||
|
_Logger.Debug("Removing Table [{0}]", Name)
|
||||||
|
|
||||||
|
DataSet.Tables.Item(Name).Constraints.Clear()
|
||||||
|
DataSet.Tables.Remove(Name)
|
||||||
|
Else
|
||||||
|
_Logger.Debug("Table [{0}] does not exist, skipping removal.", Name)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Add the new table to the dataset
|
||||||
|
_Logger.Debug("Adding Table [{0}] to Dataset", Table.TableName)
|
||||||
|
DataSet.Tables.Add(Table)
|
||||||
|
|
||||||
|
' Rename the new table
|
||||||
|
_Logger.Debug("Renaming new table [{0}] to [{1}]", oDatatableNameTemp, Name)
|
||||||
|
DataSet.Tables.Item(oDatatableNameTemp).TableName = Name
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
Throw ex
|
||||||
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub AddNewTable(Name As String, Table As DataTable, DataSet As DataSet)
|
Public Sub AddNewTable(Name As String, Table As DataTable, DataSet As DataSet)
|
||||||
@@ -118,6 +148,9 @@ Public Class JobListener
|
|||||||
Dim oDetailId As Integer = DetailRow.Item("GUID")
|
Dim oDetailId As Integer = DetailRow.Item("GUID")
|
||||||
Dim oDatatableNameTemp As String = oName & "-TEMP"
|
Dim oDatatableNameTemp As String = oName & "-TEMP"
|
||||||
|
|
||||||
|
' Used for debugging relations and constraints
|
||||||
|
'ListTables(Dataset)
|
||||||
|
|
||||||
If Dataset.Tables.Contains(oName) Then
|
If Dataset.Tables.Contains(oName) Then
|
||||||
' Replace existing table
|
' Replace existing table
|
||||||
If Result.ChildTable IsNot Nothing Then
|
If Result.ChildTable IsNot Nothing Then
|
||||||
@@ -153,6 +186,25 @@ Public Class JobListener
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ListTables(dataset As DataSet)
|
||||||
|
Dim oIndex As Integer = 1
|
||||||
|
|
||||||
|
For Each oTable As DataTable In dataset.Tables
|
||||||
|
_Logger.Debug("Table: [{0}] ({1})", oTable.TableName, oIndex)
|
||||||
|
|
||||||
|
_Logger.Debug("-> Listing Constraints for [{0}]:", oTable.TableName)
|
||||||
|
For Each oConstraint As Constraint In oTable.Constraints
|
||||||
|
_Logger.Debug("---> Constraint: [{0}]", oConstraint.ConstraintName)
|
||||||
|
Next
|
||||||
|
|
||||||
|
_Logger.Debug("-> Listing Child-Relations for [{0}]:", oTable.TableName)
|
||||||
|
For Each oRelation As DataRelation In oTable.ChildRelations
|
||||||
|
_Logger.Debug("---> Relation: [{0}] ", oRelation.RelationName)
|
||||||
|
Next
|
||||||
|
|
||||||
|
oIndex += 1
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
Public Overrides Function JobWasExecuted(context As IJobExecutionContext, jobException As JobExecutionException, Optional cancellationToken As CancellationToken = Nothing) As Task
|
Public Overrides Function JobWasExecuted(context As IJobExecutionContext, jobException As JobExecutionException, Optional cancellationToken As CancellationToken = Nothing) As Task
|
||||||
Dim oDetailRow As DataRow = context.MergedJobDataMap.Item("CronJobDetails")
|
Dim oDetailRow As DataRow = context.MergedJobDataMap.Item("CronJobDetails")
|
||||||
|
|||||||
Reference in New Issue
Block a user