Database: remove baseclass
This commit is contained in:
@@ -2,13 +2,11 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class MSSQLServer
|
||||
Inherits BaseClass
|
||||
|
||||
Public DBInitialized As Boolean = False
|
||||
Public CurrentSQLConnectionString As String = ""
|
||||
|
||||
Private _Timeout As Integer
|
||||
Private _Logger As Logger
|
||||
Private ReadOnly _Timeout As Integer
|
||||
Private ReadOnly _Logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, ConnectionString As String, Optional Timeout As Integer = 120)
|
||||
_Logger = LogConfig.GetLogger()
|
||||
@@ -77,7 +75,7 @@ Public Class MSSQLServer
|
||||
''' </summary>
|
||||
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
||||
''' <returns>Returns a datatable</returns>
|
||||
Public Overrides Function GetDatatable(SqlCommand As String) As DataTable
|
||||
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable
|
||||
Try
|
||||
If TestCanConnect() = False Then
|
||||
Return Nothing
|
||||
@@ -86,7 +84,7 @@ Public Class MSSQLServer
|
||||
Using oConnection = GetSQLConnection()
|
||||
Using oSQLCOmmand = oConnection.CreateCommand()
|
||||
oSQLCOmmand.CommandText = SqlCommand
|
||||
oSQLCOmmand.CommandTimeout = _Timeout
|
||||
oSQLCOmmand.CommandTimeout = Timeout
|
||||
|
||||
Dim dt As DataTable = New DataTable()
|
||||
Dim oAdapter As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand)
|
||||
@@ -101,6 +99,10 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetDatatable(SqlCommand As String) As DataTable
|
||||
Return GetDatatable(SqlCommand, _Timeout)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Executes the passed sql-statement
|
||||
''' </summary>
|
||||
@@ -112,7 +114,7 @@ Public Class MSSQLServer
|
||||
Return ExecuteNonQuery(executeStatement)
|
||||
End Function
|
||||
|
||||
Public Overrides Function ExecuteNonQuery(SQLCommand As String) As Boolean
|
||||
Public Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean
|
||||
Try
|
||||
If TestCanConnect() = False Then
|
||||
Return Nothing
|
||||
@@ -121,7 +123,7 @@ Public Class MSSQLServer
|
||||
Using oConnection = GetSQLConnection()
|
||||
Using oSQLCOmmand = oConnection.CreateCommand()
|
||||
oSQLCOmmand.CommandText = SQLCommand
|
||||
oSQLCOmmand.CommandTimeout = _Timeout
|
||||
oSQLCOmmand.CommandTimeout = Timeout
|
||||
oSQLCOmmand.ExecuteNonQuery()
|
||||
Return True
|
||||
End Using
|
||||
@@ -133,6 +135,10 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean
|
||||
Return ExecuteNonQuery(SQLCommand, _Timeout)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Executes the passed sql-statement as Scalar
|
||||
''' </summary>
|
||||
@@ -143,7 +149,7 @@ Public Class MSSQLServer
|
||||
Return GetScalarValue(ScalarSQL)
|
||||
End Function
|
||||
|
||||
Public Overrides Function GetScalarValue(SQLQuery As String) As Object
|
||||
Public Function GetScalarValue(SQLQuery As String, Timeout As Integer) As Object
|
||||
Try
|
||||
If TestCanConnect() = False Then
|
||||
Return Nothing
|
||||
@@ -152,7 +158,7 @@ Public Class MSSQLServer
|
||||
Using oConnection As SqlConnection = GetSQLConnection()
|
||||
Using oSQLCOmmand = oConnection.CreateCommand()
|
||||
oSQLCOmmand.CommandText = SQLQuery
|
||||
oSQLCOmmand.CommandTimeout = _Timeout
|
||||
oSQLCOmmand.CommandTimeout = Timeout
|
||||
Dim oResult As Object = oSQLCOmmand.ExecuteScalar()
|
||||
Return oResult
|
||||
End Using
|
||||
@@ -163,6 +169,10 @@ Public Class MSSQLServer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetScalarValue(SQLQuery As String) As Object
|
||||
Return GetScalarValue(SQLQuery, _Timeout)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Executes the passed sql-statement in asyncmode
|
||||
''' </summary>
|
||||
|
||||
Reference in New Issue
Block a user