EDMIService: fix wrong return type of getscalarvaluemethod

This commit is contained in:
Jonathan Jenne 2022-01-18 15:25:12 +01:00
parent 6b389bfed2
commit a29f058d58

View File

@ -17,18 +17,18 @@ Namespace Methods.Database.GetScalarValue
''' </summary>
Public Function Run(pData As GetScalarValueRequest) As GetScalarValueResponse
Try
Dim oDatatable As DataTable = Nothing
Dim oResult As Object = Nothing
Select Case pData.DatabaseType
Case DatabaseType.MSSQL
If pData.NamedDatabase = DatabaseName.None Then
oDatatable = GetScalarValueByConnectionId(pData.SqlCommand, pData.ConnectionId)
oResult = GetScalarValueByConnectionId(pData.SqlCommand, pData.ConnectionId)
ElseIf pData.NamedDatabase = DatabaseName.ECM Then
oDatatable = DatabaseECM.GetScalarValue(pData.SqlCommand)
oResult = DatabaseECM.GetScalarValue(pData.SqlCommand)
ElseIf pData.NamedDatabase = DatabaseName.IDB Then
oDatatable = DatabaseIDB.GetScalarValue(pData.SqlCommand)
oResult = DatabaseIDB.GetScalarValue(pData.SqlCommand)
Else
LogAndThrow($"Unsupported Named Database supplied. SQL Command [{pData.SqlCommand}] was not executed!")
@ -40,11 +40,11 @@ Namespace Methods.Database.GetScalarValue
End Select
If oDatatable Is Nothing Then
If oResult Is Nothing Then
LogAndThrow($"SQL Command did not return any results: [{pData.SqlCommand}]!")
End If
Return New GetScalarValueResponse(oDatatable)
Return New GetScalarValueResponse(oResult)
Catch ex As Exception
Logger.Warn("Error occurred while getting database scalar value!")
Logger.Error(ex)
@ -52,7 +52,7 @@ Namespace Methods.Database.GetScalarValue
End Try
End Function
Private Function GetScalarValueByConnectionId(pSQLCommand As String, pConnectionId As Integer) As DataTable
Private Function GetScalarValueByConnectionId(pSQLCommand As String, pConnectionId As Integer) As Object
If pConnectionId = 0 Then
Return DatabaseECM.GetScalarValue(pSQLCommand)
Else