diff --git a/EDMDesigner/ClassCurrentUser.vb b/EDMDesigner/ClassCurrentUser.vb
index 71ae8052..434d4359 100644
--- a/EDMDesigner/ClassCurrentUser.vb
+++ b/EDMDesigner/ClassCurrentUser.vb
@@ -1,16 +1,15 @@
-Imports DD_FirebirdDLL
+Imports Modules.Database
Public Class ClassCurrentUser
Public Username As String
Public Language As String
- Private DB As ClassFirebird
+ Private DBFirebird As Firebird
- Public Sub New(DB As ClassFirebird)
+ Public Sub New(DBFirebird As Firebird)
Username = Environment.UserName
- DB = DB
Dim sql As String = $"SELECT FNGET_USER_ACCESS('edm','{Username}') FROM rdb$database"
- Dim result = DB.ReturnScalar(sql)
+ Dim result = DBFirebird.GetExecuteScalar(sql)
End Sub
End Class
diff --git a/EDMDesigner/ClassInit.vb b/EDMDesigner/ClassInit.vb
index 89ad1ef4..4377c72f 100644
--- a/EDMDesigner/ClassInit.vb
+++ b/EDMDesigner/ClassInit.vb
@@ -1,22 +1,22 @@
Imports System.IO
-Imports DD_FirebirdDLL
+Imports Modules.Database
Public Class ClassInit
Public Shared Function Init_user()
Try
USER_USERNAME = Environment.UserName
Dim sql = String.Format("select FNGET_USER_ACCESS('edm','{0}') from rdb$database", USER_USERNAME)
- Dim result = ClassDBFirebird.ExecuteScalar(sql, LOGGERFilePath)
+ 'Dim result = Firebird.ExecuteScalar(sql, LOGGERFilePath)
- sql = String.Format("SELECT * FROM VW_TBEDM_USER WHERE UPPER(LOGIN_NAME) = UPPER('{0}')", USER_USERNAME)
- DT_USER = ClassDBFirebird.ReturnDatatable(sql, LOGGERFilePath)
- If Not IsNothing(result) Then
- If Not IsNothing(DT_USER) Then
- USER_LANGUAGE = DT_USER.Rows(0).Item("LANGUAGE")
- End If
- Return result
- Else
- Return False
- End If
+ 'sql = String.Format("SELECT * FROM VW_TBEDM_USER WHERE UPPER(LOGIN_NAME) = UPPER('{0}')", USER_USERNAME)
+ 'DT_USER = ClassDBFirebird.ReturnDatatable(sql, LOGGERFilePath)
+ 'If Not IsNothing(result) Then
+ ' If Not IsNothing(DT_USER) Then
+ ' USER_LANGUAGE = DT_USER.Rows(0).Item("LANGUAGE")
+ ' End If
+ ' Return result
+ 'Else
+ ' Return False
+ 'End If
Catch ex As Exception
End Try
diff --git a/EDMDesigner/EDMDesigner.vbproj b/EDMDesigner/EDMDesigner.vbproj
index dd114a1a..fe51fd3f 100644
--- a/EDMDesigner/EDMDesigner.vbproj
+++ b/EDMDesigner/EDMDesigner.vbproj
@@ -47,9 +47,6 @@
On
-
- ..\..\DDFirebirdDLL\DD_FirebirdDLL\bin\Debug\DD_FirebirdDLL.dll
-
@@ -78,6 +75,9 @@
..\packages\FirebirdSql.Data.FirebirdClient.6.1.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll
+
+ ..\Modules.Database\bin\Debug\Modules.Database.dll
+
..\packages\NLog.4.5.8\lib\net45\NLog.dll
diff --git a/EDMDesigner/FrmConnection.vb b/EDMDesigner/FrmConnection.vb
index 406e72ef..983d6bcf 100644
--- a/EDMDesigner/FrmConnection.vb
+++ b/EDMDesigner/FrmConnection.vb
@@ -1,4 +1,4 @@
-Imports DD_FirebirdDLL
+Imports Modules.Database
Public Class FrmConnection
Private Sub FrmConnection_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@@ -11,7 +11,7 @@ Public Class FrmConnection
Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
My.Settings.Save()
- Dim dbTest As New ClassFirebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
+ Dim dbTest As New Firebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
If dbTest.ConnectionFailed Then
MsgBox("Connection failed!", MsgBoxStyle.Information, "Database Connection")
diff --git a/EDMDesigner/FrmMain.vb b/EDMDesigner/FrmMain.vb
index 8a5637fe..3cf6253a 100644
--- a/EDMDesigner/FrmMain.vb
+++ b/EDMDesigner/FrmMain.vb
@@ -1,11 +1,11 @@
-Imports DD_FirebirdDLL
+Imports Modules.Database
Imports Modules.Logging
Public Class FrmMain
Private SelectedTable As Integer
Private Logger As NLog.Logger
Private LogWrapper As Logger
- Private DB As ClassFirebird
+ Private DBFirebird As Firebird
Private Sub CreateTableNodesFromDatatable(dt As DataTable)
' Node der Datenbank erstellen
@@ -40,7 +40,7 @@ Public Class FrmMain
End Sub
Private Function LoadTables()
- Return DB.ReturnDatatable("SELECT DISTINCT T.TABLE_ID,T.""TABLE"" from VWEDM_TABLE_COLUMN T")
+ Return DBFirebird.GetDatatable("SELECT DISTINCT T.TABLE_ID,T.""TABLE"" from VWEDM_TABLE_COLUMN T")
End Function
Private Function DatabaseSettingsExist()
@@ -48,15 +48,15 @@ Public Class FrmMain
End Function
Private Sub Init()
- DB = New ClassFirebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
+ DBFirebird = New Firebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
- If DB.ConnectionFailed Then
+ If DBFirebird.ConnectionFailed Then
MsgBox("Database connection failed. Please check the log.", vbCritical)
Exit Sub
End If
' Get info about the logged in user
- CurrentUser = New ClassCurrentUser(DB)
+ CurrentUser = New ClassCurrentUser(DBFirebird)
Dim dt As DataTable = LoadTables()
CreateTableNodesFromDatatable(dt)
@@ -65,7 +65,7 @@ Public Class FrmMain
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
- LogWrapper = New Logger("EDMDesigner", ClassLogger.PathType.CurrentDirectory)
+ LogWrapper = New Logger(ClassLogger.PathType.CurrentDirectory)
Logger = NLog.LogManager.GetCurrentClassLogger()
@@ -120,7 +120,7 @@ Public Class FrmMain
End Sub
Private Sub SpaltenBearbeitenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpaltenBearbeitenToolStripMenuItem.Click
- Dim dt As DataTable = DB.ReturnDatatable($"SELECT * FROM VWEDM_TABLE_COLUMN WHERE TABLE_ID = {SelectedTable}")
+ Dim dt As DataTable = DBFirebird.GetDatatable($"SELECT * FROM VWEDM_TABLE_COLUMN WHERE TABLE_ID = {SelectedTable}")
gridControlTableProperties.DataSource = dt
End Sub
diff --git a/Modules.Database/App.config b/Modules.Database/App.config
new file mode 100644
index 00000000..18a57ef4
--- /dev/null
+++ b/Modules.Database/App.config
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Modules.Database/Firebird.vb b/Modules.Database/Firebird.vb
index 773cdce7..23fb391b 100644
--- a/Modules.Database/Firebird.vb
+++ b/Modules.Database/Firebird.vb
@@ -1,4 +1,167 @@
-Public Class Firebird
+Imports FirebirdSql.Data.FirebirdClient
+Public Class Firebird
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public DBInitialized As Boolean = False
+ Private _connectionEstablished As Boolean = False
+ Private _connectionFailed As Boolean = False
+ Private ReadOnly dataSource As String
+ Private ReadOnly database As String
+ Private ReadOnly user As String
+ Private ReadOnly password As String
+ Public CurrentFBDConnectionString As String = ""
+ Public ReadOnly Property ConnectionString As String
+ Public ReadOnly Property ConnectionEstablished As Boolean
+ Get
+ Return _connectionEstablished
+ End Get
+ End Property
+
+ Public ReadOnly Property ConnectionFailed As Boolean
+ Get
+ Return _connectionFailed
+ End Get
+ End Property
+ Public Sub New(dataSource As String, database As String, user As String, password As String)
+ ConnectionString = BuildConnectionString(dataSource, database, user, password)
+ ' Save connection credentials
+ dataSource = dataSource
+ database = database
+ user = user
+ password = password
+ ' Test the connection first
+ Dim conn = Connect(ConnectionString)
+ ' If initial connection was successfully, close it
+ conn?.Close()
+ End Sub
+
+ Private Function Connect(ConnectionString As String) As FbConnection
+ Try
+ Dim conn = New FbConnection(ConnectionString)
+ conn.Open()
+ _connectionEstablished = True
+ _connectionFailed = False
+ Logger.Debug("Connection established!")
+ Logger.Debug($"User: {user}")
+ Logger.Debug($"DatabaseLocation: {database}")
+ Logger.Debug($"DatabaseServer: {dataSource}")
+
+ Return conn
+ Catch ex As Exception
+ _connectionFailed = True
+ _connectionEstablished = False
+ Logger.Error(ex)
+
+ Return Nothing
+ End Try
+ End Function
+
+ '''
+ ''' Builds a connectionstring from the provided arguments.
+ '''
+ ''' The database server where to connect to
+ ''' The datasource, eg. the path of the FDB-file
+ ''' The user used to connect to the database
+ ''' The password of the connecting user
+ ''' A connectionstring
+ Private Function BuildConnectionString(dataSource As String, database As String, user As String, password As String) As String
+ Dim connectionStringBuilder = New FbConnectionStringBuilder With {
+ .DataSource = dataSource,
+ .Database = database,
+ .UserID = user,
+ .Password = password
+ }
+ Return connectionStringBuilder.ConnectionString
+ End Function
+
+ '''
+ ''' Executes a non-query command.
+ '''
+ ''' The command to execute
+ ''' True, if command was executed sucessfully. Otherwise false.
+ Public Function NewExecuteNonQuery(sqlCommand As String) As Boolean
+ Try
+ Dim conn As FbConnection = Connect(ConnectionString)
+
+ If conn Is Nothing Then
+ Return False
+ End If
+
+ Dim transaction As FbTransaction = conn.BeginTransaction()
+ Dim command As New FbCommand With {
+ .CommandText = sqlCommand,
+ .Connection = conn,
+ .Transaction = transaction
+ }
+ command.ExecuteNonQuery()
+
+ transaction.Commit()
+ conn.Close()
+
+ Return True
+ Catch ex As Exception
+ Logger.Error(ex, $"Error in ExecuteNonQuery while executing command: '{sqlCommand}'")
+ Return False
+ End Try
+ End Function
+
+ '''
+ ''' Executes a sql query resulting in a scalar value.
+ '''
+ ''' The query to execute
+ ''' The scalar value if the command was executed successfully. Nothing otherwise.
+ Public Function GetExecuteScalar(sqlQuery As String) As Object
+ Try
+ Dim conn As FbConnection = Connect(ConnectionString)
+
+ If conn Is Nothing Then
+ Return Nothing
+ End If
+
+ Dim transaction As FbTransaction = conn.BeginTransaction()
+ Dim command As New FbCommand With {
+ .CommandText = sqlQuery,
+ .Connection = conn,
+ .Transaction = transaction
+ }
+ Dim result As Object = command.ExecuteScalar()
+
+ transaction.Commit()
+ conn.Close()
+
+ Return result
+ Catch ex As Exception
+ Logger.Error(ex, $"Error in ReturnScalar while executing command: '{sqlQuery}'")
+ Return Nothing
+ End Try
+ End Function
+
+ '''
+ ''' Executes a sql query resulting in a table of values.
+ '''
+ ''' The query to execute
+ ''' A datatable containing the results if the command was executed successfully. Nothing otherwise.
+ Public Function GetDatatable(sqlQuery As String) As DataTable
+ Try
+ Dim conn As FbConnection = Connect(ConnectionString)
+
+ If conn Is Nothing Then
+ Return Nothing
+ End If
+
+ Dim command As New FbCommand With {
+ .CommandText = sqlQuery,
+ .Connection = conn
+ }
+ Dim adapter As New FbDataAdapter(command)
+ Dim dt As New DataTable()
+
+ adapter.Fill(dt)
+ conn.Close()
+
+ Return dt
+ Catch ex As Exception
+ Logger.Error(ex, $"Error in ReturnDatatable while executing command: '{sqlQuery}'")
+ Return Nothing
+ End Try
+ End Function
End Class
diff --git a/Modules.Database/SQLServer.vb b/Modules.Database/MSSQLServer.vb
similarity index 72%
rename from Modules.Database/SQLServer.vb
rename to Modules.Database/MSSQLServer.vb
index 3f7fee1f..9b86a6e3 100644
--- a/Modules.Database/SQLServer.vb
+++ b/Modules.Database/MSSQLServer.vb
@@ -1,9 +1,10 @@
Imports System.Data.SqlClient
-Public Class SQLServer
+Public Class MSSQLServer
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public DBInitialized As Boolean = False
Public CurrentSQLConnectionString As String = ""
+ Private CurrentSQLConnection As SqlClient.SqlConnection
Public Sub New(CONSTRING As String)
Init(CONSTRING)
End Sub
@@ -17,11 +18,38 @@ Public Class SQLServer
DBInitialized = True
Return True
Catch ex As Exception
+ DBInitialized = False
Logger.Error(ex)
'clsLogger.Add("Error in DatabaseInit: " & ex.Message, True)
Return False
End Try
End Function
+ Private Function GetSQLConnection()
+ Try
+ If IsNothing(CurrentSQLConnection) Then
+ Dim oSQLconnect As New SqlClient.SqlConnection
+ oSQLconnect.ConnectionString = CurrentSQLConnectionString
+ CurrentSQLConnection = oSQLconnect
+ CurrentSQLConnection.Open()
+
+ Else
+ If CurrentSQLConnection.State <> ConnectionState.Open Then
+ Logger.Warn($"Actual ConnectionState is: '{CurrentSQLConnection.State.ToString}'")
+ Try
+ CurrentSQLConnection.Open()
+ Return True
+ Catch ex As Exception
+ Logger.Warn("Could not reconnect to database!")
+ Return False
+ End Try
+ End If
+ End If
+ Return True
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return False
+ End Try
+ End Function
'''
''' Returns a datatable for a sql-statement
'''
@@ -31,17 +59,19 @@ Public Class SQLServer
'''
Public Function GetDatatable(sqlcommand As String, Optional commandtimeout As Integer = 120) As DataTable
Try
- Dim oSQLconnect As New SqlClient.SqlConnection
+ Dim dt As DataTable = New DataTable()
+ If GetSQLConnection() = False Then
+ Return Nothing
+ End If
+
Dim oSQLCOmmand As SqlClient.SqlCommand
- oSQLconnect.ConnectionString = CurrentSQLConnectionString
- oSQLconnect.Open()
- oSQLCOmmand = oSQLconnect.CreateCommand()
+
+ oSQLCOmmand = CurrentSQLConnection.CreateCommand()
oSQLCOmmand.CommandText = sqlcommand
oSQLCOmmand.CommandTimeout = commandtimeout
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(oSQLCOmmand)
- Dim dt As DataTable = New DataTable()
adapter1.Fill(dt)
- oSQLconnect.Close()
+
Return dt
Catch ex As Exception
Logger.Error(ex)
@@ -58,16 +88,17 @@ Public Class SQLServer
'''
Public Function NewExecutenonQuery(executeStatement As String, Optional commandtimeout As Integer = 120) As Boolean
Try
- Dim oSQLconnect As New SqlClient.SqlConnection
+ If GetSQLConnection() = False Then
+ Return Nothing
+ End If
+ 'Dim oSQLconnect As New SqlClient.SqlConnection
Dim oSQLCOmmand As SqlClient.SqlCommand
- oSQLconnect.ConnectionString = CurrentSQLConnectionString
- oSQLconnect.Open()
- oSQLCOmmand = oSQLconnect.CreateCommand()
+
+ oSQLCOmmand = CurrentSQLConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
oSQLCOmmand.ExecuteNonQuery()
oSQLCOmmand.Dispose()
- oSQLconnect.Close()
Return True
Catch ex As Exception
Logger.Error(ex)
@@ -82,22 +113,21 @@ Public Class SQLServer
''' Optional Timeout
'''
Public Sub NewExecuteNonQueryAsync(executeStatement As String, Optional commandtimeout As Integer = 120)
- Dim oSQLconnect As New SqlClient.SqlConnection
+ If GetSQLConnection() = False Then
+ Exit Sub
+ End If
+
Dim oSQLCOmmand As SqlClient.SqlCommand
Dim callback As New AsyncCallback(AddressOf Execute_non_Query_Async_Callback)
Try
- oSQLconnect.ConnectionString = CurrentSQLConnectionString
- oSQLconnect.Open()
- oSQLCOmmand = oSQLconnect.CreateCommand()
+ oSQLCOmmand = CurrentSQLConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
oSQLCOmmand.BeginExecuteNonQuery(callback, oSQLCOmmand)
+ oSQLCOmmand.Dispose()
Catch ex As Exception
Logger.Error(ex)
Logger.Debug("executeStatement: " & executeStatement)
- Finally
- oSQLCOmmand.Dispose()
- oSQLconnect.Close()
End Try
End Sub
@@ -116,18 +146,16 @@ Public Class SQLServer
Public Function NewExecuteScalar(executeStatement As String, Optional commandtimeout As Integer = 120)
Dim result
Try
- Dim oSQLconnect As New SqlClient.SqlConnection
- Dim oSQLCOmmand As SqlClient.SqlCommand
- oSQLconnect.ConnectionString = CurrentSQLConnectionString
- oSQLconnect.Open()
- oSQLCOmmand = oSQLconnect.CreateCommand()
+ If GetSQLConnection() = False Then
+ Return Nothing
+ End If
+ Dim oSQLCOmmand As SqlClient.SqlCommand
+ oSQLCOmmand = CurrentSQLConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
result = oSQLCOmmand.ExecuteScalar()
oSQLCOmmand.Dispose()
- oSQLconnect.Close()
-
Return result
Catch ex As Exception
Logger.Error(ex)
diff --git a/Modules.Database/Modules.Database.vbproj b/Modules.Database/Modules.Database.vbproj
index 7628b780..8d5785d0 100644
--- a/Modules.Database/Modules.Database.vbproj
+++ b/Modules.Database/Modules.Database.vbproj
@@ -43,6 +43,18 @@
On
+
+ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
+
+
+ ..\packages\EntityFramework.Firebird.6.1.0\lib\net452\EntityFramework.Firebird.dll
+
+
+ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll
+
+
+ ..\packages\FirebirdSql.Data.FirebirdClient.6.0.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll
+
..\packages\NLog.4.5.8\lib\net45\NLog.dll
@@ -51,6 +63,7 @@
P:\Visual Studio Projekte\Bibliotheken\Oracle.ManagedDataAccess.dll
+
@@ -77,7 +90,7 @@
-
+
True
@@ -103,6 +116,7 @@
+
MyApplicationCodeGenerator
Application.Designer.vb
diff --git a/Modules.Database/Oracle.vb b/Modules.Database/Oracle.vb
index 075828b6..c260f73e 100644
--- a/Modules.Database/Oracle.vb
+++ b/Modules.Database/Oracle.vb
@@ -3,4 +3,133 @@ Public Class Oracle
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public DBInitialized As Boolean = False
Public CurrentOracleConnectionString As String = ""
+ Public Sub New(CONSTRING As String)
+ Init(CONSTRING)
+ End Sub
+ Public Function Init(CONSTRING As String)
+ Try
+ Dim oSQLconnect As New OracleConnection
+ oSQLconnect.ConnectionString = CONSTRING
+ oSQLconnect.Open()
+ oSQLconnect.Close()
+ CurrentOracleConnectionString = CONSTRING
+ DBInitialized = True
+ Return True
+ Catch ex As Exception
+ DBInitialized = False
+ Logger.Error(ex)
+ 'clsLogger.Add("Error in DatabaseInit: " & ex.Message, True)
+ Return False
+ End Try
+ End Function
+ '''
+ ''' Returns a datatable for a sql-statement
+ '''
+ ''' sqlcommand for datatable (select XYZ from TableORView)
+ ''' Optional Timeout
+ ''' Returns a datatable
+ '''
+ Public Function GetDatatable(sqlcommand As String, Optional commandtimeout As Integer = 120) As DataTable
+ Try
+ Dim oSQLconnect As New OracleConnection
+ Dim oSQLCOmmand As OracleCommand
+ oSQLconnect.ConnectionString = CurrentOracleConnectionString
+ oSQLconnect.Open()
+ oSQLCOmmand = oSQLconnect.CreateCommand()
+ oSQLCOmmand.CommandText = sqlcommand
+ oSQLCOmmand.CommandTimeout = commandtimeout
+ Dim adapter1 As OracleDataAdapter = New OracleDataAdapter(oSQLCOmmand)
+ Dim dt As DataTable = New DataTable()
+ adapter1.Fill(dt)
+ oSQLconnect.Close()
+ Return dt
+ Catch ex As Exception
+ Logger.Error(ex)
+ Logger.Debug("sqlcommand: " & sqlcommand)
+ Return Nothing
+ End Try
+ End Function
+ '''
+ ''' Executes the passed sql-statement
+ '''
+ ''' the sql statement
+ ''' Optional Timeout
+ ''' Returns true if properly executed, else false
+ '''
+ Public Function NewExecutenonQuery(executeStatement As String, Optional commandtimeout As Integer = 120) As Boolean
+ Try
+ Dim oSQLconnect As New OracleConnection
+ Dim oSQLCOmmand As OracleCommand
+ oSQLconnect.ConnectionString = CurrentOracleConnectionString
+ oSQLconnect.Open()
+ oSQLCOmmand = oSQLconnect.CreateCommand()
+ oSQLCOmmand.CommandText = executeStatement
+ oSQLCOmmand.CommandTimeout = commandtimeout
+ oSQLCOmmand.ExecuteNonQuery()
+ oSQLCOmmand.Dispose()
+ oSQLconnect.Close()
+ Return True
+ Catch ex As Exception
+ Logger.Error(ex)
+ Logger.Debug("executeStatement: " & executeStatement)
+ Return False
+ End Try
+ End Function
+ '''
+ ''' Executes the passed sql-statement in asyncmode
+ '''
+ ''' the sql statement
+ ''' Optional Timeout
+ '''
+ Public Sub NewExecuteNonQueryAsync(executeStatement As String, Optional commandtimeout As Integer = 120)
+ Dim oSQLconnect As New OracleConnection
+ Dim oSQLCOmmand As OracleCommand
+ Dim callback As New AsyncCallback(AddressOf Execute_non_Query_Async_Callback)
+ Try
+ oSQLconnect.ConnectionString = CurrentOracleConnectionString
+ oSQLconnect.Open()
+ oSQLCOmmand = oSQLconnect.CreateCommand()
+ oSQLCOmmand.CommandText = executeStatement
+ oSQLCOmmand.CommandTimeout = commandtimeout
+ oSQLCOmmand.ExecuteNonQuery()
+ oSQLCOmmand.Dispose()
+ oSQLconnect.Close()
+ Catch ex As Exception
+ Logger.Error(ex)
+ Logger.Debug("executeStatement: " & executeStatement)
+ End Try
+ End Sub
+
+ Private Sub Execute_non_Query_Async_Callback(ByVal result As IAsyncResult)
+ Dim command As OracleCommand = CType(result.AsyncState, OracleCommand)
+ Dim res = command.ExecuteNonQuery
+ Logger.Info(String.Format("Finished executing Async database operation: {0}", command.CommandText))
+ End Sub
+ '''
+ ''' Executes the passed sql-statement as Scalar
+ '''
+ ''' the sql statement
+ ''' Optional Timeout
+ ''' Returns true if properly executed, else false
+ '''
+ Public Function NewExecuteScalar(executeStatement As String, Optional commandtimeout As Integer = 120)
+ Dim result
+ Try
+ Dim oSQLconnect As New OracleConnection
+ Dim oSQLCOmmand As OracleCommand
+ oSQLconnect.ConnectionString = CurrentOracleConnectionString
+ oSQLconnect.Open()
+ oSQLCOmmand = oSQLconnect.CreateCommand()
+ oSQLCOmmand.CommandText = executeStatement
+ oSQLCOmmand.CommandTimeout = commandtimeout
+ result = oSQLCOmmand.ExecuteScalar()
+ oSQLCOmmand.Dispose()
+ oSQLconnect.Close()
+ Return result
+ Catch ex As Exception
+ Logger.Error(ex)
+ Logger.Debug("executeStatement: " & executeStatement)
+ Return Nothing
+ End Try
+ End Function
End Class
diff --git a/Modules.Database/packages.config b/Modules.Database/packages.config
index a3ffb2eb..3512bb01 100644
--- a/Modules.Database/packages.config
+++ b/Modules.Database/packages.config
@@ -1,4 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb
index 6d6f9561..c9c20bc6 100644
--- a/Modules.Windream/Windream.vb
+++ b/Modules.Windream/Windream.vb
@@ -202,7 +202,7 @@ Public Class Windream
Dim i As Integer = 0
Dim value = aValues(i)
- Dim oWMValueConverted
+ Dim oWMValueConverted = Nothing
Dim vektor As Boolean = False
'Den Typ des Index-Feldes auslesen
@@ -353,7 +353,7 @@ Public Class Windream
''' Obcjectype Name
''' Returns true when Otype was set, false if not
'''
- Public Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String)
+ Public Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String) As Boolean
Try
Dim result As Boolean = False
Dim WMFolder As WINDREAMLib.WMObject
@@ -397,9 +397,8 @@ Public Class Windream
Catch ex As Exception
' wenn das entsperren nicht geklappt hat, dann war die Datei auch nicht gesperrt
End Try
- Return result
End If
-
+ Return result
Catch ex As Exception
Logger.Error(ex)
@@ -733,7 +732,7 @@ Public Class Windream
Try
Dim missing As Boolean = False
Dim valueCount As Integer = 0
- Dim ValueArray()
+ Dim ValueArray() = Nothing
'Jeden Wert des Vektorfeldes durchlaufen
Dim DT_RESULT = GetValueforIndex(oDocument.aPath, vktIndexName)
If DT_RESULT.Rows.Count > 0 Then
@@ -922,7 +921,7 @@ Public Class Windream
Return False
End If
Dim containsvalue As Boolean = False
- Dim ValueArray()
+ Dim ValueArray() = Nothing
'Jeden Wert des Vektorfeldes durchlaufen
Dim WMValue = oWMFile.GetVariableValue(vktIndexName)
If WMValue Is Nothing = False Then