diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 36 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFSAssetData.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFramework.cs | 9 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 255 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 363 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXAssetData.cs | 57 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXInventoryData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/os_groups_Store.migrations | 2 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLXAssetData.cs | 20 |
14 files changed, 457 insertions, 386 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index f16cd91..8569c90 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Data.MySQL | |||
75 | dbcon.Open(); | 75 | dbcon.Open(); |
76 | Migration m = new Migration(dbcon, Assembly, "AssetStore"); | 76 | Migration m = new Migration(dbcon, Assembly, "AssetStore"); |
77 | m.Update(); | 77 | m.Update(); |
78 | dbcon.Close(); | ||
78 | } | 79 | } |
79 | } | 80 | } |
80 | 81 | ||
@@ -144,6 +145,7 @@ namespace OpenSim.Data.MySQL | |||
144 | string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e); | 145 | string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e); |
145 | } | 146 | } |
146 | } | 147 | } |
148 | dbcon.Close(); | ||
147 | } | 149 | } |
148 | 150 | ||
149 | return asset; | 151 | return asset; |
@@ -156,28 +158,27 @@ namespace OpenSim.Data.MySQL | |||
156 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 158 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
157 | override public bool StoreAsset(AssetBase asset) | 159 | override public bool StoreAsset(AssetBase asset) |
158 | { | 160 | { |
159 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 161 | string assetName = asset.Name; |
162 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | ||
160 | { | 163 | { |
161 | dbcon.Open(); | 164 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); |
162 | 165 | m_log.WarnFormat( | |
163 | string assetName = asset.Name; | 166 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", |
164 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | 167 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); |
165 | { | 168 | } |
166 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | ||
167 | m_log.WarnFormat( | ||
168 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
169 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
170 | } | ||
171 | 169 | ||
172 | string assetDescription = asset.Description; | 170 | string assetDescription = asset.Description; |
173 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 171 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) |
174 | { | 172 | { |
175 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 173 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); |
176 | m_log.WarnFormat( | 174 | m_log.WarnFormat( |
177 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 175 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", |
178 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 176 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); |
179 | } | 177 | } |
180 | 178 | ||
179 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
180 | { | ||
181 | dbcon.Open(); | ||
181 | using (MySqlCommand cmd = | 182 | using (MySqlCommand cmd = |
182 | new MySqlCommand( | 183 | new MySqlCommand( |
183 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + | 184 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + |
@@ -200,15 +201,17 @@ namespace OpenSim.Data.MySQL | |||
200 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
201 | cmd.Parameters.AddWithValue("?data", asset.Data); | 202 | cmd.Parameters.AddWithValue("?data", asset.Data); |
202 | cmd.ExecuteNonQuery(); | 203 | cmd.ExecuteNonQuery(); |
204 | dbcon.Close(); | ||
203 | return true; | 205 | return true; |
204 | } | 206 | } |
205 | catch (Exception e) | 207 | catch (Exception e) |
206 | { | 208 | { |
207 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | 209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
208 | asset.FullID, asset.Name, e.Message); | 210 | asset.FullID, asset.Name, e.Message); |
211 | dbcon.Close(); | ||
209 | return false; | 212 | return false; |
210 | } | 213 | } |
211 | } | 214 | } |
212 | } | 215 | } |
213 | } | 216 | } |
214 | 217 | ||
@@ -238,6 +241,7 @@ namespace OpenSim.Data.MySQL | |||
238 | e); | 241 | e); |
239 | } | 242 | } |
240 | } | 243 | } |
244 | dbcon.Close(); | ||
241 | } | 245 | } |
242 | } | 246 | } |
243 | 247 | ||
@@ -270,6 +274,7 @@ namespace OpenSim.Data.MySQL | |||
270 | } | 274 | } |
271 | } | 275 | } |
272 | } | 276 | } |
277 | dbcon.Close(); | ||
273 | } | 278 | } |
274 | 279 | ||
275 | bool[] results = new bool[uuids.Length]; | 280 | bool[] results = new bool[uuids.Length]; |
@@ -334,6 +339,7 @@ namespace OpenSim.Data.MySQL | |||
334 | e); | 339 | e); |
335 | } | 340 | } |
336 | } | 341 | } |
342 | dbcon.Close(); | ||
337 | } | 343 | } |
338 | 344 | ||
339 | return retList; | 345 | return retList; |
@@ -350,6 +356,7 @@ namespace OpenSim.Data.MySQL | |||
350 | cmd.Parameters.AddWithValue("?id", id); | 356 | cmd.Parameters.AddWithValue("?id", id); |
351 | cmd.ExecuteNonQuery(); | 357 | cmd.ExecuteNonQuery(); |
352 | } | 358 | } |
359 | dbcon.Close(); | ||
353 | } | 360 | } |
354 | 361 | ||
355 | return true; | 362 | return true; |
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index af6be75..fef582e 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Data.MySQL | |||
59 | dbcon.Open(); | 59 | dbcon.Open(); |
60 | Migration m = new Migration(dbcon, Assembly, "AuthStore"); | 60 | Migration m = new Migration(dbcon, Assembly, "AuthStore"); |
61 | m.Update(); | 61 | m.Update(); |
62 | dbcon.Close(); | ||
62 | } | 63 | } |
63 | } | 64 | } |
64 | 65 | ||
@@ -76,27 +77,30 @@ namespace OpenSim.Data.MySQL | |||
76 | { | 77 | { |
77 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 78 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
78 | 79 | ||
79 | IDataReader result = cmd.ExecuteReader(); | 80 | using(IDataReader result = cmd.ExecuteReader()) |
80 | |||
81 | if (result.Read()) | ||
82 | { | 81 | { |
83 | ret.PrincipalID = principalID; | 82 | if(result.Read()) |
83 | { | ||
84 | ret.PrincipalID = principalID; | ||
84 | 85 | ||
85 | CheckColumnNames(result); | 86 | CheckColumnNames(result); |
86 | 87 | ||
87 | foreach (string s in m_ColumnNames) | 88 | foreach(string s in m_ColumnNames) |
88 | { | 89 | { |
89 | if (s == "UUID") | 90 | if(s == "UUID") |
90 | continue; | 91 | continue; |
91 | 92 | ||
92 | ret.Data[s] = result[s].ToString(); | 93 | ret.Data[s] = result[s].ToString(); |
93 | } | 94 | } |
94 | 95 | ||
95 | return ret; | 96 | dbcon.Close(); |
96 | } | 97 | return ret; |
97 | else | 98 | } |
98 | { | 99 | else |
99 | return null; | 100 | { |
101 | dbcon.Close(); | ||
102 | return null; | ||
103 | } | ||
100 | } | 104 | } |
101 | } | 105 | } |
102 | } | 106 | } |
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index a5c8d24..eeedf02 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL | |||
82 | 82 | ||
83 | Migration m = new Migration(dbcon, Assembly, "EstateStore"); | 83 | Migration m = new Migration(dbcon, Assembly, "EstateStore"); |
84 | m.Update(); | 84 | m.Update(); |
85 | dbcon.Close(); | ||
85 | 86 | ||
86 | Type t = typeof(EstateSettings); | 87 | Type t = typeof(EstateSettings); |
87 | m_Fields = t.GetFields(BindingFlags.NonPublic | | 88 | m_Fields = t.GetFields(BindingFlags.NonPublic | |
@@ -143,7 +144,6 @@ namespace OpenSim.Data.MySQL | |||
143 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 144 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
144 | { | 145 | { |
145 | dbcon.Open(); | 146 | dbcon.Open(); |
146 | |||
147 | cmd.Connection = dbcon; | 147 | cmd.Connection = dbcon; |
148 | 148 | ||
149 | bool found = false; | 149 | bool found = false; |
@@ -171,6 +171,8 @@ namespace OpenSim.Data.MySQL | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | dbcon.Close(); | ||
175 | cmd.Connection = null; | ||
174 | 176 | ||
175 | if (!found && create) | 177 | if (!found && create) |
176 | { | 178 | { |
@@ -231,6 +233,7 @@ namespace OpenSim.Data.MySQL | |||
231 | 233 | ||
232 | es.Save(); | 234 | es.Save(); |
233 | } | 235 | } |
236 | dbcon.Close(); | ||
234 | } | 237 | } |
235 | } | 238 | } |
236 | 239 | ||
@@ -263,6 +266,7 @@ namespace OpenSim.Data.MySQL | |||
263 | 266 | ||
264 | cmd.ExecuteNonQuery(); | 267 | cmd.ExecuteNonQuery(); |
265 | } | 268 | } |
269 | dbcon.Close(); | ||
266 | } | 270 | } |
267 | 271 | ||
268 | SaveBanList(es); | 272 | SaveBanList(es); |
@@ -300,6 +304,7 @@ namespace OpenSim.Data.MySQL | |||
300 | } | 304 | } |
301 | } | 305 | } |
302 | } | 306 | } |
307 | dbcon.Close(); | ||
303 | } | 308 | } |
304 | } | 309 | } |
305 | 310 | ||
@@ -329,6 +334,7 @@ namespace OpenSim.Data.MySQL | |||
329 | cmd.Parameters.Clear(); | 334 | cmd.Parameters.Clear(); |
330 | } | 335 | } |
331 | } | 336 | } |
337 | dbcon.Close(); | ||
332 | } | 338 | } |
333 | } | 339 | } |
334 | 340 | ||
@@ -358,6 +364,7 @@ namespace OpenSim.Data.MySQL | |||
358 | cmd.Parameters.Clear(); | 364 | cmd.Parameters.Clear(); |
359 | } | 365 | } |
360 | } | 366 | } |
367 | dbcon.Close(); | ||
361 | } | 368 | } |
362 | } | 369 | } |
363 | 370 | ||
@@ -383,6 +390,7 @@ namespace OpenSim.Data.MySQL | |||
383 | } | 390 | } |
384 | } | 391 | } |
385 | } | 392 | } |
393 | dbcon.Close(); | ||
386 | } | 394 | } |
387 | 395 | ||
388 | return uuids.ToArray(); | 396 | return uuids.ToArray(); |
@@ -437,7 +445,6 @@ namespace OpenSim.Data.MySQL | |||
437 | reader.Close(); | 445 | reader.Close(); |
438 | } | 446 | } |
439 | } | 447 | } |
440 | |||
441 | dbcon.Close(); | 448 | dbcon.Close(); |
442 | } | 449 | } |
443 | 450 | ||
@@ -466,7 +473,6 @@ namespace OpenSim.Data.MySQL | |||
466 | reader.Close(); | 473 | reader.Close(); |
467 | } | 474 | } |
468 | } | 475 | } |
469 | |||
470 | dbcon.Close(); | 476 | dbcon.Close(); |
471 | } | 477 | } |
472 | 478 | ||
diff --git a/OpenSim/Data/MySQL/MySQLFSAssetData.cs b/OpenSim/Data/MySQL/MySQLFSAssetData.cs index 2837ce3..6c48607 100644 --- a/OpenSim/Data/MySQL/MySQLFSAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLFSAssetData.cs | |||
@@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL | |||
78 | conn.Open(); | 78 | conn.Open(); |
79 | Migration m = new Migration(conn, Assembly, "FSAssetStore"); | 79 | Migration m = new Migration(conn, Assembly, "FSAssetStore"); |
80 | m.Update(); | 80 | m.Update(); |
81 | conn.Close(); | ||
81 | } | 82 | } |
82 | } | 83 | } |
83 | catch (MySqlException e) | 84 | catch (MySqlException e) |
@@ -121,9 +122,13 @@ namespace OpenSim.Data.MySQL | |||
121 | } | 122 | } |
122 | catch (MySqlException e) | 123 | catch (MySqlException e) |
123 | { | 124 | { |
125 | cmd.Connection = null; | ||
126 | conn.Close(); | ||
124 | m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); | 127 | m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); |
125 | return false; | 128 | return false; |
126 | } | 129 | } |
130 | conn.Close(); | ||
131 | cmd.Connection = null; | ||
127 | } | 132 | } |
128 | 133 | ||
129 | return true; | 134 | return true; |
@@ -175,7 +180,7 @@ namespace OpenSim.Data.MySQL | |||
175 | UpdateAccessTime(id, AccessTime); | 180 | UpdateAccessTime(id, AccessTime); |
176 | } | 181 | } |
177 | } | 182 | } |
178 | 183 | conn.Close(); | |
179 | } | 184 | } |
180 | 185 | ||
181 | return meta; | 186 | return meta; |
@@ -206,6 +211,7 @@ namespace OpenSim.Data.MySQL | |||
206 | cmd.Parameters.AddWithValue("?id", AssetID); | 211 | cmd.Parameters.AddWithValue("?id", AssetID); |
207 | cmd.ExecuteNonQuery(); | 212 | cmd.ExecuteNonQuery(); |
208 | } | 213 | } |
214 | conn.Close(); | ||
209 | } | 215 | } |
210 | } | 216 | } |
211 | 217 | ||
@@ -299,6 +305,7 @@ namespace OpenSim.Data.MySQL | |||
299 | } | 305 | } |
300 | } | 306 | } |
301 | } | 307 | } |
308 | conn.Close(); | ||
302 | } | 309 | } |
303 | 310 | ||
304 | for (int i = 0; i < uuids.Length; i++) | 311 | for (int i = 0; i < uuids.Length; i++) |
@@ -333,6 +340,7 @@ namespace OpenSim.Data.MySQL | |||
333 | count = Convert.ToInt32(reader["count"]); | 340 | count = Convert.ToInt32(reader["count"]); |
334 | } | 341 | } |
335 | } | 342 | } |
343 | conn.Close(); | ||
336 | } | 344 | } |
337 | 345 | ||
338 | return count; | 346 | return count; |
@@ -413,8 +421,8 @@ namespace OpenSim.Data.MySQL | |||
413 | imported++; | 421 | imported++; |
414 | } | 422 | } |
415 | } | 423 | } |
416 | |||
417 | } | 424 | } |
425 | importConn.Close(); | ||
418 | } | 426 | } |
419 | 427 | ||
420 | MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported)); | 428 | MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported)); |
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs index 93662db..98106f0 100644 --- a/OpenSim/Data/MySQL/MySQLFramework.cs +++ b/OpenSim/Data/MySQL/MySQLFramework.cs | |||
@@ -74,7 +74,9 @@ namespace OpenSim.Data.MySQL | |||
74 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 74 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
75 | { | 75 | { |
76 | dbcon.Open(); | 76 | dbcon.Open(); |
77 | return ExecuteNonQueryWithConnection(cmd, dbcon); | 77 | int ret = ExecuteNonQueryWithConnection(cmd, dbcon); |
78 | dbcon.Close(); | ||
79 | return ret; | ||
78 | } | 80 | } |
79 | } | 81 | } |
80 | else | 82 | else |
@@ -97,12 +99,15 @@ namespace OpenSim.Data.MySQL | |||
97 | 99 | ||
98 | try | 100 | try |
99 | { | 101 | { |
100 | return cmd.ExecuteNonQuery(); | 102 | int ret = cmd.ExecuteNonQuery(); |
103 | cmd.Connection = null; | ||
104 | return ret; | ||
101 | } | 105 | } |
102 | catch (Exception e) | 106 | catch (Exception e) |
103 | { | 107 | { |
104 | m_log.Error(e.Message, e); | 108 | m_log.Error(e.Message, e); |
105 | m_log.Error(Environment.StackTrace.ToString()); | 109 | m_log.Error(Environment.StackTrace.ToString()); |
110 | cmd.Connection = null; | ||
106 | return 0; | 111 | return 0; |
107 | } | 112 | } |
108 | } | 113 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index bd8bbd5..9bd3c0c 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -160,8 +160,9 @@ namespace OpenSim.Data.MySQL | |||
160 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 160 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
161 | { | 161 | { |
162 | dbcon.Open(); | 162 | dbcon.Open(); |
163 | 163 | T[] ret = DoQueryWithConnection(cmd, dbcon); | |
164 | return DoQueryWithConnection(cmd, dbcon); | 164 | dbcon.Close(); |
165 | return ret; | ||
165 | } | 166 | } |
166 | } | 167 | } |
167 | else | 168 | else |
@@ -243,7 +244,7 @@ namespace OpenSim.Data.MySQL | |||
243 | result.Add(row); | 244 | result.Add(row); |
244 | } | 245 | } |
245 | } | 246 | } |
246 | 247 | cmd.Connection = null; | |
247 | return result.ToArray(); | 248 | return result.ToArray(); |
248 | } | 249 | } |
249 | 250 | ||
@@ -402,7 +403,10 @@ namespace OpenSim.Data.MySQL | |||
402 | dbcon.Open(); | 403 | dbcon.Open(); |
403 | cmd.Connection = dbcon; | 404 | cmd.Connection = dbcon; |
404 | 405 | ||
405 | return cmd.ExecuteScalar(); | 406 | Object ret = cmd.ExecuteScalar(); |
407 | cmd.Connection = null; | ||
408 | dbcon.Close(); | ||
409 | return ret; | ||
406 | } | 410 | } |
407 | } | 411 | } |
408 | else | 412 | else |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 382d4a5..cc787cc 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL | |||
78 | dbcon.Open(); | 78 | dbcon.Open(); |
79 | Migration m = new Migration(dbcon, assem, "InventoryStore"); | 79 | Migration m = new Migration(dbcon, assem, "InventoryStore"); |
80 | m.Update(); | 80 | m.Update(); |
81 | dbcon.Close(); | ||
81 | } | 82 | } |
82 | } | 83 | } |
83 | 84 | ||
@@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL | |||
130 | items.Add(item); | 131 | items.Add(item); |
131 | } | 132 | } |
132 | 133 | ||
134 | dbcon.Close(); | ||
133 | return items; | 135 | return items; |
134 | } | 136 | } |
135 | } | 137 | } |
@@ -170,6 +172,7 @@ namespace OpenSim.Data.MySQL | |||
170 | while (reader.Read()) | 172 | while (reader.Read()) |
171 | items.Add(readInventoryFolder(reader)); | 173 | items.Add(readInventoryFolder(reader)); |
172 | 174 | ||
175 | dbcon.Close(); | ||
173 | return items; | 176 | return items; |
174 | } | 177 | } |
175 | } | 178 | } |
@@ -221,6 +224,7 @@ namespace OpenSim.Data.MySQL | |||
221 | if (items.Count > 0) | 224 | if (items.Count > 0) |
222 | rootFolder = items[0]; | 225 | rootFolder = items[0]; |
223 | 226 | ||
227 | dbcon.Close(); | ||
224 | return rootFolder; | 228 | return rootFolder; |
225 | } | 229 | } |
226 | } | 230 | } |
@@ -261,6 +265,7 @@ namespace OpenSim.Data.MySQL | |||
261 | while (reader.Read()) | 265 | while (reader.Read()) |
262 | items.Add(readInventoryFolder(reader)); | 266 | items.Add(readInventoryFolder(reader)); |
263 | 267 | ||
268 | dbcon.Close(); | ||
264 | return items; | 269 | return items; |
265 | } | 270 | } |
266 | } | 271 | } |
@@ -352,6 +357,7 @@ namespace OpenSim.Data.MySQL | |||
352 | if (reader.Read()) | 357 | if (reader.Read()) |
353 | item = readInventoryItem(reader); | 358 | item = readInventoryItem(reader); |
354 | 359 | ||
360 | dbcon.Close(); | ||
355 | return item; | 361 | return item; |
356 | } | 362 | } |
357 | } | 363 | } |
@@ -417,6 +423,7 @@ namespace OpenSim.Data.MySQL | |||
417 | if (reader.Read()) | 423 | if (reader.Read()) |
418 | folder = readInventoryFolder(reader); | 424 | folder = readInventoryFolder(reader); |
419 | 425 | ||
426 | dbcon.Close(); | ||
420 | return folder; | 427 | return folder; |
421 | } | 428 | } |
422 | } | 429 | } |
@@ -504,6 +511,7 @@ namespace OpenSim.Data.MySQL | |||
504 | lock (m_dbLock) | 511 | lock (m_dbLock) |
505 | result.ExecuteNonQuery(); | 512 | result.ExecuteNonQuery(); |
506 | } | 513 | } |
514 | dbcon.Close(); | ||
507 | } | 515 | } |
508 | } | 516 | } |
509 | catch (MySqlException e) | 517 | catch (MySqlException e) |
@@ -540,6 +548,7 @@ namespace OpenSim.Data.MySQL | |||
540 | lock (m_dbLock) | 548 | lock (m_dbLock) |
541 | cmd.ExecuteNonQuery(); | 549 | cmd.ExecuteNonQuery(); |
542 | } | 550 | } |
551 | dbcon.Close(); | ||
543 | } | 552 | } |
544 | } | 553 | } |
545 | catch (MySqlException e) | 554 | catch (MySqlException e) |
@@ -600,6 +609,7 @@ namespace OpenSim.Data.MySQL | |||
600 | m_log.Error(e.ToString()); | 609 | m_log.Error(e.ToString()); |
601 | } | 610 | } |
602 | } | 611 | } |
612 | dbcon.Close(); | ||
603 | } | 613 | } |
604 | } | 614 | } |
605 | 615 | ||
@@ -643,6 +653,7 @@ namespace OpenSim.Data.MySQL | |||
643 | m_log.Error(e.ToString()); | 653 | m_log.Error(e.ToString()); |
644 | } | 654 | } |
645 | } | 655 | } |
656 | dbcon.Close(); | ||
646 | } | 657 | } |
647 | } | 658 | } |
648 | 659 | ||
@@ -806,6 +817,7 @@ namespace OpenSim.Data.MySQL | |||
806 | lock (m_dbLock) | 817 | lock (m_dbLock) |
807 | cmd.ExecuteNonQuery(); | 818 | cmd.ExecuteNonQuery(); |
808 | } | 819 | } |
820 | dbcon.Close(); | ||
809 | } | 821 | } |
810 | } | 822 | } |
811 | catch (MySqlException e) | 823 | catch (MySqlException e) |
@@ -833,6 +845,7 @@ namespace OpenSim.Data.MySQL | |||
833 | lock (m_dbLock) | 845 | lock (m_dbLock) |
834 | cmd.ExecuteNonQuery(); | 846 | cmd.ExecuteNonQuery(); |
835 | } | 847 | } |
848 | dbcon.Close(); | ||
836 | } | 849 | } |
837 | } | 850 | } |
838 | catch (MySqlException e) | 851 | catch (MySqlException e) |
@@ -886,6 +899,7 @@ namespace OpenSim.Data.MySQL | |||
886 | if (item != null) | 899 | if (item != null) |
887 | list.Add(item); | 900 | list.Add(item); |
888 | } | 901 | } |
902 | dbcon.Close(); | ||
889 | return list; | 903 | return list; |
890 | } | 904 | } |
891 | } | 905 | } |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 0e55285..46df421 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Data.MySQL | |||
60 | dbcon.Open(); | 60 | dbcon.Open(); |
61 | Migration m = new Migration(dbcon, Assembly, "GridStore"); | 61 | Migration m = new Migration(dbcon, Assembly, "GridStore"); |
62 | m.Update(); | 62 | m.Update(); |
63 | dbcon.Close(); | ||
63 | } | 64 | } |
64 | } | 65 | } |
65 | 66 | ||
@@ -260,6 +261,8 @@ namespace OpenSim.Data.MySQL | |||
260 | retList.Add(ret); | 261 | retList.Add(ret); |
261 | } | 262 | } |
262 | } | 263 | } |
264 | cmd.Connection = null; | ||
265 | dbcon.Close(); | ||
263 | } | 266 | } |
264 | 267 | ||
265 | return retList; | 268 | return retList; |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 5740b91..4766372 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Data.MySQL | |||
88 | // | 88 | // |
89 | Migration m = new Migration(dbcon, Assembly, "RegionStore"); | 89 | Migration m = new Migration(dbcon, Assembly, "RegionStore"); |
90 | m.Update(); | 90 | m.Update(); |
91 | dbcon.Close(); | ||
91 | } | 92 | } |
92 | } | 93 | } |
93 | 94 | ||
@@ -261,6 +262,7 @@ namespace OpenSim.Data.MySQL | |||
261 | ExecuteNonQuery(cmd); | 262 | ExecuteNonQuery(cmd); |
262 | } | 263 | } |
263 | } | 264 | } |
265 | dbcon.Close(); | ||
264 | } | 266 | } |
265 | } | 267 | } |
266 | } | 268 | } |
@@ -300,6 +302,7 @@ namespace OpenSim.Data.MySQL | |||
300 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; | 302 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; |
301 | ExecuteNonQuery(cmd); | 303 | ExecuteNonQuery(cmd); |
302 | } | 304 | } |
305 | dbcon.Close(); | ||
303 | } | 306 | } |
304 | } | 307 | } |
305 | 308 | ||
@@ -334,6 +337,7 @@ namespace OpenSim.Data.MySQL | |||
334 | 337 | ||
335 | ExecuteNonQuery(cmd); | 338 | ExecuteNonQuery(cmd); |
336 | } | 339 | } |
340 | dbcon.Close(); | ||
337 | } | 341 | } |
338 | } | 342 | } |
339 | } | 343 | } |
@@ -372,6 +376,7 @@ namespace OpenSim.Data.MySQL | |||
372 | 376 | ||
373 | ExecuteNonQuery(cmd); | 377 | ExecuteNonQuery(cmd); |
374 | } | 378 | } |
379 | dbcon.Close(); | ||
375 | } | 380 | } |
376 | } | 381 | } |
377 | } | 382 | } |
@@ -411,6 +416,7 @@ namespace OpenSim.Data.MySQL | |||
411 | 416 | ||
412 | ExecuteNonQuery(cmd); | 417 | ExecuteNonQuery(cmd); |
413 | } | 418 | } |
419 | dbcon.Close(); | ||
414 | } | 420 | } |
415 | } | 421 | } |
416 | } | 422 | } |
@@ -460,6 +466,7 @@ namespace OpenSim.Data.MySQL | |||
460 | } | 466 | } |
461 | } | 467 | } |
462 | } | 468 | } |
469 | dbcon.Close(); | ||
463 | } | 470 | } |
464 | } | 471 | } |
465 | 472 | ||
@@ -535,6 +542,7 @@ namespace OpenSim.Data.MySQL | |||
535 | } | 542 | } |
536 | } | 543 | } |
537 | } | 544 | } |
545 | dbcon.Close(); | ||
538 | } | 546 | } |
539 | } | 547 | } |
540 | 548 | ||
@@ -580,6 +588,7 @@ namespace OpenSim.Data.MySQL | |||
580 | } | 588 | } |
581 | } | 589 | } |
582 | } | 590 | } |
591 | dbcon.Close(); | ||
583 | } | 592 | } |
584 | 593 | ||
585 | prim.Inventory.RestoreInventoryItems(inventory); | 594 | prim.Inventory.RestoreInventoryItems(inventory); |
@@ -634,6 +643,7 @@ namespace OpenSim.Data.MySQL | |||
634 | } | 643 | } |
635 | } | 644 | } |
636 | } | 645 | } |
646 | dbcon.Close(); | ||
637 | } | 647 | } |
638 | } | 648 | } |
639 | }); | 649 | }); |
@@ -681,6 +691,7 @@ namespace OpenSim.Data.MySQL | |||
681 | } | 691 | } |
682 | } | 692 | } |
683 | } | 693 | } |
694 | dbcon.Close(); | ||
684 | } | 695 | } |
685 | } | 696 | } |
686 | }); | 697 | }); |
@@ -727,6 +738,7 @@ namespace OpenSim.Data.MySQL | |||
727 | } | 738 | } |
728 | } | 739 | } |
729 | } | 740 | } |
741 | dbcon.Close(); | ||
730 | } | 742 | } |
731 | } | 743 | } |
732 | 744 | ||
@@ -762,6 +774,7 @@ namespace OpenSim.Data.MySQL | |||
762 | } | 774 | } |
763 | } | 775 | } |
764 | } | 776 | } |
777 | dbcon.Close(); | ||
765 | } | 778 | } |
766 | } | 779 | } |
767 | 780 | ||
@@ -783,6 +796,7 @@ namespace OpenSim.Data.MySQL | |||
783 | 796 | ||
784 | ExecuteNonQuery(cmd); | 797 | ExecuteNonQuery(cmd); |
785 | } | 798 | } |
799 | dbcon.Close(); | ||
786 | } | 800 | } |
787 | } | 801 | } |
788 | } | 802 | } |
@@ -842,6 +856,7 @@ namespace OpenSim.Data.MySQL | |||
842 | cmd.Parameters.Clear(); | 856 | cmd.Parameters.Clear(); |
843 | } | 857 | } |
844 | } | 858 | } |
859 | dbcon.Close(); | ||
845 | } | 860 | } |
846 | } | 861 | } |
847 | } | 862 | } |
@@ -863,82 +878,85 @@ namespace OpenSim.Data.MySQL | |||
863 | 878 | ||
864 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | 879 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
865 | 880 | ||
866 | IDataReader result = ExecuteReader(cmd); | 881 | using(IDataReader result = ExecuteReader(cmd)) |
867 | if (!result.Read()) | ||
868 | { | 882 | { |
869 | //No result, so store our default windlight profile and return it | 883 | if(!result.Read()) |
870 | nWP.regionID = regionUUID; | 884 | { |
871 | // StoreRegionWindlightSettings(nWP); | 885 | //No result, so store our default windlight profile and return it |
872 | return nWP; | 886 | nWP.regionID = regionUUID; |
873 | } | 887 | // StoreRegionWindlightSettings(nWP); |
874 | else | 888 | return nWP; |
875 | { | 889 | } |
876 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | 890 | else |
877 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 891 | { |
878 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 892 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
879 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 893 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
880 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 894 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
881 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 895 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
882 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 896 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
883 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 897 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
884 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 898 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
885 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 899 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
886 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 900 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
887 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 901 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
888 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 902 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
889 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 903 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
890 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 904 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
891 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 905 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
892 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 906 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
893 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 907 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
894 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 908 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
895 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 909 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
896 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 910 | UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture); |
897 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 911 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
898 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 912 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
899 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 913 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
900 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 914 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
901 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 915 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
902 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 916 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
903 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 917 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
904 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 918 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
905 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 919 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
906 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 920 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
907 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 921 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
908 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 922 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
909 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 923 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
910 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 924 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
911 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 925 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
912 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 926 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
913 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 927 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
914 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 928 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
915 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 929 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
916 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 930 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
917 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 931 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
918 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 932 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
919 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 933 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
920 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 934 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
921 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 935 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
922 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 936 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
923 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 937 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
924 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 938 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
925 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 939 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
926 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 940 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
927 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 941 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
928 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 942 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); |
929 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 943 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); |
930 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 944 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); |
931 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 945 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); |
932 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 946 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); |
933 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 947 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); |
934 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 948 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); |
935 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 949 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); |
936 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 950 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); |
937 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 951 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); |
938 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 952 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); |
939 | nWP.valid = true; | 953 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); |
954 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
955 | nWP.valid = true; | ||
956 | } | ||
940 | } | 957 | } |
941 | } | 958 | } |
959 | dbcon.Close(); | ||
942 | } | 960 | } |
943 | 961 | ||
944 | return nWP; | 962 | return nWP; |
@@ -947,6 +965,7 @@ namespace OpenSim.Data.MySQL | |||
947 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) | 965 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
948 | { | 966 | { |
949 | RegionSettings rs = null; | 967 | RegionSettings rs = null; |
968 | bool needStore = false; | ||
950 | 969 | ||
951 | lock (m_dbLock) | 970 | lock (m_dbLock) |
952 | { | 971 | { |
@@ -972,13 +991,17 @@ namespace OpenSim.Data.MySQL | |||
972 | rs.RegionUUID = regionUUID; | 991 | rs.RegionUUID = regionUUID; |
973 | rs.OnSave += StoreRegionSettings; | 992 | rs.OnSave += StoreRegionSettings; |
974 | 993 | ||
975 | StoreRegionSettings(rs); | 994 | needStore = true; |
976 | } | 995 | } |
977 | } | 996 | } |
978 | } | 997 | } |
998 | dbcon.Close(); | ||
979 | } | 999 | } |
980 | } | 1000 | } |
981 | 1001 | ||
1002 | if(needStore) | ||
1003 | StoreRegionSettings(rs); | ||
1004 | |||
982 | LoadSpawnPoints(rs); | 1005 | LoadSpawnPoints(rs); |
983 | 1006 | ||
984 | return rs; | 1007 | return rs; |
@@ -992,31 +1015,32 @@ namespace OpenSim.Data.MySQL | |||
992 | 1015 | ||
993 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1016 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
994 | { | 1017 | { |
995 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 1018 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, " |
996 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 1019 | + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, " |
997 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; | 1020 | + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, " |
998 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; | 1021 | + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, " |
999 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; | 1022 | + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, " |
1000 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; | 1023 | + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, " |
1001 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; | 1024 | + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, " |
1002 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; | 1025 | + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, " |
1003 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; | 1026 | + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, " |
1004 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; | 1027 | + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, " |
1005 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; | 1028 | + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, " |
1006 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; | 1029 | + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, " |
1007 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; | 1030 | + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, " |
1008 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; | 1031 | + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, " |
1009 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; | 1032 | + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, " |
1010 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; | 1033 | + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, " |
1011 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; | 1034 | + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, " |
1012 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; | 1035 | + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, " |
1013 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; | 1036 | + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, " |
1014 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; | 1037 | + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, " |
1015 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; | 1038 | + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, " |
1016 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 1039 | + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, " |
1017 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; | 1040 | + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, " |
1018 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; | 1041 | + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, " |
1019 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 1042 | + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)" |
1043 | ; | ||
1020 | 1044 | ||
1021 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 1045 | cmd.Parameters.AddWithValue("region_id", wl.regionID); |
1022 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 1046 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); |
@@ -1084,6 +1108,7 @@ namespace OpenSim.Data.MySQL | |||
1084 | 1108 | ||
1085 | ExecuteNonQuery(cmd); | 1109 | ExecuteNonQuery(cmd); |
1086 | } | 1110 | } |
1111 | dbcon.Close(); | ||
1087 | } | 1112 | } |
1088 | } | 1113 | } |
1089 | 1114 | ||
@@ -1099,6 +1124,7 @@ namespace OpenSim.Data.MySQL | |||
1099 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | 1124 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); |
1100 | ExecuteNonQuery(cmd); | 1125 | ExecuteNonQuery(cmd); |
1101 | } | 1126 | } |
1127 | dbcon.Close(); | ||
1102 | } | 1128 | } |
1103 | } | 1129 | } |
1104 | 1130 | ||
@@ -1117,14 +1143,19 @@ namespace OpenSim.Data.MySQL | |||
1117 | 1143 | ||
1118 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1144 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1119 | 1145 | ||
1120 | IDataReader result = ExecuteReader(cmd); | 1146 | using(IDataReader result = ExecuteReader(cmd)) |
1121 | if (!result.Read()) | ||
1122 | { | 1147 | { |
1123 | return String.Empty; | 1148 | if(!result.Read()) |
1124 | } | 1149 | { |
1125 | else | 1150 | dbcon.Close(); |
1126 | { | 1151 | return String.Empty; |
1127 | return Convert.ToString(result["llsd_settings"]); | 1152 | } |
1153 | else | ||
1154 | { | ||
1155 | string ret = Convert.ToString(result["llsd_settings"]); | ||
1156 | dbcon.Close(); | ||
1157 | return ret; | ||
1158 | } | ||
1128 | } | 1159 | } |
1129 | } | 1160 | } |
1130 | } | 1161 | } |
@@ -1145,6 +1176,7 @@ namespace OpenSim.Data.MySQL | |||
1145 | 1176 | ||
1146 | ExecuteNonQuery(cmd); | 1177 | ExecuteNonQuery(cmd); |
1147 | } | 1178 | } |
1179 | dbcon.Close(); | ||
1148 | } | 1180 | } |
1149 | } | 1181 | } |
1150 | 1182 | ||
@@ -1160,6 +1192,7 @@ namespace OpenSim.Data.MySQL | |||
1160 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1192 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1161 | ExecuteNonQuery(cmd); | 1193 | ExecuteNonQuery(cmd); |
1162 | } | 1194 | } |
1195 | dbcon.Close(); | ||
1163 | } | 1196 | } |
1164 | } | 1197 | } |
1165 | #endregion | 1198 | #endregion |
@@ -1212,7 +1245,7 @@ namespace OpenSim.Data.MySQL | |||
1212 | FillRegionSettingsCommand(cmd, rs); | 1245 | FillRegionSettingsCommand(cmd, rs); |
1213 | ExecuteNonQuery(cmd); | 1246 | ExecuteNonQuery(cmd); |
1214 | } | 1247 | } |
1215 | 1248 | dbcon.Close(); | |
1216 | SaveSpawnPoints(rs); | 1249 | SaveSpawnPoints(rs); |
1217 | } | 1250 | } |
1218 | } | 1251 | } |
@@ -1259,6 +1292,7 @@ namespace OpenSim.Data.MySQL | |||
1259 | } | 1292 | } |
1260 | } | 1293 | } |
1261 | } | 1294 | } |
1295 | dbcon.Close(); | ||
1262 | } | 1296 | } |
1263 | } | 1297 | } |
1264 | 1298 | ||
@@ -2123,6 +2157,7 @@ namespace OpenSim.Data.MySQL | |||
2123 | ExecuteNonQuery(cmd); | 2157 | ExecuteNonQuery(cmd); |
2124 | } | 2158 | } |
2125 | } | 2159 | } |
2160 | dbcon.Close(); | ||
2126 | } | 2161 | } |
2127 | } | 2162 | } |
2128 | } | 2163 | } |
@@ -2152,6 +2187,7 @@ namespace OpenSim.Data.MySQL | |||
2152 | } | 2187 | } |
2153 | } | 2188 | } |
2154 | } | 2189 | } |
2190 | dbcon.Close(); | ||
2155 | } | 2191 | } |
2156 | } | 2192 | } |
2157 | 2193 | ||
@@ -2187,6 +2223,7 @@ namespace OpenSim.Data.MySQL | |||
2187 | } | 2223 | } |
2188 | } | 2224 | } |
2189 | } | 2225 | } |
2226 | dbcon.Close(); | ||
2190 | } | 2227 | } |
2191 | } | 2228 | } |
2192 | } | 2229 | } |
@@ -2221,6 +2258,7 @@ namespace OpenSim.Data.MySQL | |||
2221 | cmd.Parameters.Clear(); | 2258 | cmd.Parameters.Clear(); |
2222 | } | 2259 | } |
2223 | } | 2260 | } |
2261 | dbcon.Close(); | ||
2224 | } | 2262 | } |
2225 | } | 2263 | } |
2226 | } | 2264 | } |
@@ -2240,6 +2278,7 @@ namespace OpenSim.Data.MySQL | |||
2240 | 2278 | ||
2241 | cmd.ExecuteNonQuery(); | 2279 | cmd.ExecuteNonQuery(); |
2242 | } | 2280 | } |
2281 | dbcon.Close(); | ||
2243 | } | 2282 | } |
2244 | } | 2283 | } |
2245 | 2284 | ||
@@ -2257,6 +2296,7 @@ namespace OpenSim.Data.MySQL | |||
2257 | 2296 | ||
2258 | cmd.ExecuteNonQuery(); | 2297 | cmd.ExecuteNonQuery(); |
2259 | } | 2298 | } |
2299 | dbcon.Close(); | ||
2260 | } | 2300 | } |
2261 | } | 2301 | } |
2262 | 2302 | ||
@@ -2280,6 +2320,7 @@ namespace OpenSim.Data.MySQL | |||
2280 | } | 2320 | } |
2281 | } | 2321 | } |
2282 | } | 2322 | } |
2323 | dbcon.Close(); | ||
2283 | } | 2324 | } |
2284 | 2325 | ||
2285 | return ret; | 2326 | return ret; |
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index 8af2a3e..c98e017 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -69,6 +69,7 @@ namespace OpenSim.Data.MySQL | |||
69 | 69 | ||
70 | Migration m = new Migration(dbcon, Assembly, "UserProfiles"); | 70 | Migration m = new Migration(dbcon, Assembly, "UserProfiles"); |
71 | m.Update(); | 71 | m.Update(); |
72 | dbcon.Close(); | ||
72 | } | 73 | } |
73 | } | 74 | } |
74 | #endregion Member Functions | 75 | #endregion Member Functions |
@@ -89,7 +90,7 @@ namespace OpenSim.Data.MySQL | |||
89 | 90 | ||
90 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 91 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
91 | { | 92 | { |
92 | string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; | 93 | const string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id"; |
93 | dbcon.Open(); | 94 | dbcon.Open(); |
94 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 95 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
95 | { | 96 | { |
@@ -121,58 +122,58 @@ namespace OpenSim.Data.MySQL | |||
121 | } | 122 | } |
122 | } | 123 | } |
123 | } | 124 | } |
125 | dbcon.Close(); | ||
124 | } | 126 | } |
125 | return data; | 127 | return data; |
126 | } | 128 | } |
127 | 129 | ||
128 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) | 130 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) |
129 | { | 131 | { |
130 | string query = string.Empty; | 132 | const string query = |
131 | 133 | "INSERT INTO classifieds (" | |
132 | 134 | + "`classifieduuid`," | |
133 | query += "INSERT INTO classifieds ("; | 135 | + "`creatoruuid`," |
134 | query += "`classifieduuid`,"; | 136 | + "`creationdate`," |
135 | query += "`creatoruuid`,"; | 137 | + "`expirationdate`," |
136 | query += "`creationdate`,"; | 138 | + "`category`," |
137 | query += "`expirationdate`,"; | 139 | + "`name`," |
138 | query += "`category`,"; | 140 | + "`description`," |
139 | query += "`name`,"; | 141 | + "`parceluuid`," |
140 | query += "`description`,"; | 142 | + "`parentestate`," |
141 | query += "`parceluuid`,"; | 143 | + "`snapshotuuid`," |
142 | query += "`parentestate`,"; | 144 | + "`simname`," |
143 | query += "`snapshotuuid`,"; | 145 | + "`posglobal`," |
144 | query += "`simname`,"; | 146 | + "`parcelname`," |
145 | query += "`posglobal`,"; | 147 | + "`classifiedflags`," |
146 | query += "`parcelname`,"; | 148 | + "`priceforlisting`) " |
147 | query += "`classifiedflags`,"; | 149 | + "VALUES (" |
148 | query += "`priceforlisting`) "; | 150 | + "?ClassifiedId," |
149 | query += "VALUES ("; | 151 | + "?CreatorId," |
150 | query += "?ClassifiedId,"; | 152 | + "?CreatedDate," |
151 | query += "?CreatorId,"; | 153 | + "?ExpirationDate," |
152 | query += "?CreatedDate,"; | 154 | + "?Category," |
153 | query += "?ExpirationDate,"; | 155 | + "?Name," |
154 | query += "?Category,"; | 156 | + "?Description," |
155 | query += "?Name,"; | 157 | + "?ParcelId," |
156 | query += "?Description,"; | 158 | + "?ParentEstate," |
157 | query += "?ParcelId,"; | 159 | + "?SnapshotId," |
158 | query += "?ParentEstate,"; | 160 | + "?SimName," |
159 | query += "?SnapshotId,"; | 161 | + "?GlobalPos," |
160 | query += "?SimName,"; | 162 | + "?ParcelName," |
161 | query += "?GlobalPos,"; | 163 | + "?Flags," |
162 | query += "?ParcelName,"; | 164 | + "?ListingPrice ) " |
163 | query += "?Flags,"; | 165 | + "ON DUPLICATE KEY UPDATE " |
164 | query += "?ListingPrice ) "; | 166 | + "category=?Category, " |
165 | query += "ON DUPLICATE KEY UPDATE "; | 167 | + "expirationdate=?ExpirationDate, " |
166 | query += "category=?Category, "; | 168 | + "name=?Name, " |
167 | query += "expirationdate=?ExpirationDate, "; | 169 | + "description=?Description, " |
168 | query += "name=?Name, "; | 170 | + "parentestate=?ParentEstate, " |
169 | query += "description=?Description, "; | 171 | + "posglobal=?GlobalPos, " |
170 | query += "parentestate=?ParentEstate, "; | 172 | + "parcelname=?ParcelName, " |
171 | query += "posglobal=?GlobalPos, "; | 173 | + "classifiedflags=?Flags, " |
172 | query += "parcelname=?ParcelName, "; | 174 | + "priceforlisting=?ListingPrice, " |
173 | query += "classifiedflags=?Flags, "; | 175 | + "snapshotuuid=?SnapshotId" |
174 | query += "priceforlisting=?ListingPrice, "; | 176 | ; |
175 | query += "snapshotuuid=?SnapshotId"; | ||
176 | 177 | ||
177 | if(string.IsNullOrEmpty(ad.ParcelName)) | 178 | if(string.IsNullOrEmpty(ad.ParcelName)) |
178 | ad.ParcelName = "Unknown"; | 179 | ad.ParcelName = "Unknown"; |
@@ -228,6 +229,7 @@ namespace OpenSim.Data.MySQL | |||
228 | 229 | ||
229 | cmd.ExecuteNonQuery(); | 230 | cmd.ExecuteNonQuery(); |
230 | } | 231 | } |
232 | dbcon.Close(); | ||
231 | } | 233 | } |
232 | } | 234 | } |
233 | catch (Exception e) | 235 | catch (Exception e) |
@@ -242,10 +244,7 @@ namespace OpenSim.Data.MySQL | |||
242 | 244 | ||
243 | public bool DeleteClassifiedRecord(UUID recordId) | 245 | public bool DeleteClassifiedRecord(UUID recordId) |
244 | { | 246 | { |
245 | string query = string.Empty; | 247 | const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId"; |
246 | |||
247 | query += "DELETE FROM classifieds WHERE "; | ||
248 | query += "classifieduuid = ?recordId"; | ||
249 | 248 | ||
250 | try | 249 | try |
251 | { | 250 | { |
@@ -258,6 +257,7 @@ namespace OpenSim.Data.MySQL | |||
258 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); | 257 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); |
259 | cmd.ExecuteNonQuery(); | 258 | cmd.ExecuteNonQuery(); |
260 | } | 259 | } |
260 | dbcon.Close(); | ||
261 | } | 261 | } |
262 | } | 262 | } |
263 | catch (Exception e) | 263 | catch (Exception e) |
@@ -271,10 +271,8 @@ namespace OpenSim.Data.MySQL | |||
271 | 271 | ||
272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) | 272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) |
273 | { | 273 | { |
274 | string query = string.Empty; | ||
275 | 274 | ||
276 | query += "SELECT * FROM classifieds WHERE "; | 275 | const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId"; |
277 | query += "classifieduuid = ?AdId"; | ||
278 | 276 | ||
279 | try | 277 | try |
280 | { | 278 | { |
@@ -322,10 +320,8 @@ namespace OpenSim.Data.MySQL | |||
322 | #region Picks Queries | 320 | #region Picks Queries |
323 | public OSDArray GetAvatarPicks(UUID avatarId) | 321 | public OSDArray GetAvatarPicks(UUID avatarId) |
324 | { | 322 | { |
325 | string query = string.Empty; | 323 | const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id"; |
326 | 324 | ||
327 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; | ||
328 | query += "creatoruuid = ?Id"; | ||
329 | OSDArray data = new OSDArray(); | 325 | OSDArray data = new OSDArray(); |
330 | 326 | ||
331 | try | 327 | try |
@@ -352,6 +348,7 @@ namespace OpenSim.Data.MySQL | |||
352 | } | 348 | } |
353 | } | 349 | } |
354 | } | 350 | } |
351 | dbcon.Close(); | ||
355 | } | 352 | } |
356 | } | 353 | } |
357 | catch (Exception e) | 354 | catch (Exception e) |
@@ -364,12 +361,8 @@ namespace OpenSim.Data.MySQL | |||
364 | 361 | ||
365 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) | 362 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) |
366 | { | 363 | { |
367 | string query = string.Empty; | ||
368 | UserProfilePick pick = new UserProfilePick(); | 364 | UserProfilePick pick = new UserProfilePick(); |
369 | 365 | const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId"; | |
370 | query += "SELECT * FROM userpicks WHERE "; | ||
371 | query += "creatoruuid = ?CreatorId AND "; | ||
372 | query += "pickuuid = ?PickId"; | ||
373 | 366 | ||
374 | try | 367 | try |
375 | { | 368 | { |
@@ -422,33 +415,33 @@ namespace OpenSim.Data.MySQL | |||
422 | 415 | ||
423 | public bool UpdatePicksRecord(UserProfilePick pick) | 416 | public bool UpdatePicksRecord(UserProfilePick pick) |
424 | { | 417 | { |
425 | string query = string.Empty; | 418 | const string query = |
426 | 419 | "INSERT INTO userpicks VALUES (" | |
427 | query += "INSERT INTO userpicks VALUES ("; | 420 | + "?PickId," |
428 | query += "?PickId,"; | 421 | + "?CreatorId," |
429 | query += "?CreatorId,"; | 422 | + "?TopPick," |
430 | query += "?TopPick,"; | 423 | + "?ParcelId," |
431 | query += "?ParcelId,"; | 424 | + "?Name," |
432 | query += "?Name,"; | 425 | + "?Desc," |
433 | query += "?Desc,"; | 426 | + "?SnapshotId," |
434 | query += "?SnapshotId,"; | 427 | + "?User," |
435 | query += "?User,"; | 428 | + "?Original," |
436 | query += "?Original,"; | 429 | + "?SimName," |
437 | query += "?SimName,"; | 430 | + "?GlobalPos," |
438 | query += "?GlobalPos,"; | 431 | + "?SortOrder," |
439 | query += "?SortOrder,"; | 432 | + "?Enabled," |
440 | query += "?Enabled,"; | 433 | + "?Gatekeeper)" |
441 | query += "?Gatekeeper)"; | 434 | + "ON DUPLICATE KEY UPDATE " |
442 | query += "ON DUPLICATE KEY UPDATE "; | 435 | + "parceluuid=?ParcelId," |
443 | query += "parceluuid=?ParcelId,"; | 436 | + "name=?Name," |
444 | query += "name=?Name,"; | 437 | + "description=?Desc," |
445 | query += "description=?Desc,"; | 438 | + "user=?User," |
446 | query += "user=?User,"; | 439 | + "simname=?SimName," |
447 | query += "simname=?SimName,"; | 440 | + "snapshotuuid=?SnapshotId," |
448 | query += "snapshotuuid=?SnapshotId,"; | 441 | + "pickuuid=?PickId," |
449 | query += "pickuuid=?PickId,"; | 442 | + "posglobal=?GlobalPos," |
450 | query += "posglobal=?GlobalPos,"; | 443 | + "gatekeeper=?Gatekeeper" |
451 | query += "gatekeeper=?Gatekeeper"; | 444 | ; |
452 | 445 | ||
453 | try | 446 | try |
454 | { | 447 | { |
@@ -474,6 +467,7 @@ namespace OpenSim.Data.MySQL | |||
474 | 467 | ||
475 | cmd.ExecuteNonQuery(); | 468 | cmd.ExecuteNonQuery(); |
476 | } | 469 | } |
470 | dbcon.Close(); | ||
477 | } | 471 | } |
478 | } | 472 | } |
479 | catch (Exception e) | 473 | catch (Exception e) |
@@ -487,10 +481,7 @@ namespace OpenSim.Data.MySQL | |||
487 | 481 | ||
488 | public bool DeletePicksRecord(UUID pickId) | 482 | public bool DeletePicksRecord(UUID pickId) |
489 | { | 483 | { |
490 | string query = string.Empty; | 484 | string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId"; |
491 | |||
492 | query += "DELETE FROM userpicks WHERE "; | ||
493 | query += "pickuuid = ?PickId"; | ||
494 | 485 | ||
495 | try | 486 | try |
496 | { | 487 | { |
@@ -504,6 +495,7 @@ namespace OpenSim.Data.MySQL | |||
504 | 495 | ||
505 | cmd.ExecuteNonQuery(); | 496 | cmd.ExecuteNonQuery(); |
506 | } | 497 | } |
498 | dbcon.Close(); | ||
507 | } | 499 | } |
508 | } | 500 | } |
509 | catch (Exception e) | 501 | catch (Exception e) |
@@ -519,11 +511,7 @@ namespace OpenSim.Data.MySQL | |||
519 | #region Avatar Notes Queries | 511 | #region Avatar Notes Queries |
520 | public bool GetAvatarNotes(ref UserProfileNotes notes) | 512 | public bool GetAvatarNotes(ref UserProfileNotes notes) |
521 | { // WIP | 513 | { // WIP |
522 | string query = string.Empty; | 514 | const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId"; |
523 | |||
524 | query += "SELECT `notes` FROM usernotes WHERE "; | ||
525 | query += "useruuid = ?Id AND "; | ||
526 | query += "targetuuid = ?TargetId"; | ||
527 | 515 | ||
528 | try | 516 | try |
529 | { | 517 | { |
@@ -548,6 +536,7 @@ namespace OpenSim.Data.MySQL | |||
548 | } | 536 | } |
549 | } | 537 | } |
550 | } | 538 | } |
539 | dbcon.Close(); | ||
551 | } | 540 | } |
552 | } | 541 | } |
553 | catch (Exception e) | 542 | catch (Exception e) |
@@ -560,26 +549,25 @@ namespace OpenSim.Data.MySQL | |||
560 | 549 | ||
561 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) | 550 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) |
562 | { | 551 | { |
563 | string query = string.Empty; | 552 | string query; |
564 | bool remove; | 553 | bool remove; |
565 | 554 | ||
566 | if(string.IsNullOrEmpty(note.Notes)) | 555 | if(string.IsNullOrEmpty(note.Notes)) |
567 | { | 556 | { |
568 | remove = true; | 557 | remove = true; |
569 | query += "DELETE FROM usernotes WHERE "; | 558 | query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId"; |
570 | query += "useruuid=?UserId AND "; | ||
571 | query += "targetuuid=?TargetId"; | ||
572 | } | 559 | } |
573 | else | 560 | else |
574 | { | 561 | { |
575 | remove = false; | 562 | remove = false; |
576 | query += "INSERT INTO usernotes VALUES ( "; | 563 | query = "INSERT INTO usernotes VALUES (" |
577 | query += "?UserId,"; | 564 | + "?UserId," |
578 | query += "?TargetId,"; | 565 | + "?TargetId," |
579 | query += "?Notes )"; | 566 | + "?Notes )" |
580 | query += "ON DUPLICATE KEY "; | 567 | + "ON DUPLICATE KEY " |
581 | query += "UPDATE "; | 568 | + "UPDATE " |
582 | query += "notes=?Notes"; | 569 | + "notes=?Notes" |
570 | ; | ||
583 | } | 571 | } |
584 | 572 | ||
585 | try | 573 | try |
@@ -596,6 +584,7 @@ namespace OpenSim.Data.MySQL | |||
596 | 584 | ||
597 | cmd.ExecuteNonQuery(); | 585 | cmd.ExecuteNonQuery(); |
598 | } | 586 | } |
587 | dbcon.Close(); | ||
599 | } | 588 | } |
600 | } | 589 | } |
601 | catch (Exception e) | 590 | catch (Exception e) |
@@ -612,10 +601,7 @@ namespace OpenSim.Data.MySQL | |||
612 | #region Avatar Properties | 601 | #region Avatar Properties |
613 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) | 602 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) |
614 | { | 603 | { |
615 | string query = string.Empty; | 604 | string query = "SELECT * FROM userprofile WHERE useruuid = ?Id"; |
616 | |||
617 | query += "SELECT * FROM userprofile WHERE "; | ||
618 | query += "useruuid = ?Id"; | ||
619 | 605 | ||
620 | try | 606 | try |
621 | { | 607 | { |
@@ -664,35 +650,36 @@ namespace OpenSim.Data.MySQL | |||
664 | props.PublishProfile = false; | 650 | props.PublishProfile = false; |
665 | props.PublishMature = false; | 651 | props.PublishMature = false; |
666 | 652 | ||
667 | query = "INSERT INTO userprofile ("; | 653 | query = "INSERT INTO userprofile (" |
668 | query += "useruuid, "; | 654 | + "useruuid, " |
669 | query += "profilePartner, "; | 655 | + "profilePartner, " |
670 | query += "profileAllowPublish, "; | 656 | + "profileAllowPublish, " |
671 | query += "profileMaturePublish, "; | 657 | + "profileMaturePublish, " |
672 | query += "profileURL, "; | 658 | + "profileURL, " |
673 | query += "profileWantToMask, "; | 659 | + "profileWantToMask, " |
674 | query += "profileWantToText, "; | 660 | + "profileWantToText, " |
675 | query += "profileSkillsMask, "; | 661 | + "profileSkillsMask, " |
676 | query += "profileSkillsText, "; | 662 | + "profileSkillsText, " |
677 | query += "profileLanguages, "; | 663 | + "profileLanguages, " |
678 | query += "profileImage, "; | 664 | + "profileImage, " |
679 | query += "profileAboutText, "; | 665 | + "profileAboutText, " |
680 | query += "profileFirstImage, "; | 666 | + "profileFirstImage, " |
681 | query += "profileFirstText) VALUES ("; | 667 | + "profileFirstText) VALUES (" |
682 | query += "?userId, "; | 668 | + "?userId, " |
683 | query += "?profilePartner, "; | 669 | + "?profilePartner, " |
684 | query += "?profileAllowPublish, "; | 670 | + "?profileAllowPublish, " |
685 | query += "?profileMaturePublish, "; | 671 | + "?profileMaturePublish, " |
686 | query += "?profileURL, "; | 672 | + "?profileURL, " |
687 | query += "?profileWantToMask, "; | 673 | + "?profileWantToMask, " |
688 | query += "?profileWantToText, "; | 674 | + "?profileWantToText, " |
689 | query += "?profileSkillsMask, "; | 675 | + "?profileSkillsMask, " |
690 | query += "?profileSkillsText, "; | 676 | + "?profileSkillsText, " |
691 | query += "?profileLanguages, "; | 677 | + "?profileLanguages, " |
692 | query += "?profileImage, "; | 678 | + "?profileImage, " |
693 | query += "?profileAboutText, "; | 679 | + "?profileAboutText, " |
694 | query += "?profileFirstImage, "; | 680 | + "?profileFirstImage, " |
695 | query += "?profileFirstText)"; | 681 | + "?profileFirstText)" |
682 | ; | ||
696 | 683 | ||
697 | dbcon.Close(); | 684 | dbcon.Close(); |
698 | dbcon.Open(); | 685 | dbcon.Open(); |
@@ -719,6 +706,7 @@ namespace OpenSim.Data.MySQL | |||
719 | } | 706 | } |
720 | } | 707 | } |
721 | } | 708 | } |
709 | dbcon.Close(); | ||
722 | } | 710 | } |
723 | } | 711 | } |
724 | catch (Exception e) | 712 | catch (Exception e) |
@@ -733,15 +721,10 @@ namespace OpenSim.Data.MySQL | |||
733 | 721 | ||
734 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) | 722 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) |
735 | { | 723 | { |
736 | string query = string.Empty; | 724 | const string query = "UPDATE userprofile SET profileURL=?profileURL," |
737 | 725 | + "profileImage=?image, profileAboutText=?abouttext," | |
738 | query += "UPDATE userprofile SET "; | 726 | + "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext " |
739 | query += "profileURL=?profileURL, "; | 727 | + "WHERE useruuid=?uuid"; |
740 | query += "profileImage=?image, "; | ||
741 | query += "profileAboutText=?abouttext,"; | ||
742 | query += "profileFirstImage=?firstlifeimage,"; | ||
743 | query += "profileFirstText=?firstlifetext "; | ||
744 | query += "WHERE useruuid=?uuid"; | ||
745 | 728 | ||
746 | try | 729 | try |
747 | { | 730 | { |
@@ -759,6 +742,7 @@ namespace OpenSim.Data.MySQL | |||
759 | 742 | ||
760 | cmd.ExecuteNonQuery(); | 743 | cmd.ExecuteNonQuery(); |
761 | } | 744 | } |
745 | dbcon.Close(); | ||
762 | } | 746 | } |
763 | } | 747 | } |
764 | catch (Exception e) | 748 | catch (Exception e) |
@@ -775,15 +759,13 @@ namespace OpenSim.Data.MySQL | |||
775 | #region Avatar Interests | 759 | #region Avatar Interests |
776 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) | 760 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) |
777 | { | 761 | { |
778 | string query = string.Empty; | 762 | const string query = "UPDATE userprofile SET " |
779 | 763 | + "profileWantToMask=?WantMask, " | |
780 | query += "UPDATE userprofile SET "; | 764 | + "profileWantToText=?WantText," |
781 | query += "profileWantToMask=?WantMask, "; | 765 | + "profileSkillsMask=?SkillsMask," |
782 | query += "profileWantToText=?WantText,"; | 766 | + "profileSkillsText=?SkillsText, " |
783 | query += "profileSkillsMask=?SkillsMask,"; | 767 | + "profileLanguages=?Languages " |
784 | query += "profileSkillsText=?SkillsText, "; | 768 | + "WHERE useruuid=?uuid"; |
785 | query += "profileLanguages=?Languages "; | ||
786 | query += "WHERE useruuid=?uuid"; | ||
787 | 769 | ||
788 | try | 770 | try |
789 | { | 771 | { |
@@ -817,18 +799,17 @@ namespace OpenSim.Data.MySQL | |||
817 | public OSDArray GetUserImageAssets(UUID avatarId) | 799 | public OSDArray GetUserImageAssets(UUID avatarId) |
818 | { | 800 | { |
819 | OSDArray data = new OSDArray(); | 801 | OSDArray data = new OSDArray(); |
820 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; | 802 | const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; |
821 | 803 | ||
822 | // Get classified image assets | 804 | // Get classified image assets |
823 | 805 | ||
824 | |||
825 | try | 806 | try |
826 | { | 807 | { |
827 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 808 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
828 | { | 809 | { |
829 | dbcon.Open(); | 810 | dbcon.Open(); |
830 | 811 | ||
831 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) | 812 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon)) |
832 | { | 813 | { |
833 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 814 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
834 | 815 | ||
@@ -847,7 +828,7 @@ namespace OpenSim.Data.MySQL | |||
847 | dbcon.Close(); | 828 | dbcon.Close(); |
848 | dbcon.Open(); | 829 | dbcon.Open(); |
849 | 830 | ||
850 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 831 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon)) |
851 | { | 832 | { |
852 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 833 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
853 | 834 | ||
@@ -866,9 +847,9 @@ namespace OpenSim.Data.MySQL | |||
866 | dbcon.Close(); | 847 | dbcon.Close(); |
867 | dbcon.Open(); | 848 | dbcon.Open(); |
868 | 849 | ||
869 | query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; | 850 | const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; |
870 | 851 | ||
871 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 852 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryB,"`userpicks`"), dbcon)) |
872 | { | 853 | { |
873 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 854 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
874 | 855 | ||
@@ -884,6 +865,7 @@ namespace OpenSim.Data.MySQL | |||
884 | } | 865 | } |
885 | } | 866 | } |
886 | } | 867 | } |
868 | dbcon.Close(); | ||
887 | } | 869 | } |
888 | } | 870 | } |
889 | catch (Exception e) | 871 | catch (Exception e) |
@@ -897,11 +879,7 @@ namespace OpenSim.Data.MySQL | |||
897 | #region User Preferences | 879 | #region User Preferences |
898 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 880 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) |
899 | { | 881 | { |
900 | string query = string.Empty; | 882 | const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id"; |
901 | |||
902 | query += "SELECT imviaemail,visible,email FROM "; | ||
903 | query += "usersettings WHERE "; | ||
904 | query += "useruuid = ?Id"; | ||
905 | 883 | ||
906 | try | 884 | try |
907 | { | 885 | { |
@@ -925,10 +903,9 @@ namespace OpenSim.Data.MySQL | |||
925 | dbcon.Close(); | 903 | dbcon.Close(); |
926 | dbcon.Open(); | 904 | dbcon.Open(); |
927 | 905 | ||
928 | query = "INSERT INTO usersettings VALUES "; | 906 | const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)"; |
929 | query += "(?uuid,'false','false', ?Email)"; | ||
930 | 907 | ||
931 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 908 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) |
932 | { | 909 | { |
933 | 910 | ||
934 | put.Parameters.AddWithValue("?Email", pref.EMail); | 911 | put.Parameters.AddWithValue("?Email", pref.EMail); |
@@ -939,6 +916,7 @@ namespace OpenSim.Data.MySQL | |||
939 | } | 916 | } |
940 | } | 917 | } |
941 | } | 918 | } |
919 | dbcon.Close(); | ||
942 | } | 920 | } |
943 | } | 921 | } |
944 | catch (Exception e) | 922 | catch (Exception e) |
@@ -953,13 +931,9 @@ namespace OpenSim.Data.MySQL | |||
953 | 931 | ||
954 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | 932 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) |
955 | { | 933 | { |
956 | string query = string.Empty; | 934 | const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail," |
957 | 935 | + "visible=?Visible, email=?EMail " | |
958 | query += "UPDATE usersettings SET "; | 936 | + "WHERE useruuid=?uuid"; |
959 | query += "imviaemail=?ImViaEmail, "; | ||
960 | query += "visible=?Visible, "; | ||
961 | query += "email=?EMail "; | ||
962 | query += "WHERE useruuid=?uuid"; | ||
963 | 937 | ||
964 | try | 938 | try |
965 | { | 939 | { |
@@ -975,6 +949,7 @@ namespace OpenSim.Data.MySQL | |||
975 | 949 | ||
976 | cmd.ExecuteNonQuery(); | 950 | cmd.ExecuteNonQuery(); |
977 | } | 951 | } |
952 | dbcon.Close(); | ||
978 | } | 953 | } |
979 | } | 954 | } |
980 | catch (Exception e) | 955 | catch (Exception e) |
@@ -991,11 +966,7 @@ namespace OpenSim.Data.MySQL | |||
991 | #region Integration | 966 | #region Integration |
992 | public bool GetUserAppData(ref UserAppData props, ref string result) | 967 | public bool GetUserAppData(ref UserAppData props, ref string result) |
993 | { | 968 | { |
994 | string query = string.Empty; | 969 | const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId"; |
995 | |||
996 | query += "SELECT * FROM `userdata` WHERE "; | ||
997 | query += "UserId = ?Id AND "; | ||
998 | query += "TagId = ?TagId"; | ||
999 | 970 | ||
1000 | try | 971 | try |
1001 | { | 972 | { |
@@ -1017,13 +988,8 @@ namespace OpenSim.Data.MySQL | |||
1017 | } | 988 | } |
1018 | else | 989 | else |
1019 | { | 990 | { |
1020 | query += "INSERT INTO userdata VALUES ( "; | 991 | const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)"; |
1021 | query += "?UserId,"; | 992 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) |
1022 | query += "?TagId,"; | ||
1023 | query += "?DataKey,"; | ||
1024 | query += "?DataVal) "; | ||
1025 | |||
1026 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | ||
1027 | { | 993 | { |
1028 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); | 994 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); |
1029 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); | 995 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); |
@@ -1035,6 +1001,7 @@ namespace OpenSim.Data.MySQL | |||
1035 | } | 1001 | } |
1036 | } | 1002 | } |
1037 | } | 1003 | } |
1004 | dbcon.Close(); | ||
1038 | } | 1005 | } |
1039 | } | 1006 | } |
1040 | catch (Exception e) | 1007 | catch (Exception e) |
@@ -1049,14 +1016,7 @@ namespace OpenSim.Data.MySQL | |||
1049 | 1016 | ||
1050 | public bool SetUserAppData(UserAppData props, ref string result) | 1017 | public bool SetUserAppData(UserAppData props, ref string result) |
1051 | { | 1018 | { |
1052 | string query = string.Empty; | 1019 | const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId"; |
1053 | |||
1054 | query += "UPDATE userdata SET "; | ||
1055 | query += "TagId = ?TagId, "; | ||
1056 | query += "DataKey = ?DataKey, "; | ||
1057 | query += "DataVal = ?DataVal WHERE "; | ||
1058 | query += "UserId = ?UserId AND "; | ||
1059 | query += "TagId = ?TagId"; | ||
1060 | 1020 | ||
1061 | try | 1021 | try |
1062 | { | 1022 | { |
@@ -1072,6 +1032,7 @@ namespace OpenSim.Data.MySQL | |||
1072 | 1032 | ||
1073 | cmd.ExecuteNonQuery(); | 1033 | cmd.ExecuteNonQuery(); |
1074 | } | 1034 | } |
1035 | dbcon.Close(); | ||
1075 | } | 1036 | } |
1076 | } | 1037 | } |
1077 | catch (Exception e) | 1038 | catch (Exception e) |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 2c6acde..9f9c9cf 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -97,6 +97,7 @@ namespace OpenSim.Data.MySQL | |||
97 | dbcon.Open(); | 97 | dbcon.Open(); |
98 | Migration m = new Migration(dbcon, Assembly, "XAssetStore"); | 98 | Migration m = new Migration(dbcon, Assembly, "XAssetStore"); |
99 | m.Update(); | 99 | m.Update(); |
100 | dbcon.Close(); | ||
100 | } | 101 | } |
101 | } | 102 | } |
102 | 103 | ||
@@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL | |||
130 | // m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID); | 131 | // m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID); |
131 | 132 | ||
132 | AssetBase asset = null; | 133 | AssetBase asset = null; |
134 | int accessTime = 0; | ||
133 | 135 | ||
134 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 136 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
135 | { | 137 | { |
@@ -140,7 +142,6 @@ namespace OpenSim.Data.MySQL | |||
140 | dbcon)) | 142 | dbcon)) |
141 | { | 143 | { |
142 | cmd.Parameters.AddWithValue("?ID", assetID.ToString()); | 144 | cmd.Parameters.AddWithValue("?ID", assetID.ToString()); |
143 | |||
144 | try | 145 | try |
145 | { | 146 | { |
146 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 147 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
@@ -159,23 +160,7 @@ namespace OpenSim.Data.MySQL | |||
159 | 160 | ||
160 | asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]); | 161 | asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]); |
161 | asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); | 162 | asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); |
162 | 163 | accessTime = (int)dbReader["AccessTime"]; | |
163 | if (m_enableCompression) | ||
164 | { | ||
165 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) | ||
166 | { | ||
167 | MemoryStream outputStream = new MemoryStream(); | ||
168 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); | ||
169 | // int compressedLength = asset.Data.Length; | ||
170 | asset.Data = outputStream.ToArray(); | ||
171 | |||
172 | // m_log.DebugFormat( | ||
173 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", | ||
174 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]); | ||
179 | } | 164 | } |
180 | } | 165 | } |
181 | } | 166 | } |
@@ -184,9 +169,38 @@ namespace OpenSim.Data.MySQL | |||
184 | m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e); | 169 | m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e); |
185 | } | 170 | } |
186 | } | 171 | } |
172 | dbcon.Close(); | ||
187 | } | 173 | } |
188 | 174 | ||
189 | return asset; | 175 | if(asset == null) |
176 | return asset; | ||
177 | |||
178 | if(accessTime > 0) | ||
179 | { | ||
180 | try | ||
181 | { | ||
182 | UpdateAccessTime(asset.Metadata, accessTime); | ||
183 | } | ||
184 | catch { } | ||
185 | } | ||
186 | |||
187 | if (m_enableCompression && asset.Data != null) | ||
188 | { | ||
189 | using(MemoryStream ms = new MemoryStream(asset.Data)) | ||
190 | using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress)) | ||
191 | { | ||
192 | using(MemoryStream outputStream = new MemoryStream()) | ||
193 | { | ||
194 | decompressionStream.CopyTo(outputStream, int.MaxValue); | ||
195 | // int compressedLength = asset.Data.Length; | ||
196 | asset.Data = outputStream.ToArray(); | ||
197 | } | ||
198 | // m_log.DebugFormat( | ||
199 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", | ||
200 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | ||
201 | } | ||
202 | } | ||
203 | return asset; | ||
190 | } | 204 | } |
191 | 205 | ||
192 | /// <summary> | 206 | /// <summary> |
@@ -303,6 +317,7 @@ namespace OpenSim.Data.MySQL | |||
303 | 317 | ||
304 | transaction.Commit(); | 318 | transaction.Commit(); |
305 | } | 319 | } |
320 | dbcon.Close(); | ||
306 | } | 321 | } |
307 | } | 322 | } |
308 | 323 | ||
@@ -344,6 +359,7 @@ namespace OpenSim.Data.MySQL | |||
344 | "[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}", | 359 | "[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}", |
345 | assetMetadata.ID, assetMetadata.Name); | 360 | assetMetadata.ID, assetMetadata.Name); |
346 | } | 361 | } |
362 | dbcon.Close(); | ||
347 | } | 363 | } |
348 | } | 364 | } |
349 | 365 | ||
@@ -474,6 +490,7 @@ namespace OpenSim.Data.MySQL | |||
474 | m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); | 490 | m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); |
475 | } | 491 | } |
476 | } | 492 | } |
493 | dbcon.Close(); | ||
477 | } | 494 | } |
478 | 495 | ||
479 | return retList; | 496 | return retList; |
@@ -492,9 +509,9 @@ namespace OpenSim.Data.MySQL | |||
492 | cmd.Parameters.AddWithValue("?ID", id); | 509 | cmd.Parameters.AddWithValue("?ID", id); |
493 | cmd.ExecuteNonQuery(); | 510 | cmd.ExecuteNonQuery(); |
494 | } | 511 | } |
495 | |||
496 | // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we | 512 | // TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we |
497 | // keep a reference count (?) | 513 | // keep a reference count (?) |
514 | dbcon.Close(); | ||
498 | } | 515 | } |
499 | 516 | ||
500 | return true; | 517 | return true; |
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 4e41fec..5019994 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -328,7 +328,6 @@ namespace OpenSim.Data.MySQL | |||
328 | { | 328 | { |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | cmd.Dispose(); | ||
332 | } | 331 | } |
333 | 332 | ||
334 | dbcon.Close(); | 333 | dbcon.Close(); |
diff --git a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations index 1a49900..6ec8914 100644 --- a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations +++ b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations | |||
@@ -18,7 +18,7 @@ CREATE TABLE `os_groups_groups` ( | |||
18 | PRIMARY KEY (`GroupID`), | 18 | PRIMARY KEY (`GroupID`), |
19 | UNIQUE KEY `Name` (`Name`), | 19 | UNIQUE KEY `Name` (`Name`), |
20 | FULLTEXT KEY `Name_2` (`Name`) | 20 | FULLTEXT KEY `Name_2` (`Name`) |
21 | ) ENGINE=InnoDB; | 21 | ) ENGINE=MyISAM; |
22 | 22 | ||
23 | 23 | ||
24 | CREATE TABLE `os_groups_membership` ( | 24 | CREATE TABLE `os_groups_membership` ( |
diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs index 6e88489..1798d20 100644 --- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs | |||
@@ -173,16 +173,18 @@ namespace OpenSim.Data.PGSQL | |||
173 | 173 | ||
174 | if (m_enableCompression) | 174 | if (m_enableCompression) |
175 | { | 175 | { |
176 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) | 176 | using(MemoryStream ms = new MemoryStream(asset.Data)) |
177 | using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress)) | ||
177 | { | 178 | { |
178 | MemoryStream outputStream = new MemoryStream(); | 179 | using(MemoryStream outputStream = new MemoryStream()) |
179 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); | 180 | { |
180 | // int compressedLength = asset.Data.Length; | 181 | decompressionStream.CopyTo(outputStream,int.MaxValue); |
181 | asset.Data = outputStream.ToArray(); | 182 | // int compressedLength = asset.Data.Length; |
182 | 183 | asset.Data = outputStream.ToArray(); | |
183 | // m_log.DebugFormat( | 184 | } |
184 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", | 185 | // m_log.DebugFormat( |
185 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | 186 | // "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}", |
187 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | ||
186 | } | 188 | } |
187 | } | 189 | } |
188 | 190 | ||