Database: Make most functions DebuggerStepThrough
This commit is contained in:
parent
6a92ac637f
commit
3e496cbb4b
@ -81,6 +81,7 @@ Public Class MSSQLServer
|
||||
Return oBuilder.ToString()
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetConnectionString(Server As String, Database As String, UserId As String, Password As String) As String
|
||||
Dim oConnectionStringBuilder As New SqlConnectionStringBuilder() With {
|
||||
.DataSource = Server,
|
||||
@ -92,6 +93,7 @@ Public Class MSSQLServer
|
||||
Return oConnectionStringBuilder.ToString
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetConnection() As SqlConnection
|
||||
Try
|
||||
Dim oConnection = GetSQLConnection()
|
||||
@ -102,6 +104,7 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Private Function MaybeGetTransaction(Connection As SqlConnection, Mode As TransactionMode, Transaction As SqlTransaction) As SqlTransaction
|
||||
If Connection Is Nothing Then
|
||||
Throw New ArgumentNullException("Connection")
|
||||
@ -116,6 +119,7 @@ Public Class MSSQLServer
|
||||
End If
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Private Function MaybeCommitTransaction(Transaction As SqlTransaction, TransactionMode As TransactionMode) As Boolean
|
||||
Select Case TransactionMode
|
||||
Case TransactionMode.NoTransaction
|
||||
@ -257,6 +261,7 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
|
||||
Return GetDatatable(SqlCommand, _Timeout)
|
||||
End Function
|
||||
@ -266,6 +271,7 @@ Public Class MSSQLServer
|
||||
''' </summary>
|
||||
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
||||
''' <returns>Returns a datatable</returns>
|
||||
''' <DebuggerStepThrough()>
|
||||
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable Implements IDatabase.GetDatatable
|
||||
Using oSqlConnection = GetSQLConnection()
|
||||
Return GetDatatableWithConnectionObject(SqlCommand, oSqlConnection, TransactionMode.WithTransaction, Nothing, Timeout)
|
||||
@ -278,16 +284,19 @@ Public Class MSSQLServer
|
||||
End Using
|
||||
End Function
|
||||
|
||||
<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()>
|
||||
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)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetDatatableWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -317,34 +326,40 @@ Public Class MSSQLServer
|
||||
Return oTable
|
||||
End Function
|
||||
|
||||
<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()>
|
||||
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()>
|
||||
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()>
|
||||
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()>
|
||||
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)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function ExecuteNonQueryWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -369,35 +384,40 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
<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()>
|
||||
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()>
|
||||
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()>
|
||||
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()>
|
||||
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)
|
||||
End Using
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetScalarValueWithConnectionObject(SqlCommand As String, SqlConnection As SqlConnection,
|
||||
Optional TransactionMode As TransactionMode = TransactionMode.WithTransaction,
|
||||
Optional Transaction As SqlTransaction = Nothing,
|
||||
@ -424,6 +444,7 @@ Public Class MSSQLServer
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String, Timeout As Integer) As Object
|
||||
Try
|
||||
If TestCanConnect() = False Then
|
||||
@ -456,6 +477,7 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
<DebuggerStepThrough()>
|
||||
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String) As Object
|
||||
Return GetScalarValue(SQLCommand, OutputParameter, _Timeout)
|
||||
End Function
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user