Database: Log all command parameters
This commit is contained in:
parent
b927e07141
commit
2816b644da
@ -340,7 +340,7 @@ Public Class MSSQLServer
|
||||
pSqlCommandObject.CommandTimeout = pTimeout
|
||||
|
||||
Using oAdapter As New SqlDataAdapter(pSqlCommandObject)
|
||||
Logger.Debug("GetDatatableWithConnectionObject: Running Query [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Debug("GetDatatableWithConnectionObject: Running Query [{0}] and Parameters [{1}]", pSqlCommandObject.CommandText, GetParameterListAsString(pSqlCommandObject))
|
||||
oAdapter.Fill(oTable)
|
||||
End Using
|
||||
|
||||
@ -427,7 +427,7 @@ Public Class MSSQLServer
|
||||
Dim oTransaction As SqlTransaction = MaybeGetTransaction(pSqlConnection, pTransactionMode, pTransaction)
|
||||
|
||||
Try
|
||||
Logger.Debug("ExecuteNonQueryWithConnectionObject: Running Command [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Debug("ExecuteNonQueryWithConnectionObject: Running Command [{0}] and Parameters [{1}]", pSqlCommandObject.CommandText, GetParameterListAsString(pSqlCommandObject))
|
||||
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
pSqlCommandObject.Transaction = oTransaction
|
||||
@ -517,6 +517,9 @@ Public Class MSSQLServer
|
||||
Dim oResult As Object = Nothing
|
||||
|
||||
Try
|
||||
|
||||
Logger.Debug("GetScalarValueWithConnectionObject: Running Query [{0}] with Parameters [{1}]", pSqlCommandObject, GetParameterListAsString(pSqlCommandObject))
|
||||
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
pSqlCommandObject.CommandTimeout = pTimeout
|
||||
pSqlCommandObject.Transaction = oTransaction
|
||||
@ -601,4 +604,13 @@ Public Class MSSQLServer
|
||||
Dim res = command.EndExecuteNonQuery(result)
|
||||
Logger.Info("Finished executing Async database operation: {0}", command.CommandText)
|
||||
End Sub
|
||||
|
||||
Private Function GetParameterListAsString(pSQLCommand As SqlCommand) As String
|
||||
Dim oList = pSQLCommand.Parameters.
|
||||
Cast(Of SqlParameter).
|
||||
Select(Function(p) $"({p.ParameterName}={p.Value})").
|
||||
ToList()
|
||||
|
||||
Return String.Join(",", oList)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -99,7 +99,6 @@
|
||||
<Compile Include="Dispatcher.vb" />
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="Adapters\Firebird.vb" />
|
||||
<Compile Include="Helpers.vb" />
|
||||
<Compile Include="IDatabase.vb" />
|
||||
<Compile Include="Adapters\ODBC.vb" />
|
||||
<Compile Include="Adapters\Oracle.vb" />
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
Public Class Helpers
|
||||
|
||||
Public Shared Function MaybeEscapeSQLCommand(pSQLCommand As String) As String
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user