From e2b9e9fe4957e23f4678485a78bcdd23e8c617f3 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 23 Jun 2020 11:13:37 +0200 Subject: [PATCH] remove obsolete mysqlserver methods --- ChatTest/ChatTest.vbproj | 7 ++-- Controls.ChatNewConv/ChatNewConv.vb | 2 +- Modules.Database/MSSQLServer.vb | 37 +++++-------------- .../SyncUsers.MSSQL.vb | 8 ++-- .../EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb | 4 +- Services.CommunicationService/MyComService.vb | 2 +- Services.EmailService/EmailService.vb | 2 +- 7 files changed, 22 insertions(+), 40 deletions(-) diff --git a/ChatTest/ChatTest.vbproj b/ChatTest/ChatTest.vbproj index 87e2a246..8c6feef2 100644 --- a/ChatTest/ChatTest.vbproj +++ b/ChatTest/ChatTest.vbproj @@ -53,9 +53,6 @@ - - ..\Controls.ChatNewConv\obj\Debug\DigitalData.Controls.ChatNewConv.dll - False ..\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll @@ -146,6 +143,10 @@ {1f278760-4f6b-42e8-b82d-01d4c8618340} ChatControl + + {86d27ffa-480f-481d-8d23-26deae92fe6c} + ChatNewConv + {903b2d7d-3b80-4be9-8713-7447b704e1b0} Logging diff --git a/Controls.ChatNewConv/ChatNewConv.vb b/Controls.ChatNewConv/ChatNewConv.vb index 2b3b6f01..2317e192 100644 --- a/Controls.ChatNewConv/ChatNewConv.vb +++ b/Controls.ChatNewConv/ChatNewConv.vb @@ -66,7 +66,7 @@ Public Class ChatNewConv If _Database.ExecuteNonQuery(oSQL) = True Then Dim oError As Boolean = False oSQL = $"SELECT MAX(CONVERSATION_ID) FROM VWIDB_CONVERSATION WHERE IDB_OBJ_ID = {IDBObjectId}" - Dim oCONV_ID = _Database.NewExecuteScalar(oSQL) + Dim oCONV_ID = _Database.GetScalarValue(oSQL) If Not IsNothing(oCONV_ID) Then NewConversation = oCONV_ID Dim oSelectedUsers As Integer() = GridViewUsers.GetSelectedRows() diff --git a/Modules.Database/MSSQLServer.vb b/Modules.Database/MSSQLServer.vb index b9116d80..405ca804 100644 --- a/Modules.Database/MSSQLServer.vb +++ b/Modules.Database/MSSQLServer.vb @@ -108,7 +108,7 @@ Public Class MSSQLServer Return Nothing End If - _Logger.Debug("Running Query: {0}", SqlCommand) + _Logger.Debug("GetDatatable: Running Query [{0}]", SqlCommand) Using oConnection = GetSQLConnection() Using oSQLCOmmand = oConnection.CreateCommand() @@ -123,7 +123,8 @@ Public Class MSSQLServer End Using Catch ex As Exception _Logger.Error(ex) - _Logger.Warn("sqlcommand: " & SqlCommand) + _Logger.Warn("GetDatatable failed with:") + _Logger.Warn("SQL Query: {0}", SqlCommand) Return Nothing End Try End Function @@ -138,7 +139,7 @@ Public Class MSSQLServer Return Nothing End If - _Logger.Debug("Running Query: {0}", SqlCommand) + _Logger.Debug("GetDatatableWithConnection: Running Query [{0}]", SqlCommand) Using oConnection = GetSQLConnection(ConnectionString) Using oSQLCOmmand = oConnection.CreateCommand() @@ -155,22 +156,11 @@ Public Class MSSQLServer _Logger.Error(ex) _Logger.Warn("GetDatatableWithConnection failed with:") _Logger.Warn("ConnectionString: ") - _Logger.Warn("SQL Query: " & SqlCommand) + _Logger.Warn("SQL Query: {0}", SqlCommand) Return Nothing End Try End Function - ''' - ''' Executes the passed sql-statement - ''' - ''' the sql statement - ''' Returns true if properly executed, else false - ''' - Public Function NewExecutenonQuery(executeStatement As String) As Boolean - '_Logger.Warn("NewExecutenonQuery is deprecated. Use ExecuteNonQuery instead.") - Return ExecuteNonQuery(executeStatement) - End Function - Public Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean Implements IDatabase.ExecuteNonQuery Try If TestCanConnect() = False Then @@ -189,7 +179,8 @@ Public Class MSSQLServer End Using Catch ex As Exception _Logger.Error(ex) - _Logger.Warn("executeStatement: " & SQLCommand) + _Logger.Warn("ExecuteNonQuery failed:") + _Logger.Warn("SQL Query: " & SQLCommand) Return False End Try End Function @@ -220,16 +211,6 @@ Public Class MSSQLServer Return ExecuteNonQuery(SQLCommand, _Timeout) End Function - ''' - ''' Executes the passed sql-statement as Scalar - ''' - ''' the sql statement - ''' Returns true if properly executed, else false - Public Function NewExecuteScalar(ScalarSQL As String) As Object - _Logger.Warn("NewExecuteScalar is deprecated. Use GetScalarValue instead.") - Return GetScalarValue(ScalarSQL) - End Function - Public Function GetScalarValue(SQLCommand As String, Timeout As Integer) As Object Implements IDatabase.GetScalarValue Try If TestCanConnect() = False Then @@ -286,7 +267,7 @@ Public Class MSSQLServer Return Nothing End If - _Logger.Debug("Running Query: {0}", SQLCommand) + _Logger.Debug("GetScalarValue: Running Query [{0}]", SQLCommand) If SQLCommand.CommandText.Contains(" ") Then SQLCommand.CommandType = CommandType.Text @@ -349,7 +330,7 @@ Public Class MSSQLServer Exit Sub End If - _Logger.Debug("Running Query: {0}", SqlCommand) + _Logger.Debug("NewExecuteNonQueryAsync: Running Query [{0}]", SqlCommand) Try Dim oCallback As New AsyncCallback(AddressOf NewExecuteNonQueryAsync_Callback) diff --git a/Modules.Interfaces/ActiveDirectoryInterface/SyncUsers.MSSQL.vb b/Modules.Interfaces/ActiveDirectoryInterface/SyncUsers.MSSQL.vb index 16954f2b..5f57fca2 100644 --- a/Modules.Interfaces/ActiveDirectoryInterface/SyncUsers.MSSQL.vb +++ b/Modules.Interfaces/ActiveDirectoryInterface/SyncUsers.MSSQL.vb @@ -124,7 +124,7 @@ Namespace SyncUsers Dim oResult = True If _mssql.GetScalarValue(oSQL) = 0 Then oSQL = $"INSERT INTO TBDD_GROUPS_USER (USER_ID, GROUP_ID, ADDED_WHO) VALUES ({UserId}, {GroupId}, '{ADDED_WHO}')" - oResult = _mssql.NewExecutenonQuery(oSQL) + oResult = _mssql.ExecuteNonQuery(oSQL) Else _logger.Debug($"UserGroup-Relation [{UserId}/{GroupId}] already existing") Return False @@ -179,7 +179,7 @@ Namespace SyncUsers Dim oUserId As Integer = GetUserId(User.samAccountName) If oUserId = 0 Then Dim oSQL As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL, ADDED_WHO) VALUES ('{User.GivenName}', '{User.Surname}', UPPER('{User.samAccountName}'), '{User.Email}', '{ADDED_WHO}')" - Dim oResult = _mssql.NewExecutenonQuery(oSQL) + Dim oResult = _mssql.ExecuteNonQuery(oSQL) If oResult = True Then oUserId = _mssql.GetScalarValue("SELECT MAX(GUID) FROM TBDD_USER") @@ -202,7 +202,7 @@ Namespace SyncUsers Dim oUserId As Integer = GetUserId(User.samAccountName) If oUserId > 0 Then Dim oSQL As String = $"UPDATE TBDD_USER SET PRENAME = '{User.GivenName}', NAME = '{User.Surname}', EMAIL = '{User.Email}', CHANGED_WHO = '{ADDED_WHO}' WHERE GUID = {oUserId}" - Dim oResult = _mssql.NewExecutenonQuery(oSQL) + Dim oResult = _mssql.ExecuteNonQuery(oSQL) If oResult = True Then Return oUserId @@ -226,7 +226,7 @@ Namespace SyncUsers For Each oAttribute In oCustomAttributes _logger.Debug("Adding Custom Attribute [{0}] with value [{1}] to User [{2}]", oAttribute.MSSQLColumn, oAttribute.Value, User) Dim oSQL As String = $"UPDATE TBDD_USER SET {oAttribute.MSSQLColumn} = '{oAttribute.Value}', CHANGED_WHO = '{ADDED_WHO}' WHERE GUID = {UserId}" - Dim oResult = _mssql.NewExecutenonQuery(oSQL) + Dim oResult = _mssql.ExecuteNonQuery(oSQL) If oResult = False Then _logger.Debug("Custom Attribute {0} could not be added to user {1}", oAttribute.Name, User.samAccountName) diff --git a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index edbef779..ab1497bc 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -101,7 +101,7 @@ Public Class ImportZUGFeRDFiles Try 'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250) Dim oSQL = $"EXEC PRCUST_ADD_HISTORY_STATE '{oMessageID}','{oTitle}','{oTitle1}','{oComment}'" - _mssql.NewExecutenonQuery(oSQL) + _mssql.ExecuteNonQuery(oSQL) Catch ex As Exception _logger.Error(ex) End Try @@ -434,7 +434,7 @@ Public Class ImportZUGFeRDFiles _logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oProperty.Description, oProperty.Value, oProperty.TableName) ' Insert into SQL Server If oArgs.InsertIntoSQLServer = True Then - Dim oResult = _mssql.NewExecutenonQuery(oCommand) + Dim oResult = _mssql.ExecuteNonQuery(oCommand) If oResult = False Then _logger.Warn($"SQL Command [{oCommand}] was not successful. Check the log.") End If diff --git a/Services.CommunicationService/MyComService.vb b/Services.CommunicationService/MyComService.vb index c358c780..25fe1979 100644 --- a/Services.CommunicationService/MyComService.vb +++ b/Services.CommunicationService/MyComService.vb @@ -312,7 +312,7 @@ Public Class MyComService ' End If If oSendResult = True Then Dim oUpdCommand = "UPDATE TBEMLP_EMAIL_OUT SET EMAIL_SENT = GETDATE() WHERE GUID = " & oGUID - _MSSQL.NewExecutenonQuery(oUpdCommand) + _MSSQL.ExecuteNonQuery(oUpdCommand) End If Next Else diff --git a/Services.EmailService/EmailService.vb b/Services.EmailService/EmailService.vb index c74effaa..43be36b6 100644 --- a/Services.EmailService/EmailService.vb +++ b/Services.EmailService/EmailService.vb @@ -314,7 +314,7 @@ Public Class EmailService If oSQL.Contains(",COMMENT = ''") Then oSQL.Replace(",COMMENT = ''", "") End If - MSSQLInstance.NewExecutenonQuery(oSQL) + MSSQLInstance.ExecuteNonQuery(oSQL) End Select _Logger.Info($"Email has been send to: {oEmailTo} - Subject: {oSubject}") Threading.Thread.Sleep(500)