WIP: Update Firebird
This commit is contained in:
parent
720b6955fd
commit
33bea6fcb7
@ -47,6 +47,7 @@ Imports System.Text.RegularExpressions
|
||||
''' </summary>
|
||||
Public Class Firebird
|
||||
Private _logger As Logger
|
||||
Private _logFactory As LogFactory
|
||||
Private _connectionServer As String
|
||||
Private _connectionDatabase As String
|
||||
Private _connectionUsername As String
|
||||
@ -64,7 +65,6 @@ Public Class Firebird
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
''' <summary>
|
||||
'''
|
||||
''' </summary>
|
||||
@ -76,27 +76,29 @@ Public Class Firebird
|
||||
''' <exception cref="Exceptions.DatabaseException"></exception>
|
||||
Public Sub New(LogFactory As LogFactory, Datasource As String, Database As String, User As String, Password As String)
|
||||
_logger = LogFactory.GetCurrentClassLogger()
|
||||
_logFactory = LogFactory
|
||||
|
||||
' Test the connection first
|
||||
Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password)
|
||||
Dim oConnection = GetConnection(oConnectionString)
|
||||
' If initial connection was successfully, close it
|
||||
oConnection?.Close()
|
||||
|
||||
If oConnection Is Nothing Then
|
||||
Throw New Exceptions.DatabaseException()
|
||||
End If
|
||||
|
||||
_connectionServer = Datasource
|
||||
_connectionDatabase = Database
|
||||
_connectionUsername = User
|
||||
_connectionPassword = Password
|
||||
_ConnectionString = oConnectionString
|
||||
|
||||
' Test the connection
|
||||
Dim oConnection = GetConnection()
|
||||
' If initial connection was successfully, close it
|
||||
oConnection?.Close()
|
||||
|
||||
If oConnection Is Nothing Then
|
||||
Throw New Exceptions.DatabaseException()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function GetConnection(ConnectionString As String) As FbConnection
|
||||
Public Function GetConnection() As FbConnection
|
||||
Try
|
||||
Dim oConnection = New FbConnection(ConnectionString)
|
||||
Dim oConnection = New FbConnection(_ConnectionString)
|
||||
oConnection.Open()
|
||||
_ConnectionEstablished = True
|
||||
_ConnectionFailed = False
|
||||
@ -135,7 +137,7 @@ Public Class Firebird
|
||||
''' <returns>True, if command was executed sucessfully. Otherwise false.</returns>
|
||||
Public Function ExecuteNonQuery(SqlCommand As String) As Boolean
|
||||
Try
|
||||
Dim oConnection As FbConnection = GetConnection(ConnectionString)
|
||||
Dim oConnection As FbConnection = GetConnection()
|
||||
|
||||
If oConnection Is Nothing Then
|
||||
Return False
|
||||
@ -165,7 +167,7 @@ Public Class Firebird
|
||||
''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns>
|
||||
Public Function GetScalarValue(SqlQuery As String) As Object
|
||||
Try
|
||||
Dim oConnection As FbConnection = GetConnection(ConnectionString)
|
||||
Dim oConnection As FbConnection = GetConnection()
|
||||
|
||||
If oConnection Is Nothing Then
|
||||
Return Nothing
|
||||
@ -196,7 +198,7 @@ Public Class Firebird
|
||||
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
|
||||
Public Function GetDatatable(SqlQuery As String) As DataTable
|
||||
Try
|
||||
Dim oConnection As FbConnection = GetConnection(ConnectionString)
|
||||
Dim oConnection As FbConnection = GetConnection()
|
||||
|
||||
If oConnection Is Nothing Then
|
||||
Return Nothing
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user