3 Commits

Author SHA1 Message Date
Jonathan Jenne
a3e1d34a7a Merge branch 'master' of http://git.dd:3000/AppStd/Modules 2024-01-18 15:54:48 +01:00
Jonathan Jenne
a53c5154b0 jobs: version 2.4.0.0 2024-01-18 15:54:36 +01:00
Jonathan Jenne
6e5b192fb6 graphql: create history table before running 2024-01-18 15:54:25 +01:00
2 changed files with 29 additions and 9 deletions

View File

@@ -120,7 +120,11 @@ Public Class GraphQLJob
' Clear Table before inserting
If pQuery.ClearBeforeFill = True Then
If DeleteWithQueryName(pQuery) = False Then
Throw New ApplicationException($"Error while clearing table before fill for Query [{pQuery.Name}]")
Throw New ApplicationException($"Error while dropping history table before fill for Query [{pQuery.Name}]")
End If
If CreateHistoryTable(pQuery) = False Then
Throw New ApplicationException($"Error while creating history table before fill for Query [{pQuery.Name}]")
End If
End If
@@ -196,12 +200,28 @@ Public Class GraphQLJob
End Try
End Function
Private Function DeleteWithQueryName(pQuery)
Dim oDeleteSQL = $"TRUNCATE TABLE {pQuery.DestinationTable}"
Return _MSSQL.ExecuteNonQuery(oDeleteSQL)
Private Function DeleteWithQueryName(pQuery As GraphQL.Query) As Boolean
Dim oHistoryTableName = $"{pQuery.DestinationTable}_HISTORY"
Dim oDeleteHistorySQL = $"
IF (EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = '{oHistoryTableName}'))
BEGIN
DROP TABLE {oHistoryTableName};
END"
Return _MSSQL.ExecuteNonQuery(oDeleteHistorySQL)
End Function
Private Function DeleteWithStatus(pQuery As Query, pStatus As Integer)
Private Function CreateHistoryTable(pQuery As Query) As Boolean
Dim oHistoryTableName = $"{pQuery.DestinationTable}_HISTORY"
Dim oFillHistorySQL = $"SELECT * INTO {oHistoryTableName} FROM {pQuery.DestinationTable}"
Return _MSSQL.ExecuteNonQuery(oFillHistorySQL)
End Function
Private Function DeleteWithStatus(pQuery As Query, pStatus As Integer) As Boolean
Dim oDeleteSQL = $"DELETE FROM {pQuery.DestinationTable} WHERE STATUS = {pStatus} AND ADDED_QUERY_ID = '{pQuery.Id}'"
Return _MSSQL.ExecuteNonQuery(oDeleteSQL)
End Function

View File

@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Modules.Jobs")>
<Assembly: AssemblyCopyright("Copyright © 2023")>
<Assembly: AssemblyTrademark("2.3.0.1")>
<Assembly: AssemblyCopyright("Copyright © 2024")>
<Assembly: AssemblyTrademark("2.4.0.0")>
<Assembly: ComVisible(False)>
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
<Assembly: AssemblyVersion("2.3.0.1")>
<Assembly: AssemblyFileVersion("2.3.0.1")>
<Assembly: AssemblyVersion("2.4.0.0")>
<Assembly: AssemblyFileVersion("2.4.0.0")>