diff options
author | Charles Krinke | 2008-07-17 13:43:31 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-17 13:43:31 +0000 |
commit | e8412dcd42f6478f70f587d534a92a948cd6dd93 (patch) | |
tree | e3f2d084da7f40bd453bf06fefa43241facc0f86 /OpenSim/Data/MSSQL/MSSQLLogData.cs | |
parent | morphing OSHttpHandler interface into an abstract base class. adding (diff) | |
download | opensim-SC_OLD-e8412dcd42f6478f70f587d534a92a948cd6dd93.zip opensim-SC_OLD-e8412dcd42f6478f70f587d534a92a948cd6dd93.tar.gz opensim-SC_OLD-e8412dcd42f6478f70f587d534a92a948cd6dd93.tar.bz2 opensim-SC_OLD-e8412dcd42f6478f70f587d534a92a948cd6dd93.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLogData.cs | 33 |
1 files changed, 17 insertions, 16 deletions
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; | |||
31 | namespace OpenSim.Data.MSSQL | 31 | namespace OpenSim.Data.MSSQL |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// An interface to the log database for MySQL | 34 | /// An interface to the log database for MSSQL |
35 | /// </summary> | 35 | /// </summary> |
36 | internal class MSSQLLogData : ILogData | 36 | internal class MSSQLLogData : ILogData |
37 | { | 37 | { |
@@ -46,26 +46,27 @@ namespace OpenSim.Data.MSSQL | |||
46 | public void Initialise(string connect) | 46 | public void Initialise(string connect) |
47 | { | 47 | { |
48 | // TODO: do something with the connect string | 48 | // TODO: do something with the connect string |
49 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 49 | IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini"); |
50 | string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); | 50 | string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source"); |
51 | string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); | 51 | string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog"); |
52 | string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); | 52 | string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info"); |
53 | string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); | 53 | string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); |
54 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 54 | string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); |
55 | 55 | ||
56 | database = | 56 | database = |
57 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, | 57 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, |
58 | settingPassword); | 58 | settingPassword); |
59 | 59 | ||
60 | IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary<string, string>()); | 60 | using (IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary<string, string>())) |
61 | try | ||
62 | { | ||
63 | cmd.ExecuteNonQuery(); | ||
64 | cmd.Dispose(); | ||
65 | } | ||
66 | catch | ||
67 | { | 61 | { |
68 | database.ExecuteResourceSql("Mssql-logs.sql"); | 62 | try |
63 | { | ||
64 | cmd.ExecuteNonQuery(); | ||
65 | } | ||
66 | catch | ||
67 | { | ||
68 | database.ExecuteResourceSql("Mssql-logs.sql"); | ||
69 | } | ||
69 | } | 70 | } |
70 | 71 | ||
71 | } | 72 | } |
@@ -88,7 +89,7 @@ namespace OpenSim.Data.MSSQL | |||
88 | } | 89 | } |
89 | catch | 90 | catch |
90 | { | 91 | { |
91 | database.Reconnect(); | 92 | // it didn't log, don't worry about it |
92 | } | 93 | } |
93 | } | 94 | } |
94 | 95 | ||