This commit is contained in:
Jonathan Jenne
2022-01-21 15:51:14 +01:00
parent 408dacf1b5
commit 0fa654bda0
6 changed files with 64 additions and 27 deletions

View File

@@ -278,7 +278,7 @@ Public Class MSSQLServer
End Try
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
Return GetDatatable(SqlCommand, _Timeout)
End Function
@@ -294,19 +294,19 @@ Public Class MSSQLServer
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetDatatable(SqlCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As DataTable
Using oSqlConnection = GetSQLConnection()
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.ExternalTransaction, Transaction, Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Async Function GetDatatableAsync(SqlCommand As String, Optional Timeout As Integer = 120) As Task(Of DataTable)
Return Await Task.Run(Function() GetDatatable(SqlCommand, Timeout))
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetDatatableWithConnection(SqlCommand As String, ConnectionString As String, Optional Timeout As Integer = 120) As DataTable
Using oConnection = GetConnection(ConnectionString)
Return GetDatatableWithConnectionObject(SqlCommand, oConnection, Timeout:=Timeout)
@@ -342,33 +342,33 @@ Public Class MSSQLServer
Return oTable
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean Implements IDatabase.ExecuteNonQuery
Using oConnection = GetSQLConnection()
Return ExecuteNonQueryWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, _Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean Implements IDatabase.ExecuteNonQuery
Using oConnection = GetSQLConnection()
Return ExecuteNonQueryWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function ExecuteNonQuery(SQLCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As Boolean
Using oConnection = GetSQLConnection()
Return ExecuteNonQueryWithConnectionObject(SQLCommand, Transaction.Connection, TransactionMode.ExternalTransaction, Transaction, Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Async Function ExecuteNonQueryAsync(SQLCommand As String, Optional Timeout As Integer = 120) As Task(Of Boolean)
Return Await Task.Run(Function() ExecuteNonQuery(SQLCommand, Timeout))
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function ExecuteNonQueryWithConnection(pSQLCommand As String, ConnString As String, Optional Timeout As Integer = 120) As Boolean
Using oConnection = GetConnection(ConnString)
Return ExecuteNonQueryWithConnectionObject(pSQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, Timeout)
@@ -399,33 +399,33 @@ Public Class MSSQLServer
End Try
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetScalarValue(SQLQuery As String) As Object Implements IDatabase.GetScalarValue
Using oConnection As SqlConnection = GetSQLConnection()
Return GetScalarValueWithConnectionObject(SQLQuery, oConnection)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetScalarValue(SQLCommand As String, Timeout As Integer) As Object Implements IDatabase.GetScalarValue
Using oConnection = GetSQLConnection()
Return GetScalarValueWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetScalarValue(SQLCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As Object
Using oConnection = GetSQLConnection()
Return GetScalarValueWithConnectionObject(SQLCommand, oConnection, TransactionMode.ExternalTransaction, Transaction, Timeout)
End Using
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Async Function GetScalarValueAsync(SQLQuery As String, Optional Timeout As Integer = 120) As Task(Of Object)
Return Await Task.Run(Function() GetScalarValue(SQLQuery, Timeout))
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetScalarValueWithConnection(SQLCommand As String, ConnectionString As String, Optional Timeout As Integer = 120) As Object
Using oConnection = GetConnection(ConnectionString)
Return GetScalarValueWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, Timeout)
@@ -490,7 +490,7 @@ Public Class MSSQLServer
End Try
End Function
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String) As Object
Return GetScalarValue(SQLCommand, OutputParameter, _Timeout)
End Function
@@ -521,7 +521,7 @@ Public Class MSSQLServer
End Try
End Sub
<DebuggerStepThrough()>
'<DebuggerStepThrough()>
Private Sub NewExecuteNonQueryAsync_Callback(ByVal result As IAsyncResult)
Dim command As SqlCommand = CType(result.AsyncState, SqlCommand)
Dim res = command.EndExecuteNonQuery(result)