Database: Add debugger step through attributes
This commit is contained in:
parent
1102542d26
commit
7e952093c7
@ -141,7 +141,7 @@ Public Class MSSQLServer
|
|||||||
End Select
|
End Select
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer)
|
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
|
||||||
Dim connectionString As String = ""
|
Dim connectionString As String = ""
|
||||||
Try
|
Try
|
||||||
Dim oDTConnection As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
Dim oDTConnection As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
||||||
@ -180,12 +180,11 @@ Public Class MSSQLServer
|
|||||||
Return connectionString
|
Return connectionString
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Private Function TestCanConnect() As Boolean
|
Private Function TestCanConnect() As Boolean
|
||||||
Return TestCanConnect(CurrentSQLConnectionString)
|
Return TestCanConnect(CurrentSQLConnectionString)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Private Function TestCanConnect(ConnectionString As String) As Boolean
|
Private Function TestCanConnect(ConnectionString As String) As Boolean
|
||||||
Try
|
Try
|
||||||
_Logger.Debug("Testing connection to [{0}]", MaskConnectionString(ConnectionString))
|
_Logger.Debug("Testing connection to [{0}]", MaskConnectionString(ConnectionString))
|
||||||
@ -201,7 +200,6 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Private Function TestCanConnect(Connection As SqlConnection) As Boolean
|
Private Function TestCanConnect(Connection As SqlConnection) As Boolean
|
||||||
Try
|
Try
|
||||||
If Connection Is Nothing Then
|
If Connection Is Nothing Then
|
||||||
@ -225,7 +223,6 @@ Public Class MSSQLServer
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="Connection"></param>
|
''' <param name="Connection"></param>
|
||||||
''' <returns></returns>
|
''' <returns></returns>
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Private Function OpenSQLConnection(Connection As SqlConnection) As SqlConnection
|
Private Function OpenSQLConnection(Connection As SqlConnection) As SqlConnection
|
||||||
If Connection.State = ConnectionState.Closed Then
|
If Connection.State = ConnectionState.Closed Then
|
||||||
Connection.Open()
|
Connection.Open()
|
||||||
@ -234,12 +231,11 @@ Public Class MSSQLServer
|
|||||||
Return Connection
|
Return Connection
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Private Function GetSQLConnection() As SqlConnection
|
Private Function GetSQLConnection() As SqlConnection
|
||||||
Return GetConnection(CurrentSQLConnectionString)
|
Return GetConnection(CurrentSQLConnectionString)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Private Function GetConnection(ConnectionString As String) As SqlConnection
|
Private Function GetConnection(ConnectionString As String) As SqlConnection
|
||||||
Try
|
Try
|
||||||
Dim oConnection As New SqlConnection(ConnectionString)
|
Dim oConnection As New SqlConnection(ConnectionString)
|
||||||
@ -272,7 +268,7 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
|
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
|
||||||
Return GetDatatable(SqlCommand, _Timeout)
|
Return GetDatatable(SqlCommand, _Timeout)
|
||||||
End Function
|
End Function
|
||||||
@ -282,33 +278,31 @@ Public Class MSSQLServer
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
||||||
''' <returns>Returns a datatable</returns>
|
''' <returns>Returns a datatable</returns>
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable Implements IDatabase.GetDatatable
|
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable Implements IDatabase.GetDatatable
|
||||||
Using oSqlConnection = GetSQLConnection()
|
Using oSqlConnection = GetSQLConnection()
|
||||||
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.WithTransaction, Nothing, Timeout)
|
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.WithTransaction, Nothing, Timeout)
|
||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Public Function GetDatatable(SqlCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As DataTable
|
Public Function GetDatatable(SqlCommand As String, Transaction As SqlTransaction, Optional Timeout As Integer = 120) As DataTable
|
||||||
Using oSqlConnection = GetSQLConnection()
|
Using oSqlConnection = GetSQLConnection()
|
||||||
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.ExternalTransaction, Transaction, Timeout)
|
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.ExternalTransaction, Transaction, Timeout)
|
||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Public Async Function GetDatatableAsync(SqlCommand As String, Optional Timeout As Integer = 120) As Task(Of DataTable)
|
Public Async Function GetDatatableAsync(SqlCommand As String, Optional Timeout As Integer = 120) As Task(Of DataTable)
|
||||||
Return Await Task.Run(Function() GetDatatable(SqlCommand, Timeout))
|
Return Await Task.Run(Function() GetDatatable(SqlCommand, Timeout))
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Public Function GetDatatableWithConnection(SqlCommand As String, ConnectionString As String, Optional Timeout As Integer = 120) As DataTable
|
Public Function GetDatatableWithConnection(SqlCommand As String, ConnectionString As String, Optional Timeout As Integer = 120) As DataTable
|
||||||
Using oConnection = GetConnection(ConnectionString)
|
Using oConnection = GetConnection(ConnectionString)
|
||||||
Return GetDatatableWithConnectionObject(SqlCommand, oConnection, Timeout:=Timeout)
|
Return GetDatatableWithConnectionObject(SqlCommand, oConnection, Timeout:=Timeout)
|
||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Public Function GetDatatableWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
Public Function GetDatatableWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||||
Optional Transaction As SqlTransaction = Nothing,
|
Optional Transaction As SqlTransaction = Nothing,
|
||||||
@ -338,7 +332,7 @@ Public Class MSSQLServer
|
|||||||
Return oTable
|
Return oTable
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
<DebuggerStepThrough()>
|
||||||
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean Implements IDatabase.ExecuteNonQuery
|
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean Implements IDatabase.ExecuteNonQuery
|
||||||
Using oConnection = GetSQLConnection()
|
Using oConnection = GetSQLConnection()
|
||||||
Return ExecuteNonQueryWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, _Timeout)
|
Return ExecuteNonQueryWithConnectionObject(SQLCommand, oConnection, TransactionMode.WithTransaction, Nothing, _Timeout)
|
||||||
@ -371,7 +365,6 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
'<DebuggerStepThrough()>
|
|
||||||
Public Function ExecuteNonQueryWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
Public Function ExecuteNonQueryWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||||
Optional Transaction As SqlTransaction = Nothing,
|
Optional Transaction As SqlTransaction = Nothing,
|
||||||
@ -429,7 +422,6 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
<DebuggerStepThrough()>
|
|
||||||
Public Function GetScalarValueWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
Public Function GetScalarValueWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||||
Optional Transaction As SqlTransaction = Nothing,
|
Optional Transaction As SqlTransaction = Nothing,
|
||||||
@ -456,7 +448,6 @@ Public Class MSSQLServer
|
|||||||
Return oResult
|
Return oResult
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
<DebuggerStepThrough()>
|
|
||||||
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String, Timeout As Integer) As Object
|
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String, Timeout As Integer) As Object
|
||||||
Try
|
Try
|
||||||
If TestCanConnect() = False Then
|
If TestCanConnect() = False Then
|
||||||
@ -500,7 +491,6 @@ Public Class MSSQLServer
|
|||||||
''' <param name="SqlCommand">the sql statement</param>
|
''' <param name="SqlCommand">the sql statement</param>
|
||||||
''' <param name="commandtimeout">Optional Timeout</param>
|
''' <param name="commandtimeout">Optional Timeout</param>
|
||||||
''' <remarks></remarks>
|
''' <remarks></remarks>
|
||||||
<DebuggerStepThrough()>
|
|
||||||
Public Sub NewExecuteNonQueryAsync(SqlCommand As String, Optional commandtimeout As Integer = 120)
|
Public Sub NewExecuteNonQueryAsync(SqlCommand As String, Optional commandtimeout As Integer = 120)
|
||||||
_Logger.Debug("NewExecuteNonQueryAsync: Running Query [{0}]", SqlCommand)
|
_Logger.Debug("NewExecuteNonQueryAsync: Running Query [{0}]", SqlCommand)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user