From e8412dcd42f6478f70f587d534a92a948cd6dd93 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 17 Jul 2008 13:43:31 +0000 Subject: Mantis#1736. Thank you kindly, StrawberryFride for a patch that: Many issues with handling connections in MSSQL, have rearchitected to ensure that connections are always opened and closed in a timely fashion & disposed of cleanly, and removed unnecessary lock statements. SQL Server performance seems to have improved considerably as a result, and various timeout errors seem to have been fixed. --- OpenSim/Data/MSSQL/MSSQLLogData.cs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'OpenSim/Data/MSSQL/MSSQLLogData.cs') diff --git a/OpenSim/Data/MSSQL/MSSQLLogData.cs b/OpenSim/Data/MSSQL/MSSQLLogData.cs index c75290e..849d0fb 100644 --- a/OpenSim/Data/MSSQL/MSSQLLogData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLogData.cs @@ -31,7 +31,7 @@ using System.Data; namespace OpenSim.Data.MSSQL { /// - /// An interface to the log database for MySQL + /// An interface to the log database for MSSQL /// internal class MSSQLLogData : ILogData { @@ -46,26 +46,27 @@ namespace OpenSim.Data.MSSQL public void Initialise(string connect) { // TODO: do something with the connect string - IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); - string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); - string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); - string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); - string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); - string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); + IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini"); + string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source"); + string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog"); + string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info"); + string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); + string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); - IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary()); - try - { - cmd.ExecuteNonQuery(); - cmd.Dispose(); - } - catch + using (IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary())) { - database.ExecuteResourceSql("Mssql-logs.sql"); + try + { + cmd.ExecuteNonQuery(); + } + catch + { + database.ExecuteResourceSql("Mssql-logs.sql"); + } } } @@ -88,7 +89,7 @@ namespace OpenSim.Data.MSSQL } catch { - database.Reconnect(); + // it didn't log, don't worry about it } } -- cgit v1.1