Database: more fixes
This commit is contained in:
parent
ce7b4ce21c
commit
d506d92a9b
@ -58,6 +58,7 @@ Public Class MSSQLServer
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="ConnectionString">A connection string with a plain-text password</param>
|
''' <param name="ConnectionString">A connection string with a plain-text password</param>
|
||||||
''' <returns>The connection string with the password encrypted.</returns>
|
''' <returns>The connection string with the password encrypted.</returns>
|
||||||
|
<DebuggerStepThrough()>
|
||||||
Public Shared Function EncryptConnectionString(ConnectionString As String) As String
|
Public Shared Function EncryptConnectionString(ConnectionString As String) As String
|
||||||
Dim oEncryption As New EncryptionLegacy()
|
Dim oEncryption As New EncryptionLegacy()
|
||||||
Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = ConnectionString}
|
Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = ConnectionString}
|
||||||
@ -72,6 +73,7 @@ Public Class MSSQLServer
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="ConnectionString">A connection string with a encrypted password</param>
|
''' <param name="ConnectionString">A connection string with a encrypted password</param>
|
||||||
''' <returns>The connection string with the password decrypted.</returns>
|
''' <returns>The connection string with the password decrypted.</returns>
|
||||||
|
<DebuggerStepThrough()>
|
||||||
Public Shared Function DecryptConnectionString(ConnectionString As String) As String
|
Public Shared Function DecryptConnectionString(ConnectionString As String) As String
|
||||||
Dim oEncryption As New EncryptionLegacy()
|
Dim oEncryption As New EncryptionLegacy()
|
||||||
Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = ConnectionString}
|
Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = ConnectionString}
|
||||||
@ -178,10 +180,12 @@ Public Class MSSQLServer
|
|||||||
Return connectionString
|
Return connectionString
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
<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))
|
||||||
@ -195,6 +199,7 @@ 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
|
||||||
@ -226,10 +231,12 @@ Public Class MSSQLServer
|
|||||||
Return Connection
|
Return Connection
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
<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)
|
||||||
@ -246,6 +253,7 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
<DebuggerStepThrough()>
|
||||||
Private Function MaskConnectionString(ConnectionString As String) As String
|
Private Function MaskConnectionString(ConnectionString As String) As String
|
||||||
Try
|
Try
|
||||||
If ConnectionString Is Nothing OrElse ConnectionString.Length = 0 Then
|
If ConnectionString Is Nothing OrElse ConnectionString.Length = 0 Then
|
||||||
@ -489,6 +497,7 @@ 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)
|
||||||
|
|
||||||
@ -509,6 +518,7 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
<DebuggerStepThrough()>
|
||||||
Private Sub NewExecuteNonQueryAsync_Callback(ByVal result As IAsyncResult)
|
Private Sub NewExecuteNonQueryAsync_Callback(ByVal result As IAsyncResult)
|
||||||
Dim command As SqlCommand = CType(result.AsyncState, SqlCommand)
|
Dim command As SqlCommand = CType(result.AsyncState, SqlCommand)
|
||||||
Dim res = command.EndExecuteNonQuery(result)
|
Dim res = command.EndExecuteNonQuery(result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user