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 | |
parent | morphing OSHttpHandler interface into an abstract base class. adding (diff) | |
download | opensim-SC-e8412dcd42f6478f70f587d534a92a948cd6dd93.zip opensim-SC-e8412dcd42f6478f70f587d534a92a948cd6dd93.tar.gz opensim-SC-e8412dcd42f6478f70f587d534a92a948cd6dd93.tar.bz2 opensim-SC-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/AutoClosingSqlCommand.cs | 216 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 99 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLDataStore.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 123 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 357 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLogData.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLManager.cs | 141 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLUserData.cs | 518 |
8 files changed, 780 insertions, 709 deletions
diff --git a/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs b/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs new file mode 100644 index 0000000..6a7d787 --- /dev/null +++ b/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Data.SqlClient; | ||
32 | using System.Data; | ||
33 | |||
34 | namespace OpenSim.Data.MSSQL | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Encapsulates a SqlCommand object but ensures that when it is disposed, its connection is closed and disposed also. | ||
38 | /// </summary> | ||
39 | internal class AutoClosingSqlCommand : IDbCommand | ||
40 | { | ||
41 | private SqlCommand realCommand; | ||
42 | |||
43 | public AutoClosingSqlCommand(SqlCommand cmd) | ||
44 | { | ||
45 | realCommand = cmd; | ||
46 | } | ||
47 | |||
48 | #region IDbCommand Members | ||
49 | |||
50 | public void Cancel() | ||
51 | { | ||
52 | realCommand.Cancel(); | ||
53 | } | ||
54 | |||
55 | public string CommandText | ||
56 | { | ||
57 | get | ||
58 | { | ||
59 | return realCommand.CommandText; | ||
60 | } | ||
61 | set | ||
62 | { | ||
63 | realCommand.CommandText = value; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | public int CommandTimeout | ||
68 | { | ||
69 | get | ||
70 | { | ||
71 | return realCommand.CommandTimeout; | ||
72 | } | ||
73 | set | ||
74 | { | ||
75 | realCommand.CommandTimeout = value; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | public CommandType CommandType | ||
80 | { | ||
81 | get | ||
82 | { | ||
83 | return realCommand.CommandType; | ||
84 | } | ||
85 | set | ||
86 | { | ||
87 | realCommand.CommandType = value; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | IDbConnection IDbCommand.Connection | ||
92 | { | ||
93 | get | ||
94 | { | ||
95 | return realCommand.Connection; | ||
96 | } | ||
97 | set | ||
98 | { | ||
99 | realCommand.Connection = (SqlConnection) value; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public SqlConnection Connection | ||
104 | { | ||
105 | get | ||
106 | { | ||
107 | return realCommand.Connection; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | IDbDataParameter IDbCommand.CreateParameter() | ||
112 | { | ||
113 | return realCommand.CreateParameter(); | ||
114 | } | ||
115 | |||
116 | public SqlParameter CreateParameter() | ||
117 | { | ||
118 | return realCommand.CreateParameter(); | ||
119 | } | ||
120 | |||
121 | public int ExecuteNonQuery() | ||
122 | { | ||
123 | return realCommand.ExecuteNonQuery(); | ||
124 | } | ||
125 | |||
126 | IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior) | ||
127 | { | ||
128 | return realCommand.ExecuteReader(behavior); | ||
129 | } | ||
130 | |||
131 | public SqlDataReader ExecuteReader(CommandBehavior behavior) | ||
132 | { | ||
133 | return realCommand.ExecuteReader(behavior); | ||
134 | } | ||
135 | |||
136 | IDataReader IDbCommand.ExecuteReader() | ||
137 | { | ||
138 | return realCommand.ExecuteReader(); | ||
139 | } | ||
140 | |||
141 | public SqlDataReader ExecuteReader() | ||
142 | { | ||
143 | return realCommand.ExecuteReader(); | ||
144 | } | ||
145 | |||
146 | public object ExecuteScalar() | ||
147 | { | ||
148 | return realCommand.ExecuteScalar(); | ||
149 | } | ||
150 | |||
151 | IDataParameterCollection IDbCommand.Parameters | ||
152 | { | ||
153 | get { return realCommand.Parameters; } | ||
154 | } | ||
155 | |||
156 | public SqlParameterCollection Parameters | ||
157 | { | ||
158 | get { return realCommand.Parameters; } | ||
159 | } | ||
160 | |||
161 | public void Prepare() | ||
162 | { | ||
163 | realCommand.Prepare(); | ||
164 | } | ||
165 | |||
166 | IDbTransaction IDbCommand.Transaction | ||
167 | { | ||
168 | get | ||
169 | { | ||
170 | return realCommand.Transaction; | ||
171 | } | ||
172 | set | ||
173 | { | ||
174 | realCommand.Transaction = (SqlTransaction) value; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | UpdateRowSource IDbCommand.UpdatedRowSource | ||
179 | { | ||
180 | get | ||
181 | { | ||
182 | return realCommand.UpdatedRowSource; | ||
183 | } | ||
184 | set | ||
185 | { | ||
186 | realCommand.UpdatedRowSource = value; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | #endregion | ||
191 | |||
192 | #region IDisposable Members | ||
193 | |||
194 | public void Dispose() | ||
195 | { | ||
196 | SqlConnection conn = realCommand.Connection; | ||
197 | try | ||
198 | { | ||
199 | realCommand.Dispose(); | ||
200 | } | ||
201 | finally | ||
202 | { | ||
203 | try | ||
204 | { | ||
205 | conn.Close(); | ||
206 | } | ||
207 | finally | ||
208 | { | ||
209 | conn.Dispose(); | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | #endregion | ||
215 | } | ||
216 | } | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 108ceb1..e0e20df 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -86,19 +86,14 @@ namespace OpenSim.Data.MSSQL | |||
86 | /// <returns></returns> | 86 | /// <returns></returns> |
87 | override public AssetBase FetchAsset(LLUUID assetID) | 87 | override public AssetBase FetchAsset(LLUUID assetID) |
88 | { | 88 | { |
89 | AssetBase asset = null; | ||
90 | |||
91 | Dictionary<string, string> param = new Dictionary<string, string>(); | 89 | Dictionary<string, string> param = new Dictionary<string, string>(); |
92 | param["id"] = assetID.ToString(); | 90 | param["id"] = assetID.ToString(); |
93 | 91 | ||
94 | IDbCommand result = database.Query("SELECT * FROM assets WHERE id = @id", param); | 92 | using (IDbCommand result = database.Query("SELECT * FROM assets WHERE id = @id", param)) |
95 | IDataReader reader = result.ExecuteReader(); | 93 | using (IDataReader reader = result.ExecuteReader()) |
96 | 94 | { | |
97 | asset = database.getAssetRow(reader); | 95 | return database.getAssetRow(reader); |
98 | reader.Close(); | 96 | } |
99 | result.Dispose(); | ||
100 | |||
101 | return asset; | ||
102 | } | 97 | } |
103 | 98 | ||
104 | /// <summary> | 99 | /// <summary> |
@@ -113,15 +108,13 @@ namespace OpenSim.Data.MSSQL | |||
113 | } | 108 | } |
114 | 109 | ||
115 | 110 | ||
116 | SqlCommand cmd = | 111 | using (AutoClosingSqlCommand cmd = |
117 | new SqlCommand( | 112 | database.Query( |
118 | "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [data])" + | 113 | "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [data])" + |
119 | " VALUES " + | 114 | " VALUES " + |
120 | "(@id, @name, @description, @assetType, @local, @temporary, @data)", | 115 | "(@id, @name, @description, @assetType, @local, @temporary, @data)")) |
121 | database.getConnection()); | ||
122 | |||
123 | using (cmd) | ||
124 | { | 116 | { |
117 | |||
125 | //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar); | 118 | //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar); |
126 | //p.Value = asset.FullID.ToString(); | 119 | //p.Value = asset.FullID.ToString(); |
127 | cmd.Parameters.AddWithValue("id", asset.FullID.ToString()); | 120 | cmd.Parameters.AddWithValue("id", asset.FullID.ToString()); |
@@ -135,16 +128,8 @@ namespace OpenSim.Data.MSSQL | |||
135 | h.Value = asset.Temporary; | 128 | h.Value = asset.Temporary; |
136 | SqlParameter i = cmd.Parameters.Add("data", SqlDbType.Image); | 129 | SqlParameter i = cmd.Parameters.Add("data", SqlDbType.Image); |
137 | i.Value = asset.Data; | 130 | i.Value = asset.Data; |
138 | try | ||
139 | { | ||
140 | cmd.ExecuteNonQuery(); | ||
141 | } | ||
142 | catch (Exception) | ||
143 | { | ||
144 | throw; | ||
145 | } | ||
146 | 131 | ||
147 | cmd.Dispose(); | 132 | cmd.ExecuteNonQuery(); |
148 | } | 133 | } |
149 | } | 134 | } |
150 | 135 | ||
@@ -154,38 +139,40 @@ namespace OpenSim.Data.MSSQL | |||
154 | /// <param name="asset">the asset</param> | 139 | /// <param name="asset">the asset</param> |
155 | override public void UpdateAsset(AssetBase asset) | 140 | override public void UpdateAsset(AssetBase asset) |
156 | { | 141 | { |
157 | SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + | 142 | using (IDbCommand command = database.Query("UPDATE assets set id = @id, " + |
158 | "name = @name, " + | 143 | "name = @name, " + |
159 | "description = @description," + | 144 | "description = @description," + |
160 | "assetType = @assetType," + | 145 | "assetType = @assetType," + |
161 | "local = @local," + | 146 | "local = @local," + |
162 | "temporary = @temporary," + | 147 | "temporary = @temporary," + |
163 | "data = @data where " + | 148 | "data = @data where " + |
164 | "id = @keyId;", database.getConnection()); | 149 | "id = @keyId;")) |
165 | SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString()); | ||
166 | SqlParameter param2 = new SqlParameter("@name", asset.Name); | ||
167 | SqlParameter param3 = new SqlParameter("@description", asset.Description); | ||
168 | SqlParameter param4 = new SqlParameter("@assetType", asset.Type); | ||
169 | SqlParameter param6 = new SqlParameter("@local", asset.Local); | ||
170 | SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary); | ||
171 | SqlParameter param8 = new SqlParameter("@data", asset.Data); | ||
172 | SqlParameter param9 = new SqlParameter("@keyId", asset.FullID.ToString()); | ||
173 | command.Parameters.Add(param1); | ||
174 | command.Parameters.Add(param2); | ||
175 | command.Parameters.Add(param3); | ||
176 | command.Parameters.Add(param4); | ||
177 | command.Parameters.Add(param6); | ||
178 | command.Parameters.Add(param7); | ||
179 | command.Parameters.Add(param8); | ||
180 | command.Parameters.Add(param9); | ||
181 | |||
182 | try | ||
183 | { | 150 | { |
184 | command.ExecuteNonQuery(); | 151 | SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString()); |
185 | } | 152 | SqlParameter param2 = new SqlParameter("@name", asset.Name); |
186 | catch (Exception e) | 153 | SqlParameter param3 = new SqlParameter("@description", asset.Description); |
187 | { | 154 | SqlParameter param4 = new SqlParameter("@assetType", asset.Type); |
188 | m_log.Error(e.ToString()); | 155 | SqlParameter param6 = new SqlParameter("@local", asset.Local); |
156 | SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary); | ||
157 | SqlParameter param8 = new SqlParameter("@data", asset.Data); | ||
158 | SqlParameter param9 = new SqlParameter("@keyId", asset.FullID.ToString()); | ||
159 | command.Parameters.Add(param1); | ||
160 | command.Parameters.Add(param2); | ||
161 | command.Parameters.Add(param3); | ||
162 | command.Parameters.Add(param4); | ||
163 | command.Parameters.Add(param6); | ||
164 | command.Parameters.Add(param7); | ||
165 | command.Parameters.Add(param8); | ||
166 | command.Parameters.Add(param9); | ||
167 | |||
168 | try | ||
169 | { | ||
170 | command.ExecuteNonQuery(); | ||
171 | } | ||
172 | catch (Exception e) | ||
173 | { | ||
174 | m_log.Error(e.ToString()); | ||
175 | } | ||
189 | } | 176 | } |
190 | } | 177 | } |
191 | 178 | ||
@@ -228,12 +215,12 @@ namespace OpenSim.Data.MSSQL | |||
228 | /// <remarks>it use mssql_connection.ini</remarks> | 215 | /// <remarks>it use mssql_connection.ini</remarks> |
229 | override public void Initialise() | 216 | override public void Initialise() |
230 | { | 217 | { |
231 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 218 | IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini"); |
232 | string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); | 219 | string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source"); |
233 | string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); | 220 | string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog"); |
234 | string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); | 221 | string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info"); |
235 | string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); | 222 | string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); |
236 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 223 | string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); |
237 | 224 | ||
238 | database = | 225 | database = |
239 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, | 226 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, |
diff --git a/OpenSim/Data/MSSQL/MSSQLDataStore.cs b/OpenSim/Data/MSSQL/MSSQLDataStore.cs index d9d41e0..46e4107 100644 --- a/OpenSim/Data/MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Data/MSSQL/MSSQLDataStore.cs | |||
@@ -1758,7 +1758,7 @@ namespace OpenSim.Data.MSSQL | |||
1758 | } | 1758 | } |
1759 | catch (SqlException) | 1759 | catch (SqlException) |
1760 | { | 1760 | { |
1761 | m_log.Info("[REGION DB]: MySql Database doesn't exist... creating"); | 1761 | m_log.Info("[REGION DB]: MS Sql Database doesn't exist... creating"); |
1762 | InitDB(conn); | 1762 | InitDB(conn); |
1763 | } | 1763 | } |
1764 | 1764 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index 1ed412b..0abd0d0 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs | |||
@@ -84,17 +84,17 @@ namespace OpenSim.Data.MSSQL | |||
84 | /// </summary> | 84 | /// </summary> |
85 | private void TestTables() | 85 | private void TestTables() |
86 | { | 86 | { |
87 | IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>()); | 87 | using (IDbCommand cmd = database.Query("SELECT TOP 1 * FROM " + m_regionsTableName, new Dictionary<string, string>())) |
88 | |||
89 | try | ||
90 | { | ||
91 | cmd.ExecuteNonQuery(); | ||
92 | cmd.Dispose(); | ||
93 | } | ||
94 | catch (Exception) | ||
95 | { | 88 | { |
96 | m_log.Info("[GRID DB]: MSSQL Database doesn't exist... creating"); | 89 | try |
97 | database.ExecuteResourceSql("Mssql-regions.sql"); | 90 | { |
91 | cmd.ExecuteNonQuery(); | ||
92 | } | ||
93 | catch (Exception) | ||
94 | { | ||
95 | m_log.Info("[GRID DB]: MSSQL Database doesn't exist... creating"); | ||
96 | database.ExecuteResourceSql("Mssql-regions.sql"); | ||
97 | } | ||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
@@ -103,7 +103,7 @@ namespace OpenSim.Data.MSSQL | |||
103 | /// </summary> | 103 | /// </summary> |
104 | override public void Close() | 104 | override public void Close() |
105 | { | 105 | { |
106 | database.Close(); | 106 | // nothing to close |
107 | } | 107 | } |
108 | 108 | ||
109 | /// <summary> | 109 | /// <summary> |
@@ -146,32 +146,22 @@ namespace OpenSim.Data.MSSQL | |||
146 | /// <returns>Sim profile</returns> | 146 | /// <returns>Sim profile</returns> |
147 | override public RegionProfileData GetProfileByHandle(ulong handle) | 147 | override public RegionProfileData GetProfileByHandle(ulong handle) |
148 | { | 148 | { |
149 | IDataReader reader = null; | 149 | |
150 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
151 | param["handle"] = handle.ToString(); | ||
152 | |||
150 | try | 153 | try |
151 | { | 154 | { |
152 | if (database.getConnection().State == ConnectionState.Closed) | 155 | using (IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle", param)) |
156 | using (IDataReader reader = result.ExecuteReader()) | ||
153 | { | 157 | { |
154 | database.Reconnect(); | 158 | return database.getRegionRow(reader); |
155 | } | 159 | } |
156 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
157 | param["handle"] = handle.ToString(); | ||
158 | IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle", param); | ||
159 | reader = result.ExecuteReader(); | ||
160 | |||
161 | RegionProfileData row = database.getRegionRow(reader); | ||
162 | reader.Close(); | ||
163 | result.Dispose(); | ||
164 | |||
165 | return row; | ||
166 | } | 160 | } |
167 | catch (Exception) | 161 | catch |
168 | { | 162 | { |
169 | if (reader != null) | 163 | return null; |
170 | { | ||
171 | reader.Close(); | ||
172 | } | ||
173 | } | 164 | } |
174 | return null; | ||
175 | } | 165 | } |
176 | 166 | ||
177 | /// <summary> | 167 | /// <summary> |
@@ -183,14 +173,13 @@ namespace OpenSim.Data.MSSQL | |||
183 | { | 173 | { |
184 | Dictionary<string, string> param = new Dictionary<string, string>(); | 174 | Dictionary<string, string> param = new Dictionary<string, string>(); |
185 | param["uuid"] = uuid.ToString(); | 175 | param["uuid"] = uuid.ToString(); |
186 | IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid", param); | ||
187 | IDataReader reader = result.ExecuteReader(); | ||
188 | 176 | ||
189 | RegionProfileData row = database.getRegionRow(reader); | 177 | using (IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid", param)) |
190 | reader.Close(); | 178 | using (IDataReader reader = result.ExecuteReader()) |
191 | result.Dispose(); | 179 | { |
180 | return database.getRegionRow(reader); | ||
181 | } | ||
192 | 182 | ||
193 | return row; | ||
194 | } | 183 | } |
195 | 184 | ||
196 | /// <summary> | 185 | /// <summary> |
@@ -204,25 +193,19 @@ namespace OpenSim.Data.MSSQL | |||
204 | { | 193 | { |
205 | try | 194 | try |
206 | { | 195 | { |
207 | lock (database) | 196 | Dictionary<string, string> param = new Dictionary<string, string>(); |
197 | // Add % because this is a like query. | ||
198 | param["?regionName"] = regionName + "%"; | ||
199 | // Order by statement will return shorter matches first. Only returns one record or no record. | ||
200 | using (IDbCommand result = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like ?regionName order by regionName", param)) | ||
201 | using (IDataReader reader = result.ExecuteReader()) | ||
208 | { | 202 | { |
209 | Dictionary<string, string> param = new Dictionary<string, string>(); | 203 | return database.getRegionRow(reader); |
210 | // Add % because this is a like query. | ||
211 | param["?regionName"] = regionName + "%"; | ||
212 | // Order by statement will return shorter matches first. Only returns one record or no record. | ||
213 | IDbCommand result = database.Query("SELECT top 1 * FROM " + m_regionsTableName + " WHERE regionName like ?regionName order by regionName", param); | ||
214 | IDataReader reader = result.ExecuteReader(); | ||
215 | |||
216 | RegionProfileData row = database.getRegionRow(reader); | ||
217 | reader.Close(); | ||
218 | result.Dispose(); | ||
219 | |||
220 | return row; | ||
221 | } | 204 | } |
205 | |||
222 | } | 206 | } |
223 | catch (Exception e) | 207 | catch (Exception e) |
224 | { | 208 | { |
225 | database.Reconnect(); | ||
226 | m_log.Error(e.ToString()); | 209 | m_log.Error(e.ToString()); |
227 | return null; | 210 | return null; |
228 | } | 211 | } |
@@ -324,12 +307,13 @@ namespace OpenSim.Data.MSSQL | |||
324 | 307 | ||
325 | try | 308 | try |
326 | { | 309 | { |
327 | IDbCommand result = database.Query(sql, parameters); | 310 | using (IDbCommand result = database.Query(sql, parameters)) |
311 | { | ||
328 | 312 | ||
329 | if (result.ExecuteNonQuery() == 1) | 313 | if (result.ExecuteNonQuery() == 1) |
330 | returnval = true; | 314 | returnval = true; |
331 | 315 | ||
332 | result.Dispose(); | 316 | } |
333 | } | 317 | } |
334 | catch (Exception e) | 318 | catch (Exception e) |
335 | { | 319 | { |
@@ -347,17 +331,15 @@ namespace OpenSim.Data.MSSQL | |||
347 | { | 331 | { |
348 | //Insert new region | 332 | //Insert new region |
349 | string sql = | 333 | string sql = |
350 | "INSERT INTO " + m_regionsTableName + " ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; | 334 | "INSERT INTO " + m_regionsTableName + @" ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], |
351 | sql += | 335 | [serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], |
352 | "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; | 336 | [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], [regionAssetSendKey], |
353 | sql += | 337 | [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], |
354 | "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort], [owner_uuid]) VALUES "; | 338 | [serverRemotingPort], [owner_uuid]) |
355 | 339 | VALUES (@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, | |
356 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | 340 | @serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, |
357 | sql += | 341 | @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, @regionAssetSendKey, |
358 | "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | 342 | @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort, @owner_uuid);"; |
359 | sql += | ||
360 | "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort, @owner_uuid);"; | ||
361 | 343 | ||
362 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 344 | Dictionary<string, string> parameters = new Dictionary<string, string>(); |
363 | 345 | ||
@@ -393,12 +375,11 @@ namespace OpenSim.Data.MSSQL | |||
393 | 375 | ||
394 | try | 376 | try |
395 | { | 377 | { |
396 | IDbCommand result = database.Query(sql, parameters); | 378 | using (IDbCommand result = database.Query(sql, parameters)) |
397 | 379 | { | |
398 | if (result.ExecuteNonQuery() == 1) | 380 | if (result.ExecuteNonQuery() == 1) |
399 | returnval = true; | 381 | returnval = true; |
400 | 382 | } | |
401 | result.Dispose(); | ||
402 | } | 383 | } |
403 | catch (Exception e) | 384 | catch (Exception e) |
404 | { | 385 | { |
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 3177325..4a8d6e9 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -67,12 +67,12 @@ namespace OpenSim.Data.MSSQL | |||
67 | public void Initialise(string connect) | 67 | public void Initialise(string connect) |
68 | { | 68 | { |
69 | // TODO: actually use the provided connect string | 69 | // TODO: actually use the provided connect string |
70 | IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); | 70 | IniFile gridDataMSSqlFile = new IniFile("mssql_connection.ini"); |
71 | string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); | 71 | string settingDataSource = gridDataMSSqlFile.ParseFileReadValue("data_source"); |
72 | string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); | 72 | string settingInitialCatalog = gridDataMSSqlFile.ParseFileReadValue("initial_catalog"); |
73 | string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info"); | 73 | string settingPersistSecurityInfo = gridDataMSSqlFile.ParseFileReadValue("persist_security_info"); |
74 | string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); | 74 | string settingUserId = gridDataMSSqlFile.ParseFileReadValue("user_id"); |
75 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | 75 | string settingPassword = gridDataMSSqlFile.ParseFileReadValue("password"); |
76 | 76 | ||
77 | database = | 77 | database = |
78 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, | 78 | new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, |
@@ -165,29 +165,26 @@ namespace OpenSim.Data.MSSQL | |||
165 | { | 165 | { |
166 | try | 166 | try |
167 | { | 167 | { |
168 | lock (database) | 168 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
169 | { | ||
170 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
171 | 169 | ||
172 | Dictionary<string, string> param = new Dictionary<string, string>(); | 170 | Dictionary<string, string> param = new Dictionary<string, string>(); |
173 | param["parentFolderID"] = folderID.ToString(); | 171 | param["parentFolderID"] = folderID.ToString(); |
174 | 172 | ||
175 | IDbCommand result = | 173 | using (IDbCommand result = |
176 | database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); | 174 | database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param)) |
177 | IDataReader reader = result.ExecuteReader(); | 175 | using (IDataReader reader = result.ExecuteReader()) |
176 | { | ||
178 | 177 | ||
179 | while (reader.Read()) | 178 | while (reader.Read()) |
180 | items.Add(readInventoryItem(reader)); | 179 | items.Add(readInventoryItem(reader)); |
181 | 180 | ||
182 | reader.Close(); | 181 | reader.Close(); |
183 | result.Dispose(); | ||
184 | |||
185 | return items; | ||
186 | } | 182 | } |
183 | |||
184 | return items; | ||
187 | } | 185 | } |
188 | catch (Exception e) | 186 | catch (Exception e) |
189 | { | 187 | { |
190 | database.Reconnect(); | ||
191 | m_log.Error(e.ToString()); | 188 | m_log.Error(e.ToString()); |
192 | return null; | 189 | return null; |
193 | } | 190 | } |
@@ -202,30 +199,26 @@ namespace OpenSim.Data.MSSQL | |||
202 | { | 199 | { |
203 | try | 200 | try |
204 | { | 201 | { |
205 | lock (database) | 202 | Dictionary<string, string> param = new Dictionary<string, string>(); |
206 | { | 203 | param["uuid"] = user.ToString(); |
207 | Dictionary<string, string> param = new Dictionary<string, string>(); | 204 | param["zero"] = LLUUID.Zero.ToString(); |
208 | param["uuid"] = user.ToString(); | ||
209 | param["zero"] = LLUUID.Zero.ToString(); | ||
210 | 205 | ||
211 | IDbCommand result = | 206 | using (IDbCommand result = |
212 | database.Query( | 207 | database.Query( |
213 | "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); | 208 | "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param)) |
214 | IDataReader reader = result.ExecuteReader(); | 209 | using (IDataReader reader = result.ExecuteReader()) |
210 | { | ||
215 | 211 | ||
216 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 212 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
217 | while (reader.Read()) | 213 | while (reader.Read()) |
218 | items.Add(readInventoryFolder(reader)); | 214 | items.Add(readInventoryFolder(reader)); |
219 | 215 | ||
220 | reader.Close(); | ||
221 | result.Dispose(); | ||
222 | |||
223 | return items; | 216 | return items; |
224 | } | 217 | } |
218 | |||
225 | } | 219 | } |
226 | catch (Exception e) | 220 | catch (Exception e) |
227 | { | 221 | { |
228 | database.Reconnect(); | ||
229 | m_log.Error(e.ToString()); | 222 | m_log.Error(e.ToString()); |
230 | return null; | 223 | return null; |
231 | } | 224 | } |
@@ -240,16 +233,15 @@ namespace OpenSim.Data.MSSQL | |||
240 | { | 233 | { |
241 | try | 234 | try |
242 | { | 235 | { |
243 | lock (database) | 236 | Dictionary<string, string> param = new Dictionary<string, string>(); |
244 | { | 237 | param["uuid"] = user.ToString(); |
245 | Dictionary<string, string> param = new Dictionary<string, string>(); | 238 | param["zero"] = LLUUID.Zero.ToString(); |
246 | param["uuid"] = user.ToString(); | ||
247 | param["zero"] = LLUUID.Zero.ToString(); | ||
248 | 239 | ||
249 | IDbCommand result = | 240 | using (IDbCommand result = |
250 | database.Query( | 241 | database.Query( |
251 | "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); | 242 | "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param)) |
252 | IDataReader reader = result.ExecuteReader(); | 243 | using (IDataReader reader = result.ExecuteReader()) |
244 | { | ||
253 | 245 | ||
254 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 246 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
255 | while (reader.Read()) | 247 | while (reader.Read()) |
@@ -267,15 +259,12 @@ namespace OpenSim.Data.MSSQL | |||
267 | rootFolder = items[0]; | 259 | rootFolder = items[0]; |
268 | } | 260 | } |
269 | 261 | ||
270 | reader.Close(); | ||
271 | result.Dispose(); | ||
272 | |||
273 | return rootFolder; | 262 | return rootFolder; |
274 | } | 263 | } |
264 | |||
275 | } | 265 | } |
276 | catch (Exception e) | 266 | catch (Exception e) |
277 | { | 267 | { |
278 | database.Reconnect(); | ||
279 | m_log.Error(e.ToString()); | 268 | m_log.Error(e.ToString()); |
280 | return null; | 269 | return null; |
281 | } | 270 | } |
@@ -290,30 +279,23 @@ namespace OpenSim.Data.MSSQL | |||
290 | { | 279 | { |
291 | try | 280 | try |
292 | { | 281 | { |
293 | lock (database) | 282 | Dictionary<string, string> param = new Dictionary<string, string>(); |
294 | { | 283 | param["parentFolderID"] = parentID.ToString(); |
295 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
296 | param["parentFolderID"] = parentID.ToString(); | ||
297 | |||
298 | |||
299 | IDbCommand result = | ||
300 | database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); | ||
301 | IDataReader reader = result.ExecuteReader(); | ||
302 | 284 | ||
285 | using (IDbCommand result = | ||
286 | database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param)) | ||
287 | using (IDataReader reader = result.ExecuteReader()) | ||
288 | { | ||
303 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 289 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
304 | 290 | ||
305 | while (reader.Read()) | 291 | while (reader.Read()) |
306 | items.Add(readInventoryFolder(reader)); | 292 | items.Add(readInventoryFolder(reader)); |
307 | 293 | ||
308 | reader.Close(); | ||
309 | result.Dispose(); | ||
310 | |||
311 | return items; | 294 | return items; |
312 | } | 295 | } |
313 | } | 296 | } |
314 | catch (Exception e) | 297 | catch (Exception e) |
315 | { | 298 | { |
316 | database.Reconnect(); | ||
317 | m_log.Error(e.ToString()); | 299 | m_log.Error(e.ToString()); |
318 | return null; | 300 | return null; |
319 | } | 301 | } |
@@ -369,28 +351,23 @@ namespace OpenSim.Data.MSSQL | |||
369 | { | 351 | { |
370 | try | 352 | try |
371 | { | 353 | { |
372 | lock (database) | 354 | Dictionary<string, string> param = new Dictionary<string, string>(); |
373 | { | 355 | param["inventoryID"] = itemID.ToString(); |
374 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
375 | param["inventoryID"] = itemID.ToString(); | ||
376 | 356 | ||
377 | IDbCommand result = | 357 | using (IDbCommand result = |
378 | database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); | 358 | database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param)) |
379 | IDataReader reader = result.ExecuteReader(); | 359 | using (IDataReader reader = result.ExecuteReader()) |
360 | { | ||
380 | 361 | ||
381 | InventoryItemBase item = null; | 362 | InventoryItemBase item = null; |
382 | if (reader.Read()) | 363 | if (reader.Read()) |
383 | item = readInventoryItem(reader); | 364 | item = readInventoryItem(reader); |
384 | 365 | ||
385 | reader.Close(); | ||
386 | result.Dispose(); | ||
387 | |||
388 | return item; | 366 | return item; |
389 | } | 367 | } |
390 | } | 368 | } |
391 | catch (Exception e) | 369 | catch (Exception e) |
392 | { | 370 | { |
393 | database.Reconnect(); | ||
394 | m_log.Error(e.ToString()); | 371 | m_log.Error(e.ToString()); |
395 | } | 372 | } |
396 | return null; | 373 | return null; |
@@ -431,25 +408,22 @@ namespace OpenSim.Data.MSSQL | |||
431 | { | 408 | { |
432 | try | 409 | try |
433 | { | 410 | { |
434 | lock (database) | 411 | Dictionary<string, string> param = new Dictionary<string, string>(); |
435 | { | 412 | param["uuid"] = folderID.ToString(); |
436 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
437 | param["uuid"] = folderID.ToString(); | ||
438 | 413 | ||
439 | IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param); | 414 | using (IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param)) |
440 | IDataReader reader = result.ExecuteReader(); | 415 | using (IDataReader reader = result.ExecuteReader()) |
416 | { | ||
441 | 417 | ||
442 | reader.Read(); | 418 | reader.Read(); |
419 | |||
443 | InventoryFolderBase folder = readInventoryFolder(reader); | 420 | InventoryFolderBase folder = readInventoryFolder(reader); |
444 | reader.Close(); | ||
445 | result.Dispose(); | ||
446 | 421 | ||
447 | return folder; | 422 | return folder; |
448 | } | 423 | } |
449 | } | 424 | } |
450 | catch (Exception e) | 425 | catch (Exception e) |
451 | { | 426 | { |
452 | database.Reconnect(); | ||
453 | m_log.Error(e.ToString()); | 427 | m_log.Error(e.ToString()); |
454 | return null; | 428 | return null; |
455 | } | 429 | } |
@@ -479,9 +453,8 @@ namespace OpenSim.Data.MSSQL | |||
479 | + ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType" | 453 | + ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType" |
480 | + ", @creationDate, @groupID, @groupOwned, @flags);"; | 454 | + ", @creationDate, @groupID, @groupOwned, @flags);"; |
481 | 455 | ||
482 | try | 456 | using (AutoClosingSqlCommand command = database.Query(sql)) |
483 | { | 457 | { |
484 | SqlCommand command = new SqlCommand(sql, database.getConnection()); | ||
485 | command.Parameters.AddWithValue("inventoryID", item.ID.ToString()); | 458 | command.Parameters.AddWithValue("inventoryID", item.ID.ToString()); |
486 | command.Parameters.AddWithValue("assetID", item.AssetID.ToString()); | 459 | command.Parameters.AddWithValue("assetID", item.AssetID.ToString()); |
487 | command.Parameters.AddWithValue("assetType", item.AssetType.ToString()); | 460 | command.Parameters.AddWithValue("assetType", item.AssetType.ToString()); |
@@ -502,13 +475,16 @@ namespace OpenSim.Data.MSSQL | |||
502 | command.Parameters.AddWithValue("groupOwned", item.GroupOwned); | 475 | command.Parameters.AddWithValue("groupOwned", item.GroupOwned); |
503 | command.Parameters.AddWithValue("flags", ConvertUint32BitFieldToInt32(item.Flags)); | 476 | command.Parameters.AddWithValue("flags", ConvertUint32BitFieldToInt32(item.Flags)); |
504 | 477 | ||
505 | command.ExecuteNonQuery(); | 478 | try |
506 | command.Dispose(); | 479 | { |
507 | } | 480 | command.ExecuteNonQuery(); |
508 | catch (SqlException e) | 481 | } |
509 | { | 482 | catch (SqlException e) |
510 | m_log.Error(e.ToString()); | 483 | { |
484 | m_log.Error(e.ToString()); | ||
485 | } | ||
511 | } | 486 | } |
487 | |||
512 | } | 488 | } |
513 | 489 | ||
514 | /// <summary> | 490 | /// <summary> |
@@ -517,7 +493,7 @@ namespace OpenSim.Data.MSSQL | |||
517 | /// <param name="item">Inventory item to update</param> | 493 | /// <param name="item">Inventory item to update</param> |
518 | public void updateInventoryItem(InventoryItemBase item) | 494 | public void updateInventoryItem(InventoryItemBase item) |
519 | { | 495 | { |
520 | SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " + | 496 | using (AutoClosingSqlCommand command = database.Query("UPDATE inventoryitems set inventoryID = @inventoryID, " + |
521 | "assetID = @assetID, " + | 497 | "assetID = @assetID, " + |
522 | "assetType = @assetType," + | 498 | "assetType = @assetType," + |
523 | "parentFolderID = @parentFolderID," + | 499 | "parentFolderID = @parentFolderID," + |
@@ -529,42 +505,44 @@ namespace OpenSim.Data.MSSQL | |||
529 | "invType = @invType," + | 505 | "invType = @invType," + |
530 | "creatorID = @creatorID," + | 506 | "creatorID = @creatorID," + |
531 | "inventoryBasePermissions = @inventoryBasePermissions," + | 507 | "inventoryBasePermissions = @inventoryBasePermissions," + |
532 | "inventoryEveryOnePermissions = @inventoryEveryOnePermissions," + | 508 | "inventoryEveryOnePermissions = @inventoryEveryOnePermissions," + |
533 | "salePrice = @salePrice," + | 509 | "salePrice = @salePrice," + |
534 | "saleType = @saleType," + | 510 | "saleType = @saleType," + |
535 | "creationDate = @creationDate," + | 511 | "creationDate = @creationDate," + |
536 | "groupID = @groupID," + | 512 | "groupID = @groupID," + |
537 | "groupOwned = @groupOwned," + | 513 | "groupOwned = @groupOwned," + |
538 | "flags = @flags where " + | 514 | "flags = @flags where " + |
539 | "inventoryID = @keyInventoryID;", database.getConnection()); | 515 | "inventoryID = @keyInventoryID;")) |
540 | command.Parameters.AddWithValue("inventoryID", item.ID.ToString()); | ||
541 | command.Parameters.AddWithValue("assetID", item.AssetID.ToString()); | ||
542 | command.Parameters.AddWithValue("assetType", item.AssetType.ToString()); | ||
543 | command.Parameters.AddWithValue("parentFolderID", item.Folder.ToString()); | ||
544 | command.Parameters.AddWithValue("avatarID", item.Owner.ToString()); | ||
545 | command.Parameters.AddWithValue("inventoryName", item.Name); | ||
546 | command.Parameters.AddWithValue("inventoryDescription", item.Description); | ||
547 | command.Parameters.AddWithValue("inventoryNextPermissions", ConvertUint32BitFieldToInt32(item.NextPermissions)); | ||
548 | command.Parameters.AddWithValue("inventoryCurrentPermissions", ConvertUint32BitFieldToInt32(item.CurrentPermissions)); | ||
549 | command.Parameters.AddWithValue("invType", item.InvType); | ||
550 | command.Parameters.AddWithValue("creatorID", item.Creator.ToString()); | ||
551 | command.Parameters.AddWithValue("inventoryBasePermissions", ConvertUint32BitFieldToInt32(item.BasePermissions)); | ||
552 | command.Parameters.AddWithValue("inventoryEveryOnePermissions", ConvertUint32BitFieldToInt32(item.EveryOnePermissions)); | ||
553 | command.Parameters.AddWithValue("salePrice", item.SalePrice); | ||
554 | command.Parameters.AddWithValue("saleType", item.SaleType); | ||
555 | command.Parameters.AddWithValue("creationDate", item.CreationDate); | ||
556 | command.Parameters.AddWithValue("groupID", item.GroupID.ToString()); | ||
557 | command.Parameters.AddWithValue("groupOwned", item.GroupOwned); | ||
558 | command.Parameters.AddWithValue("flags", ConvertUint32BitFieldToInt32(item.Flags)); | ||
559 | command.Parameters.AddWithValue("@keyInventoryID", item.ID.ToString()); | ||
560 | |||
561 | try | ||
562 | { | ||
563 | command.ExecuteNonQuery(); | ||
564 | } | ||
565 | catch (Exception e) | ||
566 | { | 516 | { |
567 | m_log.Error(e.ToString()); | 517 | command.Parameters.AddWithValue("inventoryID", item.ID.ToString()); |
518 | command.Parameters.AddWithValue("assetID", item.AssetID.ToString()); | ||
519 | command.Parameters.AddWithValue("assetType", item.AssetType.ToString()); | ||
520 | command.Parameters.AddWithValue("parentFolderID", item.Folder.ToString()); | ||
521 | command.Parameters.AddWithValue("avatarID", item.Owner.ToString()); | ||
522 | command.Parameters.AddWithValue("inventoryName", item.Name); | ||
523 | command.Parameters.AddWithValue("inventoryDescription", item.Description); | ||
524 | command.Parameters.AddWithValue("inventoryNextPermissions", ConvertUint32BitFieldToInt32(item.NextPermissions)); | ||
525 | command.Parameters.AddWithValue("inventoryCurrentPermissions", ConvertUint32BitFieldToInt32(item.CurrentPermissions)); | ||
526 | command.Parameters.AddWithValue("invType", item.InvType); | ||
527 | command.Parameters.AddWithValue("creatorID", item.Creator.ToString()); | ||
528 | command.Parameters.AddWithValue("inventoryBasePermissions", ConvertUint32BitFieldToInt32(item.BasePermissions)); | ||
529 | command.Parameters.AddWithValue("inventoryEveryOnePermissions", ConvertUint32BitFieldToInt32(item.EveryOnePermissions)); | ||
530 | command.Parameters.AddWithValue("salePrice", item.SalePrice); | ||
531 | command.Parameters.AddWithValue("saleType", item.SaleType); | ||
532 | command.Parameters.AddWithValue("creationDate", item.CreationDate); | ||
533 | command.Parameters.AddWithValue("groupID", item.GroupID.ToString()); | ||
534 | command.Parameters.AddWithValue("groupOwned", item.GroupOwned); | ||
535 | command.Parameters.AddWithValue("flags", ConvertUint32BitFieldToInt32(item.Flags)); | ||
536 | command.Parameters.AddWithValue("@keyInventoryID", item.ID.ToString()); | ||
537 | |||
538 | try | ||
539 | { | ||
540 | command.ExecuteNonQuery(); | ||
541 | } | ||
542 | catch (Exception e) | ||
543 | { | ||
544 | m_log.Error(e.ToString()); | ||
545 | } | ||
568 | } | 546 | } |
569 | } | 547 | } |
570 | 548 | ||
@@ -579,13 +557,13 @@ namespace OpenSim.Data.MSSQL | |||
579 | Dictionary<string, string> param = new Dictionary<string, string>(); | 557 | Dictionary<string, string> param = new Dictionary<string, string>(); |
580 | param["uuid"] = itemID.ToString(); | 558 | param["uuid"] = itemID.ToString(); |
581 | 559 | ||
582 | IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param); | 560 | using (IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param)) |
583 | cmd.ExecuteNonQuery(); | 561 | { |
584 | cmd.Dispose(); | 562 | cmd.ExecuteNonQuery(); |
563 | } | ||
585 | } | 564 | } |
586 | catch (SqlException e) | 565 | catch (SqlException e) |
587 | { | 566 | { |
588 | database.Reconnect(); | ||
589 | m_log.Error(e.ToString()); | 567 | m_log.Error(e.ToString()); |
590 | } | 568 | } |
591 | } | 569 | } |
@@ -601,23 +579,24 @@ namespace OpenSim.Data.MSSQL | |||
601 | sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; | 579 | sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; |
602 | 580 | ||
603 | 581 | ||
604 | SqlCommand command = new SqlCommand(sql, database.getConnection()); | 582 | using (AutoClosingSqlCommand command = database.Query(sql)) |
605 | command.Parameters.AddWithValue("folderID", folder.ID.ToString()); | ||
606 | command.Parameters.AddWithValue("agentID", folder.Owner.ToString()); | ||
607 | command.Parameters.AddWithValue("parentFolderID", folder.ParentID.ToString()); | ||
608 | command.Parameters.AddWithValue("folderName", folder.Name); | ||
609 | command.Parameters.AddWithValue("type", folder.Type); | ||
610 | command.Parameters.AddWithValue("version", Convert.ToInt32(folder.Version)); | ||
611 | |||
612 | try | ||
613 | { | 583 | { |
614 | //IDbCommand result = database.Query(sql, param); | 584 | command.Parameters.AddWithValue("folderID", folder.ID.ToString()); |
615 | command.ExecuteNonQuery(); | 585 | command.Parameters.AddWithValue("agentID", folder.Owner.ToString()); |
616 | command.Dispose(); | 586 | command.Parameters.AddWithValue("parentFolderID", folder.ParentID.ToString()); |
617 | } | 587 | command.Parameters.AddWithValue("folderName", folder.Name); |
618 | catch (Exception e) | 588 | command.Parameters.AddWithValue("type", folder.Type); |
619 | { | 589 | command.Parameters.AddWithValue("version", Convert.ToInt32(folder.Version)); |
620 | m_log.Error(e.ToString()); | 590 | |
591 | try | ||
592 | { | ||
593 | //IDbCommand result = database.Query(sql, param); | ||
594 | command.ExecuteNonQuery(); | ||
595 | } | ||
596 | catch (Exception e) | ||
597 | { | ||
598 | m_log.Error(e.ToString()); | ||
599 | } | ||
621 | } | 600 | } |
622 | } | 601 | } |
623 | 602 | ||
@@ -627,35 +606,37 @@ namespace OpenSim.Data.MSSQL | |||
627 | /// <param name="folder">Folder to update</param> | 606 | /// <param name="folder">Folder to update</param> |
628 | public void updateInventoryFolder(InventoryFolderBase folder) | 607 | public void updateInventoryFolder(InventoryFolderBase folder) |
629 | { | 608 | { |
630 | SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + | 609 | using (IDbCommand command = database.Query("UPDATE inventoryfolders set folderID = @folderID, " + |
631 | "agentID = @agentID, " + | 610 | "agentID = @agentID, " + |
632 | "parentFolderID = @parentFolderID," + | 611 | "parentFolderID = @parentFolderID," + |
633 | "folderName = @folderName," + | 612 | "folderName = @folderName," + |
634 | "type = @type," + | 613 | "type = @type," + |
635 | "version = @version where " + | 614 | "version = @version where " + |
636 | "folderID = @keyFolderID;", database.getConnection()); | 615 | "folderID = @keyFolderID;")) |
637 | SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); | 616 | { |
638 | SqlParameter param2 = new SqlParameter("@agentID", folder.Owner.ToString()); | 617 | SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); |
639 | SqlParameter param3 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); | 618 | SqlParameter param2 = new SqlParameter("@agentID", folder.Owner.ToString()); |
640 | SqlParameter param4 = new SqlParameter("@folderName", folder.Name); | 619 | SqlParameter param3 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); |
641 | SqlParameter param5 = new SqlParameter("@type", folder.Type); | 620 | SqlParameter param4 = new SqlParameter("@folderName", folder.Name); |
642 | SqlParameter param6 = new SqlParameter("@version", Convert.ToInt32(folder.Version)); | 621 | SqlParameter param5 = new SqlParameter("@type", folder.Type); |
643 | SqlParameter param7 = new SqlParameter("@keyFolderID", folder.ID.ToString()); | 622 | SqlParameter param6 = new SqlParameter("@version", Convert.ToInt32(folder.Version)); |
644 | command.Parameters.Add(param1); | 623 | SqlParameter param7 = new SqlParameter("@keyFolderID", folder.ID.ToString()); |
645 | command.Parameters.Add(param2); | 624 | command.Parameters.Add(param1); |
646 | command.Parameters.Add(param3); | 625 | command.Parameters.Add(param2); |
647 | command.Parameters.Add(param4); | 626 | command.Parameters.Add(param3); |
648 | command.Parameters.Add(param5); | 627 | command.Parameters.Add(param4); |
649 | command.Parameters.Add(param6); | 628 | command.Parameters.Add(param5); |
650 | command.Parameters.Add(param7); | 629 | command.Parameters.Add(param6); |
651 | 630 | command.Parameters.Add(param7); | |
652 | try | 631 | |
653 | { | 632 | try |
654 | command.ExecuteNonQuery(); | 633 | { |
655 | } | 634 | command.ExecuteNonQuery(); |
656 | catch (Exception e) | 635 | } |
657 | { | 636 | catch (Exception e) |
658 | m_log.Error(e.ToString()); | 637 | { |
638 | m_log.Error(e.ToString()); | ||
639 | } | ||
659 | } | 640 | } |
660 | } | 641 | } |
661 | 642 | ||
@@ -665,23 +646,25 @@ namespace OpenSim.Data.MSSQL | |||
665 | /// <param name="folder">Folder to update</param> | 646 | /// <param name="folder">Folder to update</param> |
666 | public void moveInventoryFolder(InventoryFolderBase folder) | 647 | public void moveInventoryFolder(InventoryFolderBase folder) |
667 | { | 648 | { |
668 | SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + | 649 | using (IDbCommand command = database.Query("UPDATE inventoryfolders set folderID = @folderID, " + |
669 | "parentFolderID = @parentFolderID," + | 650 | "parentFolderID = @parentFolderID," + |
670 | "folderID = @keyFolderID;", database.getConnection()); | 651 | "folderID = @keyFolderID;")) |
671 | SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); | ||
672 | SqlParameter param2 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); | ||
673 | SqlParameter param3 = new SqlParameter("@keyFolderID", folder.ID.ToString()); | ||
674 | command.Parameters.Add(param1); | ||
675 | command.Parameters.Add(param2); | ||
676 | command.Parameters.Add(param3); | ||
677 | |||
678 | try | ||
679 | { | ||
680 | command.ExecuteNonQuery(); | ||
681 | } | ||
682 | catch (Exception e) | ||
683 | { | 652 | { |
684 | m_log.Error(e.ToString()); | 653 | SqlParameter param1 = new SqlParameter("@folderID", folder.ID.ToString()); |
654 | SqlParameter param2 = new SqlParameter("@parentFolderID", folder.ParentID.ToString()); | ||
655 | SqlParameter param3 = new SqlParameter("@keyFolderID", folder.ID.ToString()); | ||
656 | command.Parameters.Add(param1); | ||
657 | command.Parameters.Add(param2); | ||
658 | command.Parameters.Add(param3); | ||
659 | |||
660 | try | ||
661 | { | ||
662 | command.ExecuteNonQuery(); | ||
663 | } | ||
664 | catch (Exception e) | ||
665 | { | ||
666 | m_log.Error(e.ToString()); | ||
667 | } | ||
685 | } | 668 | } |
686 | } | 669 | } |
687 | 670 | ||
@@ -721,13 +704,13 @@ namespace OpenSim.Data.MSSQL | |||
721 | Dictionary<string, string> param = new Dictionary<string, string>(); | 704 | Dictionary<string, string> param = new Dictionary<string, string>(); |
722 | param["folderID"] = folderID.ToString(); | 705 | param["folderID"] = folderID.ToString(); |
723 | 706 | ||
724 | IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param); | 707 | using (IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param)) |
725 | cmd.ExecuteNonQuery(); | 708 | { |
726 | cmd.Dispose(); | 709 | cmd.ExecuteNonQuery(); |
710 | } | ||
727 | } | 711 | } |
728 | catch (SqlException e) | 712 | catch (SqlException e) |
729 | { | 713 | { |
730 | database.Reconnect(); | ||
731 | m_log.Error(e.ToString()); | 714 | m_log.Error(e.ToString()); |
732 | } | 715 | } |
733 | } | 716 | } |
@@ -744,14 +727,14 @@ namespace OpenSim.Data.MSSQL | |||
744 | param["parentFolderID"] = folderID.ToString(); | 727 | param["parentFolderID"] = folderID.ToString(); |
745 | 728 | ||
746 | 729 | ||
747 | IDbCommand cmd = | 730 | using (IDbCommand cmd = |
748 | database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); | 731 | database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param)) |
749 | cmd.ExecuteNonQuery(); | 732 | { |
750 | cmd.Dispose(); | 733 | cmd.ExecuteNonQuery(); |
734 | } | ||
751 | } | 735 | } |
752 | catch (SqlException e) | 736 | catch (SqlException e) |
753 | { | 737 | { |
754 | database.Reconnect(); | ||
755 | m_log.Error(e.ToString()); | 738 | m_log.Error(e.ToString()); |
756 | } | 739 | } |
757 | } | 740 | } |
@@ -762,7 +745,7 @@ namespace OpenSim.Data.MSSQL | |||
762 | /// <param name="folderId">Id of folder to delete</param> | 745 | /// <param name="folderId">Id of folder to delete</param> |
763 | public void deleteInventoryFolder(LLUUID folderID) | 746 | public void deleteInventoryFolder(LLUUID folderID) |
764 | { | 747 | { |
765 | lock (database) | 748 | // lock (database) |
766 | { | 749 | { |
767 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); | 750 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); |
768 | 751 | ||
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 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index e421c5d..fe4ca77 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs | |||
@@ -45,11 +45,6 @@ namespace OpenSim.Data.MSSQL | |||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// The database connection object | ||
49 | /// </summary> | ||
50 | private IDbConnection dbcon; | ||
51 | |||
52 | /// <summary> | ||
53 | /// Connection string for ADO.net | 48 | /// Connection string for ADO.net |
54 | /// </summary> | 49 | /// </summary> |
55 | private readonly string connectionString; | 50 | private readonly string connectionString; |
@@ -57,11 +52,24 @@ namespace OpenSim.Data.MSSQL | |||
57 | public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, | 52 | public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, |
58 | string password) | 53 | string password) |
59 | { | 54 | { |
60 | connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + | 55 | SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); |
61 | ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + | 56 | |
62 | password + ";"; | 57 | builder.DataSource = dataSource; |
63 | dbcon = new SqlConnection(connectionString); | 58 | builder.InitialCatalog = initialCatalog; |
64 | dbcon.Open(); | 59 | builder.PersistSecurityInfo = Convert.ToBoolean(persistSecurityInfo); |
60 | builder.UserID = userId; | ||
61 | builder.Password = password; | ||
62 | builder.ApplicationName = Assembly.GetEntryAssembly().Location; | ||
63 | |||
64 | connectionString = builder.ToString(); | ||
65 | } | ||
66 | |||
67 | private SqlConnection createConnection() | ||
68 | { | ||
69 | SqlConnection conn = new SqlConnection(connectionString); | ||
70 | conn.Open(); | ||
71 | |||
72 | return conn; | ||
65 | } | 73 | } |
66 | 74 | ||
67 | //private DataTable createRegionsTable() | 75 | //private DataTable createRegionsTable() |
@@ -121,7 +129,7 @@ namespace OpenSim.Data.MSSQL | |||
121 | } | 129 | } |
122 | 130 | ||
123 | /// <summary> | 131 | /// <summary> |
124 | /// | 132 | /// Define Table function |
125 | /// </summary> | 133 | /// </summary> |
126 | /// <param name="dt"></param> | 134 | /// <param name="dt"></param> |
127 | /// <returns></returns> | 135 | /// <returns></returns> |
@@ -178,35 +186,11 @@ namespace OpenSim.Data.MSSQL | |||
178 | } | 186 | } |
179 | } | 187 | } |
180 | 188 | ||
181 | /// <summary> | ||
182 | /// Shuts down the database connection | ||
183 | /// </summary> | ||
184 | public void Close() | ||
185 | { | ||
186 | dbcon.Close(); | ||
187 | dbcon = null; | ||
188 | } | ||
189 | 189 | ||
190 | /// <summary> | 190 | private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>(); |
191 | /// Reconnects to the database | 191 | internal AutoClosingSqlCommand Query(string sql) |
192 | /// </summary> | ||
193 | public void Reconnect() | ||
194 | { | 192 | { |
195 | lock (dbcon) | 193 | return Query(sql, emptyDictionary); |
196 | { | ||
197 | try | ||
198 | { | ||
199 | // Close the DB connection | ||
200 | dbcon.Close(); | ||
201 | // Try reopen it | ||
202 | dbcon = new SqlConnection(connectionString); | ||
203 | dbcon.Open(); | ||
204 | } | ||
205 | catch (Exception e) | ||
206 | { | ||
207 | m_log.Error("Unable to reconnect to database " + e.ToString()); | ||
208 | } | ||
209 | } | ||
210 | } | 194 | } |
211 | 195 | ||
212 | /// <summary> | 196 | /// <summary> |
@@ -215,18 +199,20 @@ namespace OpenSim.Data.MSSQL | |||
215 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | 199 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> |
216 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | 200 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> |
217 | /// <returns>A Sql DB Command</returns> | 201 | /// <returns>A Sql DB Command</returns> |
218 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 202 | internal AutoClosingSqlCommand Query(string sql, Dictionary<string, string> parameters) |
219 | { | 203 | { |
220 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); | 204 | SqlCommand dbcommand = createConnection().CreateCommand(); |
221 | dbcommand.CommandText = sql; | 205 | dbcommand.CommandText = sql; |
222 | foreach (KeyValuePair<string, string> param in parameters) | 206 | foreach (KeyValuePair<string, string> param in parameters) |
223 | { | 207 | { |
224 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 208 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
225 | } | 209 | } |
226 | 210 | ||
227 | return (IDbCommand)dbcommand; | 211 | return new AutoClosingSqlCommand(dbcommand); |
228 | } | 212 | } |
229 | 213 | ||
214 | |||
215 | |||
230 | /// <summary> | 216 | /// <summary> |
231 | /// Runs a database reader object and returns a region row | 217 | /// Runs a database reader object and returns a region row |
232 | /// </summary> | 218 | /// </summary> |
@@ -400,7 +386,6 @@ namespace OpenSim.Data.MSSQL | |||
400 | if (reader.Read()) | 386 | if (reader.Read()) |
401 | { | 387 | { |
402 | // Region Main | 388 | // Region Main |
403 | |||
404 | asset = new AssetBase(); | 389 | asset = new AssetBase(); |
405 | asset.Data = (byte[])reader["data"]; | 390 | asset.Data = (byte[])reader["data"]; |
406 | asset.Description = (string)reader["description"]; | 391 | asset.Description = (string)reader["description"]; |
@@ -443,19 +428,20 @@ namespace OpenSim.Data.MSSQL | |||
443 | 428 | ||
444 | bool returnval = false; | 429 | bool returnval = false; |
445 | 430 | ||
446 | try | 431 | using (IDbCommand result = Query(sql, parameters)) |
447 | { | 432 | { |
448 | IDbCommand result = Query(sql, parameters); | 433 | try |
434 | { | ||
449 | 435 | ||
450 | if (result.ExecuteNonQuery() == 1) | 436 | if (result.ExecuteNonQuery() == 1) |
451 | returnval = true; | 437 | returnval = true; |
452 | 438 | ||
453 | result.Dispose(); | 439 | } |
454 | } | 440 | catch (Exception e) |
455 | catch (Exception e) | 441 | { |
456 | { | 442 | m_log.Error(e.ToString()); |
457 | m_log.Error(e.ToString()); | 443 | return false; |
458 | return false; | 444 | } |
459 | } | 445 | } |
460 | 446 | ||
461 | return returnval; | 447 | return returnval; |
@@ -467,19 +453,12 @@ namespace OpenSim.Data.MSSQL | |||
467 | /// <param name="name">the ressource string</param> | 453 | /// <param name="name">the ressource string</param> |
468 | public void ExecuteResourceSql(string name) | 454 | public void ExecuteResourceSql(string name) |
469 | { | 455 | { |
470 | SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon); | 456 | using (IDbCommand cmd = Query(getResourceString(name), new Dictionary<string,string>())) |
471 | cmd.ExecuteNonQuery(); | 457 | { |
472 | cmd.Dispose(); | 458 | cmd.ExecuteNonQuery(); |
459 | } | ||
473 | } | 460 | } |
474 | 461 | ||
475 | /// <summary> | ||
476 | /// | ||
477 | /// </summary> | ||
478 | /// <returns>The actual SqlConnection</returns> | ||
479 | public SqlConnection getConnection() | ||
480 | { | ||
481 | return (SqlConnection)dbcon; | ||
482 | } | ||
483 | 462 | ||
484 | /// <summary> | 463 | /// <summary> |
485 | /// Given a list of tables, return the version of the tables, as seen in the database | 464 | /// Given a list of tables, return the version of the tables, as seen in the database |
@@ -487,30 +466,29 @@ namespace OpenSim.Data.MSSQL | |||
487 | /// <param name="tableList"></param> | 466 | /// <param name="tableList"></param> |
488 | public void GetTableVersion(Dictionary<string, string> tableList) | 467 | public void GetTableVersion(Dictionary<string, string> tableList) |
489 | { | 468 | { |
490 | lock (dbcon) | 469 | Dictionary<string, string> param = new Dictionary<string, string>(); |
470 | param["dbname"] = new SqlConnectionStringBuilder(connectionString).InitialCatalog; | ||
471 | |||
472 | using (IDbCommand tablesCmd = | ||
473 | Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param)) | ||
474 | using (IDataReader tables = tablesCmd.ExecuteReader()) | ||
491 | { | 475 | { |
492 | Dictionary<string, string> param = new Dictionary<string, string>(); | 476 | while (tables.Read()) |
493 | param["dbname"] = dbcon.Database; | ||
494 | IDbCommand tablesCmd = | ||
495 | Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param); | ||
496 | using (IDataReader tables = tablesCmd.ExecuteReader()) | ||
497 | { | 477 | { |
498 | while (tables.Read()) | 478 | try |
499 | { | 479 | { |
500 | try | 480 | string tableName = (string)tables["TABLE_NAME"]; |
501 | { | 481 | if (tableList.ContainsKey(tableName)) |
502 | string tableName = (string)tables["TABLE_NAME"]; | 482 | tableList[tableName] = tableName; |
503 | if (tableList.ContainsKey(tableName)) | 483 | } |
504 | tableList[tableName] = tableName; | 484 | catch (Exception e) |
505 | } | 485 | { |
506 | catch (Exception e) | 486 | m_log.Error(e.ToString()); |
507 | { | ||
508 | m_log.Error(e.ToString()); | ||
509 | } | ||
510 | } | 487 | } |
511 | tables.Close(); | ||
512 | } | 488 | } |
489 | tables.Close(); | ||
513 | } | 490 | } |
491 | |||
514 | } | 492 | } |
515 | 493 | ||
516 | /// <summary> | 494 | /// <summary> |
@@ -546,7 +524,6 @@ namespace OpenSim.Data.MSSQL | |||
546 | // string dllName = module.Assembly.ManifestModule.Name; | 524 | // string dllName = module.Assembly.ManifestModule.Name; |
547 | Version dllVersion = module.Assembly.GetName().Version; | 525 | Version dllVersion = module.Assembly.GetName().Version; |
548 | 526 | ||
549 | |||
550 | return | 527 | return |
551 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | 528 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, |
552 | dllVersion.Revision); | 529 | dllVersion.Revision); |
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index cb5ba24..20c3acd 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Data.MSSQL | |||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Database manager for MySQL | 47 | /// Database manager for MSSQL |
48 | /// </summary> | 48 | /// </summary> |
49 | public MSSQLManager database; | 49 | public MSSQLManager database; |
50 | 50 | ||
@@ -100,36 +100,41 @@ namespace OpenSim.Data.MSSQL | |||
100 | /// <returns></returns> | 100 | /// <returns></returns> |
101 | private bool TestTables() | 101 | private bool TestTables() |
102 | { | 102 | { |
103 | IDbCommand cmd; | ||
104 | 103 | ||
105 | cmd = database.Query("select top 1 * from " + m_usersTableName, new Dictionary<string, string>()); | 104 | using (IDbCommand cmd = database.Query("select top 1 * from " + m_usersTableName, new Dictionary<string, string>())) |
106 | try | ||
107 | { | ||
108 | cmd.ExecuteNonQuery(); | ||
109 | } | ||
110 | catch | ||
111 | { | 105 | { |
112 | database.ExecuteResourceSql("Mssql-users.sql"); | 106 | try |
107 | { | ||
108 | cmd.ExecuteNonQuery(); | ||
109 | } | ||
110 | catch | ||
111 | { | ||
112 | database.ExecuteResourceSql("Mssql-users.sql"); | ||
113 | } | ||
113 | } | 114 | } |
114 | 115 | ||
115 | cmd = database.Query("select top 1 * from " + m_agentsTableName, new Dictionary<string, string>()); | 116 | using (IDbCommand cmd = database.Query("select top 1 * from " + m_agentsTableName, new Dictionary<string, string>())) |
116 | try | ||
117 | { | ||
118 | cmd.ExecuteNonQuery(); | ||
119 | } | ||
120 | catch | ||
121 | { | 117 | { |
122 | database.ExecuteResourceSql("Mssql-agents.sql"); | 118 | try |
119 | { | ||
120 | cmd.ExecuteNonQuery(); | ||
121 | } | ||
122 | catch | ||
123 | { | ||
124 | database.ExecuteResourceSql("Mssql-agents.sql"); | ||
125 | } | ||
123 | } | 126 | } |
124 | 127 | ||
125 | cmd = database.Query("select top 1 * from " + m_userFriendsTableName, new Dictionary<string, string>()); | 128 | using (IDbCommand cmd = database.Query("select top 1 * from " + m_userFriendsTableName, new Dictionary<string, string>())) |
126 | try | ||
127 | { | 129 | { |
128 | cmd.ExecuteNonQuery(); | 130 | try |
129 | } | 131 | { |
130 | catch | 132 | cmd.ExecuteNonQuery(); |
131 | { | 133 | } |
132 | database.ExecuteResourceSql("CreateUserFriendsTable.sql"); | 134 | catch |
135 | { | ||
136 | database.ExecuteResourceSql("CreateUserFriendsTable.sql"); | ||
137 | } | ||
133 | } | 138 | } |
134 | 139 | ||
135 | return true; | 140 | return true; |
@@ -145,27 +150,18 @@ namespace OpenSim.Data.MSSQL | |||
145 | { | 150 | { |
146 | try | 151 | try |
147 | { | 152 | { |
148 | lock (database) | 153 | Dictionary<string, string> param = new Dictionary<string, string>(); |
149 | { | 154 | param["first"] = user; |
150 | Dictionary<string, string> param = new Dictionary<string, string>(); | 155 | param["second"] = last; |
151 | param["first"] = user; | ||
152 | param["second"] = last; | ||
153 | |||
154 | IDbCommand result = | ||
155 | database.Query("SELECT * FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second", param); | ||
156 | IDataReader reader = result.ExecuteReader(); | ||
157 | 156 | ||
158 | UserProfileData row = database.readUserRow(reader); | 157 | using (IDbCommand result = database.Query("SELECT * FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second", param)) |
159 | 158 | using (IDataReader reader = result.ExecuteReader()) | |
160 | reader.Close(); | 159 | { |
161 | result.Dispose(); | 160 | return database.readUserRow(reader); |
162 | |||
163 | return row; | ||
164 | } | 161 | } |
165 | } | 162 | } |
166 | catch (Exception e) | 163 | catch (Exception e) |
167 | { | 164 | { |
168 | database.Reconnect(); | ||
169 | m_log.Error(e.ToString()); | 165 | m_log.Error(e.ToString()); |
170 | return null; | 166 | return null; |
171 | } | 167 | } |
@@ -191,32 +187,30 @@ namespace OpenSim.Data.MSSQL | |||
191 | 187 | ||
192 | try | 188 | try |
193 | { | 189 | { |
194 | lock (database) | 190 | using (IDbCommand adder = |
191 | database.Query( | ||
192 | "INSERT INTO " + m_userFriendsTableName + " " + | ||
193 | "(ownerID,friendID,friendPerms,datetimestamp) " + | ||
194 | "VALUES " + | ||
195 | "(@ownerID,@friendID,@friendPerms,@datetimestamp)", | ||
196 | param)) | ||
195 | { | 197 | { |
196 | IDbCommand adder = | ||
197 | database.Query( | ||
198 | "INSERT INTO " + m_userFriendsTableName + " " + | ||
199 | "(ownerID,friendID,friendPerms,datetimestamp) " + | ||
200 | "VALUES " + | ||
201 | "(@ownerID,@friendID,@friendPerms,@datetimestamp)", | ||
202 | param); | ||
203 | |||
204 | adder.ExecuteNonQuery(); | 198 | adder.ExecuteNonQuery(); |
205 | 199 | } | |
206 | adder = | 200 | |
207 | database.Query( | 201 | using (IDbCommand adder = |
208 | "INSERT INTO " + m_userFriendsTableName + " " + | 202 | database.Query( |
209 | "(ownerID,friendID,friendPerms,datetimestamp) " + | 203 | "INSERT INTO " + m_userFriendsTableName + " " + |
210 | "VALUES " + | 204 | "(ownerID,friendID,friendPerms,datetimestamp) " + |
211 | "(@friendID,@ownerID,@friendPerms,@datetimestamp)", | 205 | "VALUES " + |
212 | param); | 206 | "(@friendID,@ownerID,@friendPerms,@datetimestamp)", |
207 | param)) | ||
208 | { | ||
213 | adder.ExecuteNonQuery(); | 209 | adder.ExecuteNonQuery(); |
214 | |||
215 | } | 210 | } |
216 | } | 211 | } |
217 | catch (Exception e) | 212 | catch (Exception e) |
218 | { | 213 | { |
219 | database.Reconnect(); | ||
220 | m_log.Error(e.ToString()); | 214 | m_log.Error(e.ToString()); |
221 | return; | 215 | return; |
222 | } | 216 | } |
@@ -236,27 +230,26 @@ namespace OpenSim.Data.MSSQL | |||
236 | 230 | ||
237 | try | 231 | try |
238 | { | 232 | { |
239 | lock (database) | 233 | using (IDbCommand updater = |
234 | database.Query( | ||
235 | "delete from " + m_userFriendsTableName + " where ownerID = @ownerID and friendID = @friendID", | ||
236 | param)) | ||
240 | { | 237 | { |
241 | IDbCommand updater = | ||
242 | database.Query( | ||
243 | "delete from " + m_userFriendsTableName + " where ownerID = @ownerID and friendID = @friendID", | ||
244 | param); | ||
245 | updater.ExecuteNonQuery(); | 238 | updater.ExecuteNonQuery(); |
239 | } | ||
246 | 240 | ||
247 | updater = | 241 | using (IDbCommand updater = |
248 | database.Query( | 242 | database.Query( |
249 | "delete from " + m_userFriendsTableName + " where ownerID = @friendID and friendID = @ownerID", | 243 | "delete from " + m_userFriendsTableName + " where ownerID = @friendID and friendID = @ownerID", |
250 | param); | 244 | param)) |
245 | { | ||
251 | updater.ExecuteNonQuery(); | 246 | updater.ExecuteNonQuery(); |
252 | |||
253 | } | 247 | } |
248 | |||
254 | } | 249 | } |
255 | catch (Exception e) | 250 | catch (Exception e) |
256 | { | 251 | { |
257 | database.Reconnect(); | ||
258 | m_log.Error(e.ToString()); | 252 | m_log.Error(e.ToString()); |
259 | return; | ||
260 | } | 253 | } |
261 | } | 254 | } |
262 | 255 | ||
@@ -276,23 +269,19 @@ namespace OpenSim.Data.MSSQL | |||
276 | 269 | ||
277 | try | 270 | try |
278 | { | 271 | { |
279 | lock (database) | 272 | using (IDbCommand updater = |
273 | database.Query( | ||
274 | "update " + m_userFriendsTableName + | ||
275 | " SET friendPerms = @friendPerms " + | ||
276 | "where ownerID = @ownerID and friendID = @friendID", | ||
277 | param)) | ||
280 | { | 278 | { |
281 | IDbCommand updater = | ||
282 | database.Query( | ||
283 | "update " + m_userFriendsTableName + | ||
284 | " SET friendPerms = @friendPerms " + | ||
285 | "where ownerID = @ownerID and friendID = @friendID", | ||
286 | param); | ||
287 | |||
288 | updater.ExecuteNonQuery(); | 279 | updater.ExecuteNonQuery(); |
289 | } | 280 | } |
290 | } | 281 | } |
291 | catch (Exception e) | 282 | catch (Exception e) |
292 | { | 283 | { |
293 | database.Reconnect(); | ||
294 | m_log.Error(e.ToString()); | 284 | m_log.Error(e.ToString()); |
295 | return; | ||
296 | } | 285 | } |
297 | } | 286 | } |
298 | 287 | ||
@@ -310,17 +299,14 @@ namespace OpenSim.Data.MSSQL | |||
310 | 299 | ||
311 | try | 300 | try |
312 | { | 301 | { |
313 | lock (database) | 302 | //Left Join userfriends to itself |
303 | using (IDbCommand result = | ||
304 | database.Query( | ||
305 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + | ||
306 | " where a.ownerID = @ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", | ||
307 | param)) | ||
308 | using (IDataReader reader = result.ExecuteReader()) | ||
314 | { | 309 | { |
315 | //Left Join userfriends to itself | ||
316 | IDbCommand result = | ||
317 | database.Query( | ||
318 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + | ||
319 | " where a.ownerID = @ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", | ||
320 | param); | ||
321 | IDataReader reader = result.ExecuteReader(); | ||
322 | |||
323 | |||
324 | while (reader.Read()) | 310 | while (reader.Read()) |
325 | { | 311 | { |
326 | FriendListItem fli = new FriendListItem(); | 312 | FriendListItem fli = new FriendListItem(); |
@@ -333,15 +319,11 @@ namespace OpenSim.Data.MSSQL | |||
333 | 319 | ||
334 | Lfli.Add(fli); | 320 | Lfli.Add(fli); |
335 | } | 321 | } |
336 | reader.Close(); | ||
337 | result.Dispose(); | ||
338 | } | 322 | } |
339 | } | 323 | } |
340 | catch (Exception e) | 324 | catch (Exception e) |
341 | { | 325 | { |
342 | database.Reconnect(); | ||
343 | m_log.Error(e.ToString()); | 326 | m_log.Error(e.ToString()); |
344 | return Lfli; | ||
345 | } | 327 | } |
346 | 328 | ||
347 | return Lfli; | 329 | return Lfli; |
@@ -375,19 +357,13 @@ namespace OpenSim.Data.MSSQL | |||
375 | { | 357 | { |
376 | try | 358 | try |
377 | { | 359 | { |
378 | lock (database) | 360 | Dictionary<string, string> param = new Dictionary<string, string>(); |
379 | { | 361 | param["first"] = querysplit[0]; |
380 | Dictionary<string, string> param = new Dictionary<string, string>(); | 362 | param["second"] = querysplit[1]; |
381 | param["first"] = querysplit[0]; | ||
382 | param["second"] = querysplit[1]; | ||
383 | |||
384 | IDbCommand result = | ||
385 | database.Query( | ||
386 | "SELECT UUID,username,lastname FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second", | ||
387 | param); | ||
388 | IDataReader reader = result.ExecuteReader(); | ||
389 | |||
390 | 363 | ||
364 | using (IDbCommand result = database.Query("SELECT UUID,username,lastname FROM " + m_usersTableName + " WHERE username = @first AND lastname = @second", param)) | ||
365 | using (IDataReader reader = result.ExecuteReader()) | ||
366 | { | ||
391 | while (reader.Read()) | 367 | while (reader.Read()) |
392 | { | 368 | { |
393 | AvatarPickerAvatar user = new AvatarPickerAvatar(); | 369 | AvatarPickerAvatar user = new AvatarPickerAvatar(); |
@@ -395,34 +371,24 @@ namespace OpenSim.Data.MSSQL | |||
395 | user.firstName = (string)reader["username"]; | 371 | user.firstName = (string)reader["username"]; |
396 | user.lastName = (string)reader["lastname"]; | 372 | user.lastName = (string)reader["lastname"]; |
397 | returnlist.Add(user); | 373 | returnlist.Add(user); |
398 | } | 374 | } |
399 | reader.Close(); | ||
400 | result.Dispose(); | ||
401 | } | 375 | } |
402 | } | 376 | } |
403 | catch (Exception e) | 377 | catch (Exception e) |
404 | { | 378 | { |
405 | database.Reconnect(); | ||
406 | m_log.Error(e.ToString()); | 379 | m_log.Error(e.ToString()); |
407 | return returnlist; | ||
408 | } | 380 | } |
409 | } | 381 | } |
410 | else if (querysplit.Length == 1) | 382 | else if (querysplit.Length == 1) |
411 | { | 383 | { |
412 | try | 384 | try |
413 | { | 385 | { |
414 | lock (database) | 386 | Dictionary<string, string> param = new Dictionary<string, string>(); |
415 | { | 387 | param["first"] = querysplit[0]; |
416 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
417 | param["first"] = querysplit[0]; | ||
418 | |||
419 | IDbCommand result = | ||
420 | database.Query( | ||
421 | "SELECT UUID,username,lastname FROM " + m_usersTableName + " WHERE username = @first OR lastname = @first", | ||
422 | param); | ||
423 | IDataReader reader = result.ExecuteReader(); | ||
424 | |||
425 | 388 | ||
389 | using (IDbCommand result = database.Query("SELECT UUID,username,lastname FROM " + m_usersTableName + " WHERE username = @first OR lastname = @first", param)) | ||
390 | using (IDataReader reader = result.ExecuteReader()) | ||
391 | { | ||
426 | while (reader.Read()) | 392 | while (reader.Read()) |
427 | { | 393 | { |
428 | AvatarPickerAvatar user = new AvatarPickerAvatar(); | 394 | AvatarPickerAvatar user = new AvatarPickerAvatar(); |
@@ -431,15 +397,11 @@ namespace OpenSim.Data.MSSQL | |||
431 | user.lastName = (string)reader["lastname"]; | 397 | user.lastName = (string)reader["lastname"]; |
432 | returnlist.Add(user); | 398 | returnlist.Add(user); |
433 | } | 399 | } |
434 | reader.Close(); | ||
435 | result.Dispose(); | ||
436 | } | 400 | } |
437 | } | 401 | } |
438 | catch (Exception e) | 402 | catch (Exception e) |
439 | { | 403 | { |
440 | database.Reconnect(); | ||
441 | m_log.Error(e.ToString()); | 404 | m_log.Error(e.ToString()); |
442 | return returnlist; | ||
443 | } | 405 | } |
444 | } | 406 | } |
445 | return returnlist; | 407 | return returnlist; |
@@ -454,25 +416,17 @@ namespace OpenSim.Data.MSSQL | |||
454 | { | 416 | { |
455 | try | 417 | try |
456 | { | 418 | { |
457 | lock (database) | 419 | Dictionary<string, string> param = new Dictionary<string, string>(); |
458 | { | 420 | param["uuid"] = uuid.ToString(); |
459 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
460 | param["uuid"] = uuid.ToString(); | ||
461 | |||
462 | IDbCommand result = database.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = @uuid", param); | ||
463 | IDataReader reader = result.ExecuteReader(); | ||
464 | 421 | ||
465 | UserProfileData row = database.readUserRow(reader); | 422 | using (IDbCommand result = database.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = @uuid", param)) |
466 | 423 | using (IDataReader reader = result.ExecuteReader()) | |
467 | reader.Close(); | 424 | { |
468 | result.Dispose(); | 425 | return database.readUserRow(reader); |
469 | |||
470 | return row; | ||
471 | } | 426 | } |
472 | } | 427 | } |
473 | catch (Exception e) | 428 | catch (Exception e) |
474 | { | 429 | { |
475 | database.Reconnect(); | ||
476 | m_log.Error(e.ToString()); | 430 | m_log.Error(e.ToString()); |
477 | return null; | 431 | return null; |
478 | } | 432 | } |
@@ -509,25 +463,17 @@ namespace OpenSim.Data.MSSQL | |||
509 | { | 463 | { |
510 | try | 464 | try |
511 | { | 465 | { |
512 | lock (database) | 466 | Dictionary<string, string> param = new Dictionary<string, string>(); |
513 | { | 467 | param["uuid"] = uuid.ToString(); |
514 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
515 | param["uuid"] = uuid.ToString(); | ||
516 | |||
517 | IDbCommand result = database.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = @uuid", param); | ||
518 | IDataReader reader = result.ExecuteReader(); | ||
519 | |||
520 | UserAgentData row = database.readAgentRow(reader); | ||
521 | 468 | ||
522 | reader.Close(); | 469 | using (IDbCommand result = database.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = @uuid", param)) |
523 | result.Dispose(); | 470 | using (IDataReader reader = result.ExecuteReader()) |
524 | 471 | { | |
525 | return row; | 472 | return database.readAgentRow(reader); |
526 | } | 473 | } |
527 | } | 474 | } |
528 | catch (Exception e) | 475 | catch (Exception e) |
529 | { | 476 | { |
530 | database.Reconnect(); | ||
531 | m_log.Error(e.ToString()); | 477 | m_log.Error(e.ToString()); |
532 | return null; | 478 | return null; |
533 | } | 479 | } |
@@ -554,21 +500,17 @@ namespace OpenSim.Data.MSSQL | |||
554 | { | 500 | { |
555 | try | 501 | try |
556 | { | 502 | { |
557 | lock (database) | 503 | InsertUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, |
558 | { | 504 | user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, |
559 | InsertUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, | 505 | user.HomeLocation.Z, |
560 | user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, | 506 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, |
561 | user.HomeLocation.Z, | 507 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, |
562 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, | 508 | user.CanDoMask, user.WantDoMask, |
563 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, | 509 | user.AboutText, user.FirstLifeAboutText, user.Image, |
564 | user.CanDoMask, user.WantDoMask, | 510 | user.FirstLifeImage, user.WebLoginKey); |
565 | user.AboutText, user.FirstLifeAboutText, user.Image, | ||
566 | user.FirstLifeImage, user.WebLoginKey); | ||
567 | } | ||
568 | } | 511 | } |
569 | catch (Exception e) | 512 | catch (Exception e) |
570 | { | 513 | { |
571 | database.Reconnect(); | ||
572 | m_log.Error(e.ToString()); | 514 | m_log.Error(e.ToString()); |
573 | } | 515 | } |
574 | } | 516 | } |
@@ -646,16 +588,13 @@ namespace OpenSim.Data.MSSQL | |||
646 | parameters["profileFirstImage"] = firstImage.ToString(); | 588 | parameters["profileFirstImage"] = firstImage.ToString(); |
647 | parameters["webLoginKey"] = LLUUID.Random().ToString(); | 589 | parameters["webLoginKey"] = LLUUID.Random().ToString(); |
648 | 590 | ||
649 | bool returnval = false; | ||
650 | 591 | ||
651 | try | 592 | try |
652 | { | 593 | { |
653 | IDbCommand result = database.Query(sql, parameters); | 594 | using (IDbCommand result = database.Query(sql, parameters)) |
654 | 595 | { | |
655 | if (result.ExecuteNonQuery() == 1) | 596 | return (result.ExecuteNonQuery() == 1); |
656 | returnval = true; | 597 | } |
657 | |||
658 | result.Dispose(); | ||
659 | } | 598 | } |
660 | catch (Exception e) | 599 | catch (Exception e) |
661 | { | 600 | { |
@@ -663,7 +602,6 @@ namespace OpenSim.Data.MSSQL | |||
663 | return false; | 602 | return false; |
664 | } | 603 | } |
665 | 604 | ||
666 | return returnval; | ||
667 | } | 605 | } |
668 | 606 | ||
669 | /// <summary> | 607 | /// <summary> |
@@ -682,7 +620,7 @@ namespace OpenSim.Data.MSSQL | |||
682 | /// <returns></returns> | 620 | /// <returns></returns> |
683 | override public bool UpdateUserProfile(UserProfileData user) | 621 | override public bool UpdateUserProfile(UserProfileData user) |
684 | { | 622 | { |
685 | SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " + | 623 | using (IDbCommand command = database.Query("UPDATE " + m_usersTableName + " set UUID = @uuid, " + |
686 | "username = @username, " + | 624 | "username = @username, " + |
687 | "lastname = @lastname," + | 625 | "lastname = @lastname," + |
688 | "passwordHash = @passwordHash," + | 626 | "passwordHash = @passwordHash," + |
@@ -705,71 +643,66 @@ namespace OpenSim.Data.MSSQL | |||
705 | "profileImage = @profileImage," + | 643 | "profileImage = @profileImage," + |
706 | "profileFirstImage = @profileFirstImage, " + | 644 | "profileFirstImage = @profileFirstImage, " + |
707 | "webLoginKey = @webLoginKey where " + | 645 | "webLoginKey = @webLoginKey where " + |
708 | "UUID = @keyUUUID;", database.getConnection()); | 646 | "UUID = @keyUUUID;")) |
709 | SqlParameter param1 = new SqlParameter("@uuid", user.ID.ToString()); | 647 | { |
710 | SqlParameter param2 = new SqlParameter("@username", user.FirstName); | 648 | SqlParameter param1 = new SqlParameter("@uuid", user.ID.ToString()); |
711 | SqlParameter param3 = new SqlParameter("@lastname", user.SurName); | 649 | SqlParameter param2 = new SqlParameter("@username", user.FirstName); |
712 | SqlParameter param4 = new SqlParameter("@passwordHash", user.PasswordHash); | 650 | SqlParameter param3 = new SqlParameter("@lastname", user.SurName); |
713 | SqlParameter param5 = new SqlParameter("@passwordSalt", user.PasswordSalt); | 651 | SqlParameter param4 = new SqlParameter("@passwordHash", user.PasswordHash); |
714 | SqlParameter param6 = new SqlParameter("@homeRegion", Convert.ToInt64(user.HomeRegion)); | 652 | SqlParameter param5 = new SqlParameter("@passwordSalt", user.PasswordSalt); |
715 | SqlParameter param7 = new SqlParameter("@homeLocationX", user.HomeLocation.X); | 653 | SqlParameter param6 = new SqlParameter("@homeRegion", Convert.ToInt64(user.HomeRegion)); |
716 | SqlParameter param8 = new SqlParameter("@homeLocationY", user.HomeLocation.Y); | 654 | SqlParameter param7 = new SqlParameter("@homeLocationX", user.HomeLocation.X); |
717 | SqlParameter param9 = new SqlParameter("@homeLocationZ", user.HomeLocation.Y); | 655 | SqlParameter param8 = new SqlParameter("@homeLocationY", user.HomeLocation.Y); |
718 | SqlParameter param10 = new SqlParameter("@homeLookAtX", user.HomeLookAt.X); | 656 | SqlParameter param9 = new SqlParameter("@homeLocationZ", user.HomeLocation.Y); |
719 | SqlParameter param11 = new SqlParameter("@homeLookAtY", user.HomeLookAt.Y); | 657 | SqlParameter param10 = new SqlParameter("@homeLookAtX", user.HomeLookAt.X); |
720 | SqlParameter param12 = new SqlParameter("@homeLookAtZ", user.HomeLookAt.Z); | 658 | SqlParameter param11 = new SqlParameter("@homeLookAtY", user.HomeLookAt.Y); |
721 | SqlParameter param13 = new SqlParameter("@created", Convert.ToInt32(user.Created)); | 659 | SqlParameter param12 = new SqlParameter("@homeLookAtZ", user.HomeLookAt.Z); |
722 | SqlParameter param14 = new SqlParameter("@lastLogin", Convert.ToInt32(user.LastLogin)); | 660 | SqlParameter param13 = new SqlParameter("@created", Convert.ToInt32(user.Created)); |
723 | SqlParameter param15 = new SqlParameter("@userInventoryURI", user.UserInventoryURI); | 661 | SqlParameter param14 = new SqlParameter("@lastLogin", Convert.ToInt32(user.LastLogin)); |
724 | SqlParameter param16 = new SqlParameter("@userAssetURI", user.UserAssetURI); | 662 | SqlParameter param15 = new SqlParameter("@userInventoryURI", user.UserInventoryURI); |
725 | SqlParameter param17 = new SqlParameter("@profileCanDoMask", Convert.ToInt32(user.CanDoMask)); | 663 | SqlParameter param16 = new SqlParameter("@userAssetURI", user.UserAssetURI); |
726 | SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.WantDoMask)); | 664 | SqlParameter param17 = new SqlParameter("@profileCanDoMask", Convert.ToInt32(user.CanDoMask)); |
727 | SqlParameter param19 = new SqlParameter("@profileAboutText", user.AboutText); | 665 | SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.WantDoMask)); |
728 | SqlParameter param20 = new SqlParameter("@profileFirstText", user.FirstLifeAboutText); | 666 | SqlParameter param19 = new SqlParameter("@profileAboutText", user.AboutText); |
729 | SqlParameter param21 = new SqlParameter("@profileImage", user.Image.ToString()); | 667 | SqlParameter param20 = new SqlParameter("@profileFirstText", user.FirstLifeAboutText); |
730 | SqlParameter param22 = new SqlParameter("@profileFirstImage", user.FirstLifeImage.ToString()); | 668 | SqlParameter param21 = new SqlParameter("@profileImage", user.Image.ToString()); |
731 | SqlParameter param23 = new SqlParameter("@keyUUUID", user.ID.ToString()); | 669 | SqlParameter param22 = new SqlParameter("@profileFirstImage", user.FirstLifeImage.ToString()); |
732 | SqlParameter param24 = new SqlParameter("@webLoginKey", user.WebLoginKey.UUID.ToString()); | 670 | SqlParameter param23 = new SqlParameter("@keyUUUID", user.ID.ToString()); |
733 | command.Parameters.Add(param1); | 671 | SqlParameter param24 = new SqlParameter("@webLoginKey", user.WebLoginKey.UUID.ToString()); |
734 | command.Parameters.Add(param2); | 672 | command.Parameters.Add(param1); |
735 | command.Parameters.Add(param3); | 673 | command.Parameters.Add(param2); |
736 | command.Parameters.Add(param4); | 674 | command.Parameters.Add(param3); |
737 | command.Parameters.Add(param5); | 675 | command.Parameters.Add(param4); |
738 | command.Parameters.Add(param6); | 676 | command.Parameters.Add(param5); |
739 | command.Parameters.Add(param7); | 677 | command.Parameters.Add(param6); |
740 | command.Parameters.Add(param8); | 678 | command.Parameters.Add(param7); |
741 | command.Parameters.Add(param9); | 679 | command.Parameters.Add(param8); |
742 | command.Parameters.Add(param10); | 680 | command.Parameters.Add(param9); |
743 | command.Parameters.Add(param11); | 681 | command.Parameters.Add(param10); |
744 | command.Parameters.Add(param12); | 682 | command.Parameters.Add(param11); |
745 | command.Parameters.Add(param13); | 683 | command.Parameters.Add(param12); |
746 | command.Parameters.Add(param14); | 684 | command.Parameters.Add(param13); |
747 | command.Parameters.Add(param15); | 685 | command.Parameters.Add(param14); |
748 | command.Parameters.Add(param16); | 686 | command.Parameters.Add(param15); |
749 | command.Parameters.Add(param17); | 687 | command.Parameters.Add(param16); |
750 | command.Parameters.Add(param18); | 688 | command.Parameters.Add(param17); |
751 | command.Parameters.Add(param19); | 689 | command.Parameters.Add(param18); |
752 | command.Parameters.Add(param20); | 690 | command.Parameters.Add(param19); |
753 | command.Parameters.Add(param21); | 691 | command.Parameters.Add(param20); |
754 | command.Parameters.Add(param22); | 692 | command.Parameters.Add(param21); |
755 | command.Parameters.Add(param23); | 693 | command.Parameters.Add(param22); |
756 | command.Parameters.Add(param24); | 694 | command.Parameters.Add(param23); |
757 | try | 695 | command.Parameters.Add(param24); |
758 | { | 696 | try |
759 | int affected = command.ExecuteNonQuery(); | ||
760 | if (affected != 0) | ||
761 | { | 697 | { |
762 | return true; | 698 | int affected = command.ExecuteNonQuery(); |
699 | return (affected != 0); | ||
763 | } | 700 | } |
764 | else | 701 | catch (Exception e) |
765 | { | 702 | { |
766 | return false; | 703 | m_log.Error(e.ToString()); |
767 | } | 704 | } |
768 | } | 705 | } |
769 | catch (Exception e) | ||
770 | { | ||
771 | m_log.Error(e.ToString()); | ||
772 | } | ||
773 | return false; | 706 | return false; |
774 | } | 707 | } |
775 | 708 | ||
@@ -805,28 +738,21 @@ namespace OpenSim.Data.MSSQL | |||
805 | // return new AvatarAppearance(); | 738 | // return new AvatarAppearance(); |
806 | try | 739 | try |
807 | { | 740 | { |
808 | lock (database) | ||
809 | { | ||
810 | Dictionary<string, string> param = new Dictionary<string, string>(); | 741 | Dictionary<string, string> param = new Dictionary<string, string>(); |
811 | param["@UUID"] = user.ToString(); | 742 | param["@UUID"] = user.ToString(); |
812 | 743 | ||
813 | IDbCommand result = | 744 | using (IDbCommand result = |
814 | database.Query("SELECT * FROM avatarappearance WHERE owner = @UUID", param); | 745 | database.Query("SELECT * FROM avatarappearance WHERE owner = @UUID", param)) |
815 | IDataReader reader = result.ExecuteReader(); | 746 | using (IDataReader reader = result.ExecuteReader()) |
816 | 747 | { | |
817 | AvatarAppearance item = null; | 748 | AvatarAppearance item = null; |
818 | if (reader.Read()) | 749 | if (reader.Read()) |
819 | item = readUserAppearance(reader); | 750 | item = readUserAppearance(reader); |
820 | 751 | return item; | |
821 | reader.Close(); | 752 | } |
822 | result.Dispose(); | ||
823 | |||
824 | return item; | ||
825 | } | ||
826 | } | 753 | } |
827 | catch (Exception e) | 754 | catch (Exception e) |
828 | { | 755 | { |
829 | database.Reconnect(); | ||
830 | m_log.Error(e.ToString()); | 756 | m_log.Error(e.ToString()); |
831 | } | 757 | } |
832 | return null; | 758 | return null; |
@@ -906,49 +832,49 @@ namespace OpenSim.Data.MSSQL | |||
906 | sql += "@jacket_item, @jacket_asset, @gloves_item, @gloves_asset, @undershirt_item, @undershirt_asset, @underpants_item, @underpants_asset, "; | 832 | sql += "@jacket_item, @jacket_asset, @gloves_item, @gloves_asset, @undershirt_item, @undershirt_asset, @underpants_item, @underpants_asset, "; |
907 | sql += "@skirt_item, @skirt_asset)"; | 833 | sql += "@skirt_item, @skirt_asset)"; |
908 | 834 | ||
909 | SqlCommand cmd = new SqlCommand(sql, database.getConnection()); | 835 | using (AutoClosingSqlCommand cmd = database.Query(sql)) |
910 | cmd.Parameters.AddWithValue("@owner", appearance.Owner.ToString()); | 836 | { |
911 | cmd.Parameters.AddWithValue("@serial", appearance.Serial); | 837 | cmd.Parameters.AddWithValue("@owner", appearance.Owner.ToString()); |
912 | cmd.Parameters.AddWithValue("@visual_params", appearance.VisualParams); | 838 | cmd.Parameters.AddWithValue("@serial", appearance.Serial); |
913 | cmd.Parameters.AddWithValue("@texture", appearance.Texture.ToBytes()); | 839 | cmd.Parameters.AddWithValue("@visual_params", appearance.VisualParams); |
914 | cmd.Parameters.AddWithValue("@avatar_height", appearance.AvatarHeight); | 840 | cmd.Parameters.AddWithValue("@texture", appearance.Texture.ToBytes()); |
915 | cmd.Parameters.AddWithValue("@body_item", appearance.BodyItem.ToString()); | 841 | cmd.Parameters.AddWithValue("@avatar_height", appearance.AvatarHeight); |
916 | cmd.Parameters.AddWithValue("@body_asset", appearance.BodyAsset.ToString()); | 842 | cmd.Parameters.AddWithValue("@body_item", appearance.BodyItem.ToString()); |
917 | cmd.Parameters.AddWithValue("@skin_item", appearance.SkinItem.ToString()); | 843 | cmd.Parameters.AddWithValue("@body_asset", appearance.BodyAsset.ToString()); |
918 | cmd.Parameters.AddWithValue("@skin_asset", appearance.SkinAsset.ToString()); | 844 | cmd.Parameters.AddWithValue("@skin_item", appearance.SkinItem.ToString()); |
919 | cmd.Parameters.AddWithValue("@hair_item", appearance.HairItem.ToString()); | 845 | cmd.Parameters.AddWithValue("@skin_asset", appearance.SkinAsset.ToString()); |
920 | cmd.Parameters.AddWithValue("@hair_asset", appearance.HairAsset.ToString()); | 846 | cmd.Parameters.AddWithValue("@hair_item", appearance.HairItem.ToString()); |
921 | cmd.Parameters.AddWithValue("@eyes_item", appearance.EyesItem.ToString()); | 847 | cmd.Parameters.AddWithValue("@hair_asset", appearance.HairAsset.ToString()); |
922 | cmd.Parameters.AddWithValue("@eyes_asset", appearance.EyesAsset.ToString()); | 848 | cmd.Parameters.AddWithValue("@eyes_item", appearance.EyesItem.ToString()); |
923 | cmd.Parameters.AddWithValue("@shirt_item", appearance.ShirtItem.ToString()); | 849 | cmd.Parameters.AddWithValue("@eyes_asset", appearance.EyesAsset.ToString()); |
924 | cmd.Parameters.AddWithValue("@shirt_asset", appearance.ShirtAsset.ToString()); | 850 | cmd.Parameters.AddWithValue("@shirt_item", appearance.ShirtItem.ToString()); |
925 | cmd.Parameters.AddWithValue("@pants_item", appearance.PantsItem.ToString()); | 851 | cmd.Parameters.AddWithValue("@shirt_asset", appearance.ShirtAsset.ToString()); |
926 | cmd.Parameters.AddWithValue("@pants_asset", appearance.PantsAsset.ToString()); | 852 | cmd.Parameters.AddWithValue("@pants_item", appearance.PantsItem.ToString()); |
927 | cmd.Parameters.AddWithValue("@shoes_item", appearance.ShoesItem.ToString()); | 853 | cmd.Parameters.AddWithValue("@pants_asset", appearance.PantsAsset.ToString()); |
928 | cmd.Parameters.AddWithValue("@shoes_asset", appearance.ShoesAsset.ToString()); | 854 | cmd.Parameters.AddWithValue("@shoes_item", appearance.ShoesItem.ToString()); |
929 | cmd.Parameters.AddWithValue("@socks_item", appearance.SocksItem.ToString()); | 855 | cmd.Parameters.AddWithValue("@shoes_asset", appearance.ShoesAsset.ToString()); |
930 | cmd.Parameters.AddWithValue("@socks_asset", appearance.SocksAsset.ToString()); | 856 | cmd.Parameters.AddWithValue("@socks_item", appearance.SocksItem.ToString()); |
931 | cmd.Parameters.AddWithValue("@jacket_item", appearance.JacketItem.ToString()); | 857 | cmd.Parameters.AddWithValue("@socks_asset", appearance.SocksAsset.ToString()); |
932 | cmd.Parameters.AddWithValue("@jacket_asset", appearance.JacketAsset.ToString()); | 858 | cmd.Parameters.AddWithValue("@jacket_item", appearance.JacketItem.ToString()); |
933 | cmd.Parameters.AddWithValue("@gloves_item", appearance.GlovesItem.ToString()); | 859 | cmd.Parameters.AddWithValue("@jacket_asset", appearance.JacketAsset.ToString()); |
934 | cmd.Parameters.AddWithValue("@gloves_asset", appearance.GlovesAsset.ToString()); | 860 | cmd.Parameters.AddWithValue("@gloves_item", appearance.GlovesItem.ToString()); |
935 | cmd.Parameters.AddWithValue("@undershirt_item", appearance.UnderShirtItem.ToString()); | 861 | cmd.Parameters.AddWithValue("@gloves_asset", appearance.GlovesAsset.ToString()); |
936 | cmd.Parameters.AddWithValue("@undershirt_asset", appearance.UnderShirtAsset.ToString()); | 862 | cmd.Parameters.AddWithValue("@undershirt_item", appearance.UnderShirtItem.ToString()); |
937 | cmd.Parameters.AddWithValue("@underpants_item", appearance.UnderPantsItem.ToString()); | 863 | cmd.Parameters.AddWithValue("@undershirt_asset", appearance.UnderShirtAsset.ToString()); |
938 | cmd.Parameters.AddWithValue("@underpants_asset", appearance.UnderPantsAsset.ToString()); | 864 | cmd.Parameters.AddWithValue("@underpants_item", appearance.UnderPantsItem.ToString()); |
939 | cmd.Parameters.AddWithValue("@skirt_item", appearance.SkirtItem.ToString()); | 865 | cmd.Parameters.AddWithValue("@underpants_asset", appearance.UnderPantsAsset.ToString()); |
940 | cmd.Parameters.AddWithValue("@skirt_asset", appearance.SkirtAsset.ToString()); | 866 | cmd.Parameters.AddWithValue("@skirt_item", appearance.SkirtItem.ToString()); |
941 | 867 | cmd.Parameters.AddWithValue("@skirt_asset", appearance.SkirtAsset.ToString()); | |
942 | try | 868 | |
943 | { | 869 | try |
944 | cmd.ExecuteNonQuery(); | 870 | { |
945 | cmd.Dispose(); | 871 | cmd.ExecuteNonQuery(); |
946 | } | 872 | } |
947 | catch (Exception e) | 873 | catch (Exception e) |
948 | { | 874 | { |
949 | m_log.Error(e.ToString()); | 875 | m_log.Error(e.ToString()); |
876 | } | ||
950 | } | 877 | } |
951 | return; | ||
952 | } | 878 | } |
953 | 879 | ||
954 | /// <summary> | 880 | /// <summary> |
@@ -958,7 +884,7 @@ namespace OpenSim.Data.MSSQL | |||
958 | /// <param name="item">the item UUID</param> | 884 | /// <param name="item">the item UUID</param> |
959 | override public void AddAttachment(LLUUID user, LLUUID item) | 885 | override public void AddAttachment(LLUUID user, LLUUID item) |
960 | { | 886 | { |
961 | return; | 887 | // TBI? |
962 | } | 888 | } |
963 | 889 | ||
964 | /// <summary> | 890 | /// <summary> |
@@ -968,7 +894,7 @@ namespace OpenSim.Data.MSSQL | |||
968 | /// <param name="item">the item UUID</param> | 894 | /// <param name="item">the item UUID</param> |
969 | override public void RemoveAttachment(LLUUID user, LLUUID item) | 895 | override public void RemoveAttachment(LLUUID user, LLUUID item) |
970 | { | 896 | { |
971 | return; | 897 | // TBI? |
972 | } | 898 | } |
973 | 899 | ||
974 | /// <summary> | 900 | /// <summary> |