diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
44 files changed, 2301 insertions, 2507 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs index ed0ab98..17f1374 100644 --- a/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs +++ b/OpenSim/Data/MySQL/MySQLAgentPreferencesData.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 5d8da17..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; |
@@ -154,65 +156,62 @@ namespace OpenSim.Data.MySQL | |||
154 | /// </summary> | 156 | /// </summary> |
155 | /// <param name="asset">Asset UUID to create</param> | 157 | /// <param name="asset">Asset UUID to create</param> |
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 void StoreAsset(AssetBase asset) | 159 | override public bool StoreAsset(AssetBase asset) |
158 | { | 160 | { |
161 | string assetName = asset.Name; | ||
162 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | ||
163 | { | ||
164 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | ||
165 | m_log.WarnFormat( | ||
166 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
167 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
168 | } | ||
169 | |||
170 | string assetDescription = asset.Description; | ||
171 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | ||
172 | { | ||
173 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | ||
174 | m_log.WarnFormat( | ||
175 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
176 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
177 | } | ||
178 | |||
159 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 179 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
160 | { | 180 | { |
161 | dbcon.Open(); | 181 | dbcon.Open(); |
162 | |||
163 | using (MySqlCommand cmd = | 182 | using (MySqlCommand cmd = |
164 | new MySqlCommand( | 183 | new MySqlCommand( |
165 | "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)" + |
166 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", | 185 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", |
167 | dbcon)) | 186 | dbcon)) |
168 | { | 187 | { |
169 | string assetName = asset.Name; | ||
170 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | ||
171 | { | ||
172 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | ||
173 | m_log.WarnFormat( | ||
174 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
175 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
176 | } | ||
177 | |||
178 | string assetDescription = asset.Description; | ||
179 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | ||
180 | { | ||
181 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | ||
182 | m_log.WarnFormat( | ||
183 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
184 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
185 | } | ||
186 | |||
187 | try | 188 | try |
188 | { | 189 | { |
189 | using (cmd) | 190 | // create unix epoch time |
190 | { | 191 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); |
191 | // create unix epoch time | 192 | cmd.Parameters.AddWithValue("?id", asset.ID); |
192 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 193 | cmd.Parameters.AddWithValue("?name", assetName); |
193 | cmd.Parameters.AddWithValue("?id", asset.ID); | 194 | cmd.Parameters.AddWithValue("?description", assetDescription); |
194 | cmd.Parameters.AddWithValue("?name", assetName); | 195 | cmd.Parameters.AddWithValue("?assetType", asset.Type); |
195 | cmd.Parameters.AddWithValue("?description", assetDescription); | 196 | cmd.Parameters.AddWithValue("?local", asset.Local); |
196 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | 197 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); |
197 | cmd.Parameters.AddWithValue("?local", asset.Local); | 198 | cmd.Parameters.AddWithValue("?create_time", now); |
198 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 199 | cmd.Parameters.AddWithValue("?access_time", now); |
199 | cmd.Parameters.AddWithValue("?create_time", now); | 200 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); |
200 | cmd.Parameters.AddWithValue("?access_time", now); | 201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
201 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); | 202 | cmd.Parameters.AddWithValue("?data", asset.Data); |
202 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 203 | cmd.ExecuteNonQuery(); |
203 | cmd.Parameters.AddWithValue("?data", asset.Data); | 204 | dbcon.Close(); |
204 | cmd.ExecuteNonQuery(); | 205 | return true; |
205 | } | ||
206 | } | 206 | } |
207 | catch (Exception e) | 207 | catch (Exception e) |
208 | { | 208 | { |
209 | m_log.Error( | 209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
210 | string.Format( | 210 | asset.FullID, asset.Name, e.Message); |
211 | "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", | 211 | dbcon.Close(); |
212 | asset.FullID, asset.Name) | 212 | return false; |
213 | , e); | ||
214 | } | 213 | } |
215 | } | 214 | } |
216 | } | 215 | } |
217 | } | 216 | } |
218 | 217 | ||
@@ -227,24 +226,22 @@ namespace OpenSim.Data.MySQL | |||
227 | { | 226 | { |
228 | try | 227 | try |
229 | { | 228 | { |
230 | using (cmd) | 229 | // create unix epoch time |
231 | { | 230 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); |
232 | // create unix epoch time | 231 | cmd.Parameters.AddWithValue("?id", asset.ID); |
233 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 232 | cmd.Parameters.AddWithValue("?access_time", now); |
234 | cmd.Parameters.AddWithValue("?id", asset.ID); | 233 | cmd.ExecuteNonQuery(); |
235 | cmd.Parameters.AddWithValue("?access_time", now); | ||
236 | cmd.ExecuteNonQuery(); | ||
237 | } | ||
238 | } | 234 | } |
239 | catch (Exception e) | 235 | catch (Exception e) |
240 | { | 236 | { |
241 | m_log.Error( | 237 | m_log.Error( |
242 | string.Format( | 238 | string.Format( |
243 | "[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ", | 239 | "[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ", |
244 | asset.FullID, asset.Name), | 240 | asset.FullID, asset.Name), |
245 | e); | 241 | e); |
246 | } | 242 | } |
247 | } | 243 | } |
244 | dbcon.Close(); | ||
248 | } | 245 | } |
249 | } | 246 | } |
250 | 247 | ||
@@ -277,6 +274,7 @@ namespace OpenSim.Data.MySQL | |||
277 | } | 274 | } |
278 | } | 275 | } |
279 | } | 276 | } |
277 | dbcon.Close(); | ||
280 | } | 278 | } |
281 | 279 | ||
282 | bool[] results = new bool[uuids.Length]; | 280 | bool[] results = new bool[uuids.Length]; |
@@ -336,11 +334,12 @@ namespace OpenSim.Data.MySQL | |||
336 | { | 334 | { |
337 | m_log.Error( | 335 | m_log.Error( |
338 | string.Format( | 336 | string.Format( |
339 | "[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ", | 337 | "[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ", |
340 | start, count), | 338 | start, count), |
341 | e); | 339 | e); |
342 | } | 340 | } |
343 | } | 341 | } |
342 | dbcon.Close(); | ||
344 | } | 343 | } |
345 | 344 | ||
346 | return retList; | 345 | return retList; |
@@ -357,6 +356,7 @@ namespace OpenSim.Data.MySQL | |||
357 | cmd.Parameters.AddWithValue("?id", id); | 356 | cmd.Parameters.AddWithValue("?id", id); |
358 | cmd.ExecuteNonQuery(); | 357 | cmd.ExecuteNonQuery(); |
359 | } | 358 | } |
359 | dbcon.Close(); | ||
360 | } | 360 | } |
361 | 361 | ||
362 | return true; | 362 | return true; |
@@ -364,4 +364,4 @@ namespace OpenSim.Data.MySQL | |||
364 | 364 | ||
365 | #endregion | 365 | #endregion |
366 | } | 366 | } |
367 | } \ No newline at end of file | 367 | } |
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 7627497..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()) |
84 | |||
85 | CheckColumnNames(result); | ||
86 | |||
87 | foreach (string s in m_ColumnNames) | ||
88 | { | 83 | { |
89 | if (s == "UUID") | 84 | ret.PrincipalID = principalID; |
90 | continue; | 85 | |
91 | 86 | CheckColumnNames(result); | |
92 | ret.Data[s] = result[s].ToString(); | 87 | |
88 | foreach(string s in m_ColumnNames) | ||
89 | { | ||
90 | if(s == "UUID") | ||
91 | continue; | ||
92 | |||
93 | ret.Data[s] = result[s].ToString(); | ||
94 | } | ||
95 | |||
96 | dbcon.Close(); | ||
97 | return ret; | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | dbcon.Close(); | ||
102 | return null; | ||
93 | } | 103 | } |
94 | |||
95 | return ret; | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | return null; | ||
100 | } | 104 | } |
101 | } | 105 | } |
102 | } | 106 | } |
@@ -132,25 +136,25 @@ namespace OpenSim.Data.MySQL | |||
132 | if (!first) | 136 | if (!first) |
133 | update += ", "; | 137 | update += ", "; |
134 | update += "`" + field + "` = ?"+field; | 138 | update += "`" + field + "` = ?"+field; |
135 | 139 | ||
136 | first = false; | 140 | first = false; |
137 | 141 | ||
138 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 142 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
139 | } | 143 | } |
140 | 144 | ||
141 | update += " where UUID = ?principalID"; | 145 | update += " where UUID = ?principalID"; |
142 | 146 | ||
143 | cmd.CommandText = update; | 147 | cmd.CommandText = update; |
144 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); | 148 | cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString()); |
145 | 149 | ||
146 | if (ExecuteNonQuery(cmd) < 1) | 150 | if (ExecuteNonQuery(cmd) < 1) |
147 | { | 151 | { |
148 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | 152 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + |
149 | String.Join("`, `", fields) + | 153 | String.Join("`, `", fields) + |
150 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; | 154 | "`) values (?principalID, ?" + String.Join(", ?", fields) + ")"; |
151 | 155 | ||
152 | cmd.CommandText = insert; | 156 | cmd.CommandText = insert; |
153 | 157 | ||
154 | if (ExecuteNonQuery(cmd) < 1) | 158 | if (ExecuteNonQuery(cmd) < 1) |
155 | return false; | 159 | return false; |
156 | } | 160 | } |
@@ -166,7 +170,7 @@ namespace OpenSim.Data.MySQL | |||
166 | { | 170 | { |
167 | cmd.Parameters.AddWithValue("?"+item, value); | 171 | cmd.Parameters.AddWithValue("?"+item, value); |
168 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); | 172 | cmd.Parameters.AddWithValue("?UUID", principalID.ToString()); |
169 | 173 | ||
170 | if (ExecuteNonQuery(cmd) > 0) | 174 | if (ExecuteNonQuery(cmd) > 0) |
171 | return true; | 175 | return true; |
172 | } | 176 | } |
@@ -186,7 +190,7 @@ namespace OpenSim.Data.MySQL | |||
186 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 190 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
187 | cmd.Parameters.AddWithValue("?token", token); | 191 | cmd.Parameters.AddWithValue("?token", token); |
188 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); | 192 | cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString()); |
189 | 193 | ||
190 | if (ExecuteNonQuery(cmd) > 0) | 194 | if (ExecuteNonQuery(cmd) > 0) |
191 | return true; | 195 | return true; |
192 | } | 196 | } |
diff --git a/OpenSim/Data/MySQL/MySQLAvatarData.cs b/OpenSim/Data/MySQL/MySQLAvatarData.cs index 6a2f5d8..63e8020 100644 --- a/OpenSim/Data/MySQL/MySQLAvatarData.cs +++ b/OpenSim/Data/MySQL/MySQLAvatarData.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Data.MySQL | |||
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm); | 57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm); |
58 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 58 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
59 | cmd.Parameters.AddWithValue("?Name", name); | 59 | cmd.Parameters.AddWithValue("?Name", name); |
60 | 60 | ||
61 | if (ExecuteNonQuery(cmd) > 0) | 61 | if (ExecuteNonQuery(cmd) > 0) |
62 | return true; | 62 | return true; |
63 | } | 63 | } |
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index fe1487b..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(); |
@@ -403,19 +411,19 @@ namespace OpenSim.Data.MySQL | |||
403 | return e; | 411 | return e; |
404 | } | 412 | } |
405 | } | 413 | } |
406 | 414 | ||
407 | public List<EstateSettings> LoadEstateSettingsAll() | 415 | public List<EstateSettings> LoadEstateSettingsAll() |
408 | { | 416 | { |
409 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); | 417 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); |
410 | 418 | ||
411 | List<int> allEstateIds = GetEstatesAll(); | 419 | List<int> allEstateIds = GetEstatesAll(); |
412 | 420 | ||
413 | foreach (int estateId in allEstateIds) | 421 | foreach (int estateId in allEstateIds) |
414 | allEstateSettings.Add(LoadEstateSettings(estateId)); | 422 | allEstateSettings.Add(LoadEstateSettings(estateId)); |
415 | 423 | ||
416 | return allEstateSettings; | 424 | return allEstateSettings; |
417 | } | 425 | } |
418 | 426 | ||
419 | public List<int> GetEstatesAll() | 427 | public List<int> GetEstatesAll() |
420 | { | 428 | { |
421 | List<int> result = new List<int>(); | 429 | List<int> result = new List<int>(); |
@@ -437,11 +445,10 @@ 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 | ||
444 | return result; | 451 | return result; |
445 | } | 452 | } |
446 | 453 | ||
447 | public List<int> GetEstates(string search) | 454 | public List<int> GetEstates(string search) |
@@ -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 19e23b5..6c48607 100644 --- a/OpenSim/Data/MySQL/MySQLFSAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLFSAssetData.cs | |||
@@ -41,10 +41,8 @@ namespace OpenSim.Data.MySQL | |||
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | protected MySqlConnection m_Connection = null; | ||
45 | protected string m_ConnectionString; | 44 | protected string m_ConnectionString; |
46 | protected string m_Table; | 45 | protected string m_Table; |
47 | protected Object m_connLock = new Object(); | ||
48 | 46 | ||
49 | /// <summary> | 47 | /// <summary> |
50 | /// Number of days that must pass before we update the access time on an asset when it has been fetched | 48 | /// Number of days that must pass before we update the access time on an asset when it has been fetched |
@@ -56,7 +54,7 @@ namespace OpenSim.Data.MySQL | |||
56 | { | 54 | { |
57 | get { return GetType().Assembly; } | 55 | get { return GetType().Assembly; } |
58 | } | 56 | } |
59 | 57 | ||
60 | public MySQLFSAssetData() | 58 | public MySQLFSAssetData() |
61 | { | 59 | { |
62 | } | 60 | } |
@@ -75,10 +73,13 @@ namespace OpenSim.Data.MySQL | |||
75 | 73 | ||
76 | try | 74 | try |
77 | { | 75 | { |
78 | OpenDatabase(); | 76 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
79 | 77 | { | |
80 | Migration m = new Migration(m_Connection, Assembly, "FSAssetStore"); | 78 | conn.Open(); |
81 | m.Update(); | 79 | Migration m = new Migration(conn, Assembly, "FSAssetStore"); |
80 | m.Update(); | ||
81 | conn.Close(); | ||
82 | } | ||
82 | } | 83 | } |
83 | catch (MySqlException e) | 84 | catch (MySqlException e) |
84 | { | 85 | { |
@@ -100,70 +101,37 @@ namespace OpenSim.Data.MySQL | |||
100 | 101 | ||
101 | #endregion | 102 | #endregion |
102 | 103 | ||
103 | private bool OpenDatabase() | 104 | private bool ExecuteNonQuery(MySqlCommand cmd) |
104 | { | 105 | { |
105 | try | 106 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
106 | { | ||
107 | m_Connection = new MySqlConnection(m_ConnectionString); | ||
108 | |||
109 | m_Connection.Open(); | ||
110 | } | ||
111 | catch (MySqlException e) | ||
112 | { | 107 | { |
113 | m_log.ErrorFormat("[FSASSETS]: Can't connect to database: {0}", | 108 | try |
114 | e.Message.ToString()); | ||
115 | |||
116 | return false; | ||
117 | } | ||
118 | |||
119 | return true; | ||
120 | } | ||
121 | |||
122 | private IDataReader ExecuteReader(MySqlCommand c) | ||
123 | { | ||
124 | IDataReader r = null; | ||
125 | MySqlConnection connection = (MySqlConnection) ((ICloneable)m_Connection).Clone(); | ||
126 | connection.Open(); | ||
127 | c.Connection = connection; | ||
128 | |||
129 | r = c.ExecuteReader(); | ||
130 | |||
131 | return r; | ||
132 | } | ||
133 | |||
134 | private void ExecuteNonQuery(MySqlCommand c) | ||
135 | { | ||
136 | lock (m_connLock) | ||
137 | { | ||
138 | bool errorSeen = false; | ||
139 | |||
140 | while (true) | ||
141 | { | 109 | { |
142 | try | 110 | conn.Open(); |
143 | { | 111 | } |
144 | c.ExecuteNonQuery(); | 112 | catch (MySqlException e) |
145 | } | 113 | { |
146 | catch (MySqlException) | 114 | m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString()); |
147 | { | 115 | return false; |
148 | System.Threading.Thread.Sleep(500); | 116 | } |
149 | |||
150 | m_Connection.Close(); | ||
151 | m_Connection = (MySqlConnection) ((ICloneable)m_Connection).Clone(); | ||
152 | m_Connection.Open(); | ||
153 | c.Connection = m_Connection; | ||
154 | |||
155 | if (!errorSeen) | ||
156 | { | ||
157 | errorSeen = true; | ||
158 | continue; | ||
159 | } | ||
160 | m_log.ErrorFormat("[FSASSETS] MySQL command: {0}", c.CommandText); | ||
161 | throw; | ||
162 | } | ||
163 | 117 | ||
164 | break; | 118 | cmd.Connection = conn; |
119 | try | ||
120 | { | ||
121 | cmd.ExecuteNonQuery(); | ||
122 | } | ||
123 | catch (MySqlException e) | ||
124 | { | ||
125 | cmd.Connection = null; | ||
126 | conn.Close(); | ||
127 | m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); | ||
128 | return false; | ||
165 | } | 129 | } |
130 | conn.Close(); | ||
131 | cmd.Connection = null; | ||
166 | } | 132 | } |
133 | |||
134 | return true; | ||
167 | } | 135 | } |
168 | 136 | ||
169 | #region IFSAssetDataPlugin Members | 137 | #region IFSAssetDataPlugin Members |
@@ -172,63 +140,79 @@ namespace OpenSim.Data.MySQL | |||
172 | { | 140 | { |
173 | hash = String.Empty; | 141 | hash = String.Empty; |
174 | 142 | ||
175 | MySqlCommand cmd = new MySqlCommand(); | ||
176 | |||
177 | cmd.CommandText = String.Format("select id, name, description, type, hash, create_time, access_time, asset_flags from {0} where id = ?id", m_Table); | ||
178 | cmd.Parameters.AddWithValue("?id", id); | ||
179 | |||
180 | IDataReader reader = ExecuteReader(cmd); | ||
181 | |||
182 | if (!reader.Read()) | ||
183 | { | ||
184 | reader.Close(); | ||
185 | FreeCommand(cmd); | ||
186 | return null; | ||
187 | } | ||
188 | |||
189 | AssetMetadata meta = new AssetMetadata(); | 143 | AssetMetadata meta = new AssetMetadata(); |
190 | 144 | ||
191 | hash = reader["hash"].ToString(); | 145 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
146 | { | ||
147 | try | ||
148 | { | ||
149 | conn.Open(); | ||
150 | } | ||
151 | catch (MySqlException e) | ||
152 | { | ||
153 | m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString()); | ||
154 | return null; | ||
155 | } | ||
192 | 156 | ||
193 | meta.ID = id; | 157 | using (MySqlCommand cmd = conn.CreateCommand()) |
194 | meta.FullID = new UUID(id); | 158 | { |
159 | cmd.CommandText = String.Format("select id, name, description, type, hash, create_time, asset_flags, access_time from {0} where id = ?id", m_Table); | ||
160 | cmd.Parameters.AddWithValue("?id", id); | ||
195 | 161 | ||
196 | meta.Name = reader["name"].ToString(); | 162 | using (IDataReader reader = cmd.ExecuteReader()) |
197 | meta.Description = reader["description"].ToString(); | 163 | { |
198 | meta.Type = (sbyte)Convert.ToInt32(reader["type"]); | 164 | if (!reader.Read()) |
199 | meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type); | 165 | return null; |
200 | meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"])); | ||
201 | meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]); | ||
202 | 166 | ||
203 | int AccessTime = Convert.ToInt32(reader["access_time"]); | 167 | hash = reader["hash"].ToString(); |
204 | 168 | ||
205 | reader.Close(); | 169 | meta.ID = id; |
170 | meta.FullID = new UUID(id); | ||
206 | 171 | ||
207 | UpdateAccessTime(AccessTime, cmd); | 172 | meta.Name = reader["name"].ToString(); |
173 | meta.Description = reader["description"].ToString(); | ||
174 | meta.Type = (sbyte)Convert.ToInt32(reader["type"]); | ||
175 | meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type); | ||
176 | meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"])); | ||
177 | meta.Flags = (AssetFlags)Convert.ToInt32(reader["asset_flags"]); | ||
208 | 178 | ||
209 | FreeCommand(cmd); | 179 | int AccessTime = Convert.ToInt32(reader["access_time"]); |
180 | UpdateAccessTime(id, AccessTime); | ||
181 | } | ||
182 | } | ||
183 | conn.Close(); | ||
184 | } | ||
210 | 185 | ||
211 | return meta; | 186 | return meta; |
212 | } | 187 | } |
213 | 188 | ||
214 | private void UpdateAccessTime(int AccessTime, MySqlCommand cmd) | 189 | private void UpdateAccessTime(string AssetID, int AccessTime) |
215 | { | 190 | { |
216 | // Reduce DB work by only updating access time if asset hasn't recently been accessed | 191 | // Reduce DB work by only updating access time if asset hasn't recently been accessed |
217 | // 0 By Default, Config option is "DaysBetweenAccessTimeUpdates" | 192 | // 0 By Default, Config option is "DaysBetweenAccessTimeUpdates" |
218 | if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates) | 193 | if (DaysBetweenAccessTimeUpdates > 0 && (DateTime.UtcNow - Utils.UnixTimeToDateTime(AccessTime)).TotalDays < DaysBetweenAccessTimeUpdates) |
219 | return; | 194 | return; |
220 | 195 | ||
221 | cmd.CommandText = String.Format("UPDATE {0} SET `access_time` = UNIX_TIMESTAMP() WHERE `id` = ?id", m_Table); | 196 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
222 | 197 | { | |
223 | cmd.ExecuteNonQuery(); | 198 | try |
224 | } | 199 | { |
200 | conn.Open(); | ||
201 | } | ||
202 | catch (MySqlException e) | ||
203 | { | ||
204 | m_log.ErrorFormat("[FSASSETS]: Database open failed with {0}", e.ToString()); | ||
205 | return; | ||
206 | } | ||
225 | 207 | ||
226 | protected void FreeCommand(MySqlCommand cmd) | 208 | using (MySqlCommand cmd = conn.CreateCommand()) |
227 | { | 209 | { |
228 | MySqlConnection c = cmd.Connection; | 210 | cmd.CommandText = String.Format("UPDATE {0} SET `access_time` = UNIX_TIMESTAMP() WHERE `id` = ?id", m_Table); |
229 | cmd.Dispose(); | 211 | cmd.Parameters.AddWithValue("?id", AssetID); |
230 | c.Close(); | 212 | cmd.ExecuteNonQuery(); |
231 | c.Dispose(); | 213 | } |
214 | conn.Close(); | ||
215 | } | ||
232 | } | 216 | } |
233 | 217 | ||
234 | public bool Store(AssetMetadata meta, string hash) | 218 | public bool Store(AssetMetadata meta, string hash) |
@@ -238,37 +222,41 @@ namespace OpenSim.Data.MySQL | |||
238 | string oldhash; | 222 | string oldhash; |
239 | AssetMetadata existingAsset = Get(meta.ID, out oldhash); | 223 | AssetMetadata existingAsset = Get(meta.ID, out oldhash); |
240 | 224 | ||
241 | MySqlCommand cmd = m_Connection.CreateCommand(); | 225 | using (MySqlCommand cmd = new MySqlCommand()) |
242 | |||
243 | cmd.Parameters.AddWithValue("?id", meta.ID); | ||
244 | cmd.Parameters.AddWithValue("?name", meta.Name); | ||
245 | cmd.Parameters.AddWithValue("?description", meta.Description); | ||
246 | cmd.Parameters.AddWithValue("?type", meta.Type.ToString()); | ||
247 | cmd.Parameters.AddWithValue("?hash", hash); | ||
248 | cmd.Parameters.AddWithValue("?asset_flags", meta.Flags); | ||
249 | |||
250 | if (existingAsset == null) | ||
251 | { | 226 | { |
252 | cmd.CommandText = String.Format("insert into {0} (id, name, description, type, hash, asset_flags, create_time, access_time) values ( ?id, ?name, ?description, ?type, ?hash, ?asset_flags, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())", m_Table); | 227 | cmd.Parameters.AddWithValue("?id", meta.ID); |
228 | cmd.Parameters.AddWithValue("?name", meta.Name); | ||
229 | cmd.Parameters.AddWithValue("?description", meta.Description); | ||
230 | // cmd.Parameters.AddWithValue("?type", meta.Type.ToString()); | ||
231 | cmd.Parameters.AddWithValue("?type", meta.Type); | ||
232 | cmd.Parameters.AddWithValue("?hash", hash); | ||
233 | cmd.Parameters.AddWithValue("?asset_flags", meta.Flags); | ||
234 | |||
235 | if (existingAsset == null) | ||
236 | { | ||
237 | cmd.CommandText = String.Format("insert into {0} (id, name, description, type, hash, asset_flags, create_time, access_time) values ( ?id, ?name, ?description, ?type, ?hash, ?asset_flags, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())", m_Table); | ||
253 | 238 | ||
254 | ExecuteNonQuery(cmd); | 239 | ExecuteNonQuery(cmd); |
255 | 240 | ||
256 | cmd.Dispose(); | 241 | return true; |
242 | } | ||
257 | 243 | ||
258 | return true; | 244 | //cmd.CommandText = String.Format("update {0} set hash = ?hash, access_time = UNIX_TIMESTAMP() where id = ?id", m_Table); |
259 | } | ||
260 | 245 | ||
261 | //cmd.CommandText = String.Format("update {0} set hash = ?hash, access_time = UNIX_TIMESTAMP() where id = ?id", m_Table); | 246 | //ExecuteNonQuery(cmd); |
262 | 247 | ||
263 | //ExecuteNonQuery(cmd); | 248 | } |
264 | 249 | ||
265 | cmd.Dispose(); | 250 | // return false; |
266 | return false; | 251 | // if the asset already exits |
252 | // assume it was already correctly stored | ||
253 | // or regions will keep retry. | ||
254 | return true; | ||
267 | } | 255 | } |
268 | catch(Exception e) | 256 | catch(Exception e) |
269 | { | 257 | { |
270 | m_log.Error("[FSAssets] Failed to store asset with ID " + meta.ID); | 258 | m_log.Error("[FSAssets] Failed to store asset with ID " + meta.ID); |
271 | m_log.Error(e.ToString()); | 259 | m_log.Error(e.ToString()); |
272 | return false; | 260 | return false; |
273 | } | 261 | } |
274 | } | 262 | } |
@@ -283,26 +271,43 @@ namespace OpenSim.Data.MySQL | |||
283 | if (uuids.Length == 0) | 271 | if (uuids.Length == 0) |
284 | return new bool[0]; | 272 | return new bool[0]; |
285 | 273 | ||
274 | bool[] results = new bool[uuids.Length]; | ||
275 | for (int i = 0; i < uuids.Length; i++) | ||
276 | results[i] = false; | ||
277 | |||
286 | HashSet<UUID> exists = new HashSet<UUID>(); | 278 | HashSet<UUID> exists = new HashSet<UUID>(); |
287 | 279 | ||
288 | string ids = "'" + string.Join("','", uuids) + "'"; | 280 | string ids = "'" + string.Join("','", uuids) + "'"; |
289 | string sql = string.Format("select id from {1} where id in ({0})", ids, m_Table); | 281 | string sql = string.Format("select id from {1} where id in ({0})", ids, m_Table); |
290 | 282 | ||
291 | using (MySqlCommand cmd = m_Connection.CreateCommand()) | 283 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
292 | { | 284 | { |
293 | cmd.CommandText = sql; | 285 | try |
286 | { | ||
287 | conn.Open(); | ||
288 | } | ||
289 | catch (MySqlException e) | ||
290 | { | ||
291 | m_log.ErrorFormat("[FSASSETS]: Failed to open database: {0}", e.ToString()); | ||
292 | return results; | ||
293 | } | ||
294 | 294 | ||
295 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) | 295 | using (MySqlCommand cmd = conn.CreateCommand()) |
296 | { | 296 | { |
297 | while (dbReader.Read()) | 297 | cmd.CommandText = sql; |
298 | |||
299 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) | ||
298 | { | 300 | { |
299 | UUID id = DBGuid.FromDB(dbReader["ID"]); | 301 | while (dbReader.Read()) |
300 | exists.Add(id); | 302 | { |
303 | UUID id = DBGuid.FromDB(dbReader["ID"]); | ||
304 | exists.Add(id); | ||
305 | } | ||
301 | } | 306 | } |
302 | } | 307 | } |
308 | conn.Close(); | ||
303 | } | 309 | } |
304 | 310 | ||
305 | bool[] results = new bool[uuids.Length]; | ||
306 | for (int i = 0; i < uuids.Length; i++) | 311 | for (int i = 0; i < uuids.Length; i++) |
307 | results[i] = exists.Contains(uuids[i]); | 312 | results[i] = exists.Contains(uuids[i]); |
308 | return results; | 313 | return results; |
@@ -310,27 +315,43 @@ namespace OpenSim.Data.MySQL | |||
310 | 315 | ||
311 | public int Count() | 316 | public int Count() |
312 | { | 317 | { |
313 | MySqlCommand cmd = m_Connection.CreateCommand(); | 318 | int count = 0; |
314 | 319 | ||
315 | cmd.CommandText = String.Format("select count(*) as count from {0}", m_Table); | 320 | using (MySqlConnection conn = new MySqlConnection(m_ConnectionString)) |
316 | 321 | { | |
317 | IDataReader reader = ExecuteReader(cmd); | 322 | try |
323 | { | ||
324 | conn.Open(); | ||
325 | } | ||
326 | catch (MySqlException e) | ||
327 | { | ||
328 | m_log.ErrorFormat("[FSASSETS]: Failed to open database: {0}", e.ToString()); | ||
329 | return 0; | ||
330 | } | ||
318 | 331 | ||
319 | reader.Read(); | 332 | using(MySqlCommand cmd = conn.CreateCommand()) |
333 | { | ||
334 | cmd.CommandText = String.Format("select count(*) as count from {0}",m_Table); | ||
320 | 335 | ||
321 | int count = Convert.ToInt32(reader["count"]); | 336 | using (IDataReader reader = cmd.ExecuteReader()) |
337 | { | ||
338 | reader.Read(); | ||
322 | 339 | ||
323 | reader.Close(); | 340 | count = Convert.ToInt32(reader["count"]); |
324 | FreeCommand(cmd); | 341 | } |
342 | } | ||
343 | conn.Close(); | ||
344 | } | ||
325 | 345 | ||
326 | return count; | 346 | return count; |
327 | } | 347 | } |
328 | 348 | ||
329 | public bool Delete(string id) | 349 | public bool Delete(string id) |
330 | { | 350 | { |
331 | using (MySqlCommand cmd = m_Connection.CreateCommand()) | 351 | using(MySqlCommand cmd = new MySqlCommand()) |
332 | { | 352 | { |
333 | cmd.CommandText = String.Format("delete from {0} where id = ?id", m_Table); | 353 | |
354 | cmd.CommandText = String.Format("delete from {0} where id = ?id",m_Table); | ||
334 | 355 | ||
335 | cmd.Parameters.AddWithValue("?id", id); | 356 | cmd.Parameters.AddWithValue("?id", id); |
336 | 357 | ||
@@ -342,70 +363,68 @@ namespace OpenSim.Data.MySQL | |||
342 | 363 | ||
343 | public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store) | 364 | public void Import(string conn, string table, int start, int count, bool force, FSStoreDelegate store) |
344 | { | 365 | { |
345 | MySqlConnection importConn; | 366 | int imported = 0; |
346 | |||
347 | try | ||
348 | { | ||
349 | importConn = new MySqlConnection(conn); | ||
350 | 367 | ||
351 | importConn.Open(); | 368 | using (MySqlConnection importConn = new MySqlConnection(conn)) |
352 | } | ||
353 | catch (MySqlException e) | ||
354 | { | 369 | { |
355 | m_log.ErrorFormat("[FSASSETS]: Can't connect to database: {0}", | 370 | try |
356 | e.Message.ToString()); | 371 | { |
357 | 372 | importConn.Open(); | |
358 | return; | 373 | } |
359 | } | 374 | catch (MySqlException e) |
375 | { | ||
376 | m_log.ErrorFormat("[FSASSETS]: Can't connect to database: {0}", | ||
377 | e.Message.ToString()); | ||
360 | 378 | ||
361 | int imported = 0; | 379 | return; |
380 | } | ||
362 | 381 | ||
363 | MySqlCommand cmd = importConn.CreateCommand(); | 382 | using (MySqlCommand cmd = importConn.CreateCommand()) |
383 | { | ||
384 | string limit = String.Empty; | ||
385 | if (count != -1) | ||
386 | { | ||
387 | limit = String.Format(" limit {0},{1}", start, count); | ||
388 | } | ||
364 | 389 | ||
365 | string limit = String.Empty; | 390 | cmd.CommandText = String.Format("select * from {0}{1}", table, limit); |
366 | if (count != -1) | ||
367 | { | ||
368 | limit = String.Format(" limit {0},{1}", start, count); | ||
369 | } | ||
370 | |||
371 | cmd.CommandText = String.Format("select * from {0}{1}", table, limit); | ||
372 | 391 | ||
373 | MainConsole.Instance.Output("Querying database"); | 392 | MainConsole.Instance.Output("Querying database"); |
374 | IDataReader reader = cmd.ExecuteReader(); | 393 | using (IDataReader reader = cmd.ExecuteReader()) |
394 | { | ||
395 | MainConsole.Instance.Output("Reading data"); | ||
375 | 396 | ||
376 | MainConsole.Instance.Output("Reading data"); | 397 | while (reader.Read()) |
398 | { | ||
399 | if ((imported % 100) == 0) | ||
400 | { | ||
401 | MainConsole.Instance.Output(String.Format("{0} assets imported so far", imported)); | ||
402 | } | ||
377 | 403 | ||
378 | while (reader.Read()) | 404 | AssetBase asset = new AssetBase(); |
379 | { | 405 | AssetMetadata meta = new AssetMetadata(); |
380 | if ((imported % 100) == 0) | ||
381 | { | ||
382 | MainConsole.Instance.Output(String.Format("{0} assets imported so far", imported)); | ||
383 | } | ||
384 | |||
385 | AssetBase asset = new AssetBase(); | ||
386 | AssetMetadata meta = new AssetMetadata(); | ||
387 | 406 | ||
388 | meta.ID = reader["id"].ToString(); | 407 | meta.ID = reader["id"].ToString(); |
389 | meta.FullID = new UUID(meta.ID); | 408 | meta.FullID = new UUID(meta.ID); |
390 | 409 | ||
391 | meta.Name = reader["name"].ToString(); | 410 | meta.Name = reader["name"].ToString(); |
392 | meta.Description = reader["description"].ToString(); | 411 | meta.Description = reader["description"].ToString(); |
393 | meta.Type = (sbyte)Convert.ToInt32(reader["assetType"]); | 412 | meta.Type = (sbyte)Convert.ToInt32(reader["assetType"]); |
394 | meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type); | 413 | meta.ContentType = SLUtil.SLAssetTypeToContentType(meta.Type); |
395 | meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"])); | 414 | meta.CreationDate = Util.ToDateTime(Convert.ToInt32(reader["create_time"])); |
396 | 415 | ||
397 | asset.Metadata = meta; | 416 | asset.Metadata = meta; |
398 | asset.Data = (byte[])reader["data"]; | 417 | asset.Data = (byte[])reader["data"]; |
399 | 418 | ||
400 | store(asset, force); | 419 | store(asset, force); |
401 | 420 | ||
402 | imported++; | 421 | imported++; |
422 | } | ||
423 | } | ||
424 | } | ||
425 | importConn.Close(); | ||
403 | } | 426 | } |
404 | 427 | ||
405 | reader.Close(); | ||
406 | cmd.Dispose(); | ||
407 | importConn.Close(); | ||
408 | |||
409 | MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported)); | 428 | MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported)); |
410 | } | 429 | } |
411 | 430 | ||
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs index 5820a90..98106f0 100644 --- a/OpenSim/Data/MySQL/MySQLFramework.cs +++ b/OpenSim/Data/MySQL/MySQLFramework.cs | |||
@@ -36,7 +36,7 @@ using MySql.Data.MySqlClient; | |||
36 | namespace OpenSim.Data.MySQL | 36 | namespace OpenSim.Data.MySQL |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// A database interface class to a user profile storage system | 39 | /// Common code for a number of database modules |
40 | /// </summary> | 40 | /// </summary> |
41 | public class MySqlFramework | 41 | public class MySqlFramework |
42 | { | 42 | { |
@@ -44,30 +44,78 @@ namespace OpenSim.Data.MySQL | |||
44 | log4net.LogManager.GetLogger( | 44 | log4net.LogManager.GetLogger( |
45 | System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 45 | System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | protected string m_connectionString; | 47 | protected string m_connectionString = String.Empty; |
48 | protected MySqlTransaction m_trans = null; | ||
48 | 49 | ||
50 | // Constructor using a connection string. Instances constructed | ||
51 | // this way will open a new connection for each call. | ||
49 | protected MySqlFramework(string connectionString) | 52 | protected MySqlFramework(string connectionString) |
50 | { | 53 | { |
51 | m_connectionString = connectionString; | 54 | m_connectionString = connectionString; |
52 | } | 55 | } |
53 | 56 | ||
57 | // Constructor using a connection object. Instances constructed | ||
58 | // this way will use the connection object and never create | ||
59 | // new connections. | ||
60 | protected MySqlFramework(MySqlTransaction trans) | ||
61 | { | ||
62 | m_trans = trans; | ||
63 | } | ||
64 | |||
65 | ////////////////////////////////////////////////////////////// | ||
66 | // | ||
67 | // All non queries are funneled through one connection | ||
68 | // to increase performance a little | ||
69 | // | ||
54 | protected int ExecuteNonQuery(MySqlCommand cmd) | 70 | protected int ExecuteNonQuery(MySqlCommand cmd) |
55 | { | 71 | { |
56 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 72 | if (m_trans == null) |
73 | { | ||
74 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
75 | { | ||
76 | dbcon.Open(); | ||
77 | int ret = ExecuteNonQueryWithConnection(cmd, dbcon); | ||
78 | dbcon.Close(); | ||
79 | return ret; | ||
80 | } | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | return ExecuteNonQueryWithTransaction(cmd, m_trans); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | private int ExecuteNonQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans) | ||
89 | { | ||
90 | cmd.Transaction = trans; | ||
91 | return ExecuteNonQueryWithConnection(cmd, trans.Connection); | ||
92 | } | ||
93 | |||
94 | private int ExecuteNonQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon) | ||
95 | { | ||
96 | try | ||
57 | { | 97 | { |
58 | dbcon.Open(); | ||
59 | cmd.Connection = dbcon; | 98 | cmd.Connection = dbcon; |
60 | 99 | ||
61 | try | 100 | try |
62 | { | 101 | { |
63 | return cmd.ExecuteNonQuery(); | 102 | int ret = cmd.ExecuteNonQuery(); |
103 | cmd.Connection = null; | ||
104 | return ret; | ||
64 | } | 105 | } |
65 | catch (Exception e) | 106 | catch (Exception e) |
66 | { | 107 | { |
67 | m_log.Error(e.Message, e); | 108 | m_log.Error(e.Message, e); |
109 | m_log.Error(Environment.StackTrace.ToString()); | ||
110 | cmd.Connection = null; | ||
68 | return 0; | 111 | return 0; |
69 | } | 112 | } |
70 | } | 113 | } |
114 | catch (Exception e) | ||
115 | { | ||
116 | m_log.Error(e.Message, e); | ||
117 | return 0; | ||
118 | } | ||
71 | } | 119 | } |
72 | } | 120 | } |
73 | } \ No newline at end of file | 121 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 35fa89f..9bd3c0c 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Data.MySQL | |||
40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() | 40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() |
41 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | protected Dictionary<string, FieldInfo> m_Fields = | 44 | protected Dictionary<string, FieldInfo> m_Fields = |
45 | new Dictionary<string, FieldInfo>(); | 45 | new Dictionary<string, FieldInfo>(); |
46 | 46 | ||
@@ -53,14 +53,27 @@ namespace OpenSim.Data.MySQL | |||
53 | get { return GetType().Assembly; } | 53 | get { return GetType().Assembly; } |
54 | } | 54 | } |
55 | 55 | ||
56 | public MySQLGenericTableHandler(MySqlTransaction trans, | ||
57 | string realm, string storeName) : base(trans) | ||
58 | { | ||
59 | m_Realm = realm; | ||
60 | |||
61 | CommonConstruct(storeName); | ||
62 | } | ||
63 | |||
56 | public MySQLGenericTableHandler(string connectionString, | 64 | public MySQLGenericTableHandler(string connectionString, |
57 | string realm, string storeName) : base(connectionString) | 65 | string realm, string storeName) : base(connectionString) |
58 | { | 66 | { |
59 | m_Realm = realm; | 67 | m_Realm = realm; |
60 | m_connectionString = connectionString; | 68 | |
61 | 69 | CommonConstruct(storeName); | |
70 | } | ||
71 | |||
72 | protected void CommonConstruct(string storeName) | ||
73 | { | ||
62 | if (storeName != String.Empty) | 74 | if (storeName != String.Empty) |
63 | { | 75 | { |
76 | // We always use a new connection for any Migrations | ||
64 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 77 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
65 | { | 78 | { |
66 | dbcon.Open(); | 79 | dbcon.Open(); |
@@ -111,6 +124,11 @@ namespace OpenSim.Data.MySQL | |||
111 | 124 | ||
112 | public virtual T[] Get(string[] fields, string[] keys) | 125 | public virtual T[] Get(string[] fields, string[] keys) |
113 | { | 126 | { |
127 | return Get(fields, keys, String.Empty); | ||
128 | } | ||
129 | |||
130 | public virtual T[] Get(string[] fields, string[] keys, string options) | ||
131 | { | ||
114 | if (fields.Length != keys.Length) | 132 | if (fields.Length != keys.Length) |
115 | return new T[0]; | 133 | return new T[0]; |
116 | 134 | ||
@@ -126,81 +144,107 @@ namespace OpenSim.Data.MySQL | |||
126 | 144 | ||
127 | string where = String.Join(" and ", terms.ToArray()); | 145 | string where = String.Join(" and ", terms.ToArray()); |
128 | 146 | ||
129 | string query = String.Format("select * from {0} where {1}", | 147 | string query = String.Format("select * from {0} where {1} {2}", |
130 | m_Realm, where); | 148 | m_Realm, where, options); |
131 | 149 | ||
132 | cmd.CommandText = query; | 150 | cmd.CommandText = query; |
133 | 151 | ||
134 | return DoQuery(cmd); | 152 | return DoQuery(cmd); |
135 | } | 153 | } |
136 | } | 154 | } |
137 | 155 | ||
138 | protected T[] DoQuery(MySqlCommand cmd) | 156 | protected T[] DoQuery(MySqlCommand cmd) |
139 | { | 157 | { |
158 | if (m_trans == null) | ||
159 | { | ||
160 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
161 | { | ||
162 | dbcon.Open(); | ||
163 | T[] ret = DoQueryWithConnection(cmd, dbcon); | ||
164 | dbcon.Close(); | ||
165 | return ret; | ||
166 | } | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | return DoQueryWithTransaction(cmd, m_trans); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | protected T[] DoQueryWithTransaction(MySqlCommand cmd, MySqlTransaction trans) | ||
175 | { | ||
176 | cmd.Transaction = trans; | ||
177 | |||
178 | return DoQueryWithConnection(cmd, trans.Connection); | ||
179 | } | ||
180 | |||
181 | protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon) | ||
182 | { | ||
140 | List<T> result = new List<T>(); | 183 | List<T> result = new List<T>(); |
141 | 184 | ||
142 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 185 | cmd.Connection = dbcon; |
186 | |||
187 | using (IDataReader reader = cmd.ExecuteReader()) | ||
143 | { | 188 | { |
144 | dbcon.Open(); | 189 | if (reader == null) |
145 | cmd.Connection = dbcon; | 190 | return new T[0]; |
146 | 191 | ||
147 | using (IDataReader reader = cmd.ExecuteReader()) | 192 | CheckColumnNames(reader); |
148 | { | ||
149 | if (reader == null) | ||
150 | return new T[0]; | ||
151 | 193 | ||
152 | CheckColumnNames(reader); | 194 | while (reader.Read()) |
195 | { | ||
196 | T row = new T(); | ||
153 | 197 | ||
154 | while (reader.Read()) | 198 | foreach (string name in m_Fields.Keys) |
155 | { | 199 | { |
156 | T row = new T(); | 200 | if (reader[name] is DBNull) |
157 | 201 | { | |
158 | foreach (string name in m_Fields.Keys) | 202 | continue; |
203 | } | ||
204 | if (m_Fields[name].FieldType == typeof(bool)) | ||
205 | { | ||
206 | int v = Convert.ToInt32(reader[name]); | ||
207 | m_Fields[name].SetValue(row, v != 0 ? true : false); | ||
208 | } | ||
209 | else if (m_Fields[name].FieldType == typeof(UUID)) | ||
159 | { | 210 | { |
160 | if (reader[name] is DBNull) | 211 | m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name])); |
161 | { | ||
162 | continue; | ||
163 | } | ||
164 | if (m_Fields[name].FieldType == typeof(bool)) | ||
165 | { | ||
166 | int v = Convert.ToInt32(reader[name]); | ||
167 | m_Fields[name].SetValue(row, v != 0 ? true : false); | ||
168 | } | ||
169 | else if (m_Fields[name].FieldType == typeof(UUID)) | ||
170 | { | ||
171 | m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name])); | ||
172 | } | ||
173 | else if (m_Fields[name].FieldType == typeof(int)) | ||
174 | { | ||
175 | int v = Convert.ToInt32(reader[name]); | ||
176 | m_Fields[name].SetValue(row, v); | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | m_Fields[name].SetValue(row, reader[name]); | ||
181 | } | ||
182 | } | 212 | } |
183 | 213 | else if (m_Fields[name].FieldType == typeof(int)) | |
184 | if (m_DataField != null) | ||
185 | { | 214 | { |
186 | Dictionary<string, string> data = | 215 | int v = Convert.ToInt32(reader[name]); |
187 | new Dictionary<string, string>(); | 216 | m_Fields[name].SetValue(row, v); |
217 | } | ||
218 | else if (m_Fields[name].FieldType == typeof(uint)) | ||
219 | { | ||
220 | uint v = Convert.ToUInt32(reader[name]); | ||
221 | m_Fields[name].SetValue(row, v); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | m_Fields[name].SetValue(row, reader[name]); | ||
226 | } | ||
227 | } | ||
188 | 228 | ||
189 | foreach (string col in m_ColumnNames) | 229 | if (m_DataField != null) |
190 | { | 230 | { |
191 | data[col] = reader[col].ToString(); | 231 | Dictionary<string, string> data = |
192 | if (data[col] == null) | 232 | new Dictionary<string, string>(); |
193 | data[col] = String.Empty; | ||
194 | } | ||
195 | 233 | ||
196 | m_DataField.SetValue(row, data); | 234 | foreach (string col in m_ColumnNames) |
235 | { | ||
236 | data[col] = reader[col].ToString(); | ||
237 | if (data[col] == null) | ||
238 | data[col] = String.Empty; | ||
197 | } | 239 | } |
198 | 240 | ||
199 | result.Add(row); | 241 | m_DataField.SetValue(row, data); |
200 | } | 242 | } |
243 | |||
244 | result.Add(row); | ||
201 | } | 245 | } |
202 | } | 246 | } |
203 | 247 | cmd.Connection = null; | |
204 | return result.ToArray(); | 248 | return result.ToArray(); |
205 | } | 249 | } |
206 | 250 | ||
@@ -210,9 +254,9 @@ namespace OpenSim.Data.MySQL | |||
210 | { | 254 | { |
211 | string query = String.Format("select * from {0} where {1}", | 255 | string query = String.Format("select * from {0} where {1}", |
212 | m_Realm, where); | 256 | m_Realm, where); |
213 | 257 | ||
214 | cmd.CommandText = query; | 258 | cmd.CommandText = query; |
215 | 259 | ||
216 | return DoQuery(cmd); | 260 | return DoQuery(cmd); |
217 | } | 261 | } |
218 | } | 262 | } |
@@ -231,16 +275,16 @@ namespace OpenSim.Data.MySQL | |||
231 | { | 275 | { |
232 | names.Add(fi.Name); | 276 | names.Add(fi.Name); |
233 | values.Add("?" + fi.Name); | 277 | values.Add("?" + fi.Name); |
234 | 278 | ||
235 | // Temporarily return more information about what field is unexpectedly null for | 279 | // Temporarily return more information about what field is unexpectedly null for |
236 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the | 280 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the |
237 | // InventoryTransferModule or we may be required to substitute a DBNull here. | 281 | // InventoryTransferModule or we may be required to substitute a DBNull here. |
238 | if (fi.GetValue(row) == null) | 282 | if (fi.GetValue(row) == null) |
239 | throw new NullReferenceException( | 283 | throw new NullReferenceException( |
240 | string.Format( | 284 | string.Format( |
241 | "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", | 285 | "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", |
242 | fi.Name, row)); | 286 | fi.Name, row)); |
243 | 287 | ||
244 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); | 288 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); |
245 | } | 289 | } |
246 | 290 | ||
@@ -352,14 +396,26 @@ namespace OpenSim.Data.MySQL | |||
352 | 396 | ||
353 | public object DoQueryScalar(MySqlCommand cmd) | 397 | public object DoQueryScalar(MySqlCommand cmd) |
354 | { | 398 | { |
355 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 399 | if (m_trans == null) |
356 | { | 400 | { |
357 | dbcon.Open(); | 401 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
358 | cmd.Connection = dbcon; | 402 | { |
403 | dbcon.Open(); | ||
404 | cmd.Connection = dbcon; | ||
405 | |||
406 | Object ret = cmd.ExecuteScalar(); | ||
407 | cmd.Connection = null; | ||
408 | dbcon.Close(); | ||
409 | return ret; | ||
410 | } | ||
411 | } | ||
412 | else | ||
413 | { | ||
414 | cmd.Connection = m_trans.Connection; | ||
415 | cmd.Transaction = m_trans; | ||
359 | 416 | ||
360 | return cmd.ExecuteScalar(); | 417 | return cmd.ExecuteScalar(); |
361 | } | 418 | } |
362 | } | 419 | } |
363 | |||
364 | } | 420 | } |
365 | } \ No newline at end of file | 421 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs index afa499e..4e73ee7 100644 --- a/OpenSim/Data/MySQL/MySQLGroupsData.cs +++ b/OpenSim/Data/MySQL/MySQLGroupsData.cs | |||
@@ -133,10 +133,10 @@ namespace OpenSim.Data.MySQL | |||
133 | 133 | ||
134 | public bool DeleteMember(UUID groupID, string pricipalID) | 134 | public bool DeleteMember(UUID groupID, string pricipalID) |
135 | { | 135 | { |
136 | return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" }, | 136 | return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" }, |
137 | new string[] { groupID.ToString(), pricipalID }); | 137 | new string[] { groupID.ToString(), pricipalID }); |
138 | } | 138 | } |
139 | 139 | ||
140 | public int MemberCount(UUID groupID) | 140 | public int MemberCount(UUID groupID) |
141 | { | 141 | { |
142 | return (int)m_Membership.GetCount("GroupID", groupID.ToString()); | 142 | return (int)m_Membership.GetCount("GroupID", groupID.ToString()); |
@@ -168,7 +168,7 @@ namespace OpenSim.Data.MySQL | |||
168 | 168 | ||
169 | public bool DeleteRole(UUID groupID, UUID roleID) | 169 | public bool DeleteRole(UUID groupID, UUID roleID) |
170 | { | 170 | { |
171 | return m_Roles.Delete(new string[] { "GroupID", "RoleID" }, | 171 | return m_Roles.Delete(new string[] { "GroupID", "RoleID" }, |
172 | new string[] { groupID.ToString(), roleID.ToString() }); | 172 | new string[] { groupID.ToString(), roleID.ToString() }); |
173 | } | 173 | } |
174 | 174 | ||
@@ -360,7 +360,7 @@ namespace OpenSim.Data.MySQL | |||
360 | get { return GetType().Assembly; } | 360 | get { return GetType().Assembly; } |
361 | } | 361 | } |
362 | 362 | ||
363 | public MySqlGroupsGroupsHandler(string connectionString, string realm, string store) | 363 | public MySqlGroupsGroupsHandler(string connectionString, string realm, string store) |
364 | : base(connectionString, realm, store) | 364 | : base(connectionString, realm, store) |
365 | { | 365 | { |
366 | } | 366 | } |
@@ -375,7 +375,7 @@ namespace OpenSim.Data.MySQL | |||
375 | get { return GetType().Assembly; } | 375 | get { return GetType().Assembly; } |
376 | } | 376 | } |
377 | 377 | ||
378 | public MySqlGroupsMembershipHandler(string connectionString, string realm) | 378 | public MySqlGroupsMembershipHandler(string connectionString, string realm) |
379 | : base(connectionString, realm, string.Empty) | 379 | : base(connectionString, realm, string.Empty) |
380 | { | 380 | { |
381 | } | 381 | } |
@@ -390,7 +390,7 @@ namespace OpenSim.Data.MySQL | |||
390 | get { return GetType().Assembly; } | 390 | get { return GetType().Assembly; } |
391 | } | 391 | } |
392 | 392 | ||
393 | public MySqlGroupsRolesHandler(string connectionString, string realm) | 393 | public MySqlGroupsRolesHandler(string connectionString, string realm) |
394 | : base(connectionString, realm, string.Empty) | 394 | : base(connectionString, realm, string.Empty) |
395 | { | 395 | { |
396 | } | 396 | } |
@@ -405,7 +405,7 @@ namespace OpenSim.Data.MySQL | |||
405 | get { return GetType().Assembly; } | 405 | get { return GetType().Assembly; } |
406 | } | 406 | } |
407 | 407 | ||
408 | public MySqlGroupsRoleMembershipHandler(string connectionString, string realm) | 408 | public MySqlGroupsRoleMembershipHandler(string connectionString, string realm) |
409 | : base(connectionString, realm, string.Empty) | 409 | : base(connectionString, realm, string.Empty) |
410 | { | 410 | { |
411 | } | 411 | } |
@@ -420,7 +420,7 @@ namespace OpenSim.Data.MySQL | |||
420 | get { return GetType().Assembly; } | 420 | get { return GetType().Assembly; } |
421 | } | 421 | } |
422 | 422 | ||
423 | public MySqlGroupsInvitesHandler(string connectionString, string realm) | 423 | public MySqlGroupsInvitesHandler(string connectionString, string realm) |
424 | : base(connectionString, realm, string.Empty) | 424 | : base(connectionString, realm, string.Empty) |
425 | { | 425 | { |
426 | } | 426 | } |
@@ -431,8 +431,7 @@ namespace OpenSim.Data.MySQL | |||
431 | 431 | ||
432 | using (MySqlCommand cmd = new MySqlCommand()) | 432 | using (MySqlCommand cmd = new MySqlCommand()) |
433 | { | 433 | { |
434 | cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm); | 434 | cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm); |
435 | cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old | ||
436 | 435 | ||
437 | ExecuteNonQuery(cmd); | 436 | ExecuteNonQuery(cmd); |
438 | } | 437 | } |
@@ -448,7 +447,7 @@ namespace OpenSim.Data.MySQL | |||
448 | get { return GetType().Assembly; } | 447 | get { return GetType().Assembly; } |
449 | } | 448 | } |
450 | 449 | ||
451 | public MySqlGroupsNoticesHandler(string connectionString, string realm) | 450 | public MySqlGroupsNoticesHandler(string connectionString, string realm) |
452 | : base(connectionString, realm, string.Empty) | 451 | : base(connectionString, realm, string.Empty) |
453 | { | 452 | { |
454 | } | 453 | } |
@@ -476,7 +475,7 @@ namespace OpenSim.Data.MySQL | |||
476 | get { return GetType().Assembly; } | 475 | get { return GetType().Assembly; } |
477 | } | 476 | } |
478 | 477 | ||
479 | public MySqlGroupsPrincipalsHandler(string connectionString, string realm) | 478 | public MySqlGroupsPrincipalsHandler(string connectionString, string realm) |
480 | : base(connectionString, realm, string.Empty) | 479 | : base(connectionString, realm, string.Empty) |
481 | { | 480 | { |
482 | } | 481 | } |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index e9b10f3..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 | } |
@@ -288,7 +293,7 @@ namespace OpenSim.Data.MySQL | |||
288 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. | 293 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
289 | // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero) | 294 | // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero) |
290 | item.CreatorId = reader["creatorID"].ToString(); | 295 | item.CreatorId = reader["creatorID"].ToString(); |
291 | 296 | ||
292 | // Be a bit safer in parsing these because the | 297 | // Be a bit safer in parsing these because the |
293 | // database doesn't enforce them to be not null, and | 298 | // database doesn't enforce them to be not null, and |
294 | // the inventory still works if these are weird in the | 299 | // the inventory still works if these are weird in the |
@@ -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 | } |
@@ -453,7 +460,7 @@ namespace OpenSim.Data.MySQL | |||
453 | itemName = item.Name.Substring(0, 64); | 460 | itemName = item.Name.Substring(0, 64); |
454 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item"); | 461 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item"); |
455 | } | 462 | } |
456 | 463 | ||
457 | string itemDesc = item.Description; | 464 | string itemDesc = item.Description; |
458 | if (item.Description.Length > 128) | 465 | if (item.Description.Length > 128) |
459 | { | 466 | { |
@@ -490,10 +497,10 @@ namespace OpenSim.Data.MySQL | |||
490 | result.Parameters.AddWithValue("?groupID", item.GroupID); | 497 | result.Parameters.AddWithValue("?groupID", item.GroupID); |
491 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | 498 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); |
492 | result.Parameters.AddWithValue("?flags", item.Flags); | 499 | result.Parameters.AddWithValue("?flags", item.Flags); |
493 | 500 | ||
494 | lock (m_dbLock) | 501 | lock (m_dbLock) |
495 | result.ExecuteNonQuery(); | 502 | result.ExecuteNonQuery(); |
496 | 503 | ||
497 | result.Dispose(); | 504 | result.Dispose(); |
498 | } | 505 | } |
499 | 506 | ||
@@ -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 | ||
@@ -630,7 +640,7 @@ namespace OpenSim.Data.MySQL | |||
630 | { | 640 | { |
631 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); | 641 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); |
632 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | 642 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); |
633 | 643 | ||
634 | try | 644 | try |
635 | { | 645 | { |
636 | lock (m_dbLock) | 646 | lock (m_dbLock) |
@@ -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) |
@@ -860,7 +873,7 @@ namespace OpenSim.Data.MySQL | |||
860 | deleteOneFolder(folderID); | 873 | deleteOneFolder(folderID); |
861 | deleteItemsInFolder(folderID); | 874 | deleteItemsInFolder(folderID); |
862 | } | 875 | } |
863 | 876 | ||
864 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) | 877 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) |
865 | { | 878 | { |
866 | lock (m_dbLock) | 879 | lock (m_dbLock) |
@@ -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/MySQLMigrations.cs b/OpenSim/Data/MySQL/MySQLMigrations.cs index 81a0e83..2043dae 100644 --- a/OpenSim/Data/MySQL/MySQLMigrations.cs +++ b/OpenSim/Data/MySQL/MySQLMigrations.cs | |||
@@ -39,16 +39,16 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | /// <summary>This is a MySQL-customized migration processor. The only difference is in how | 40 | /// <summary>This is a MySQL-customized migration processor. The only difference is in how |
41 | /// it executes SQL scripts (using MySqlScript instead of MyCommand) | 41 | /// it executes SQL scripts (using MySqlScript instead of MyCommand) |
42 | /// | 42 | /// |
43 | /// </summary> | 43 | /// </summary> |
44 | public class MySqlMigration : Migration | 44 | public class MySqlMigration : Migration |
45 | { | 45 | { |
46 | public MySqlMigration() | 46 | public MySqlMigration() |
47 | : base() | 47 | : base() |
48 | { | 48 | { |
49 | } | 49 | } |
50 | 50 | ||
51 | public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) : | 51 | public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) : |
52 | base(conn, assem, subtype, type) | 52 | base(conn, assem, subtype, type) |
53 | { | 53 | { |
54 | } | 54 | } |
diff --git a/OpenSim/Data/MySQL/MySQLMuteListData.cs b/OpenSim/Data/MySQL/MySQLMuteListData.cs new file mode 100644 index 0000000..a5935a3 --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLMuteListData.cs | |||
@@ -0,0 +1,67 @@ | |||
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 OpenSimulator 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; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using MySql.Data.MySqlClient; | ||
35 | |||
36 | namespace OpenSim.Data.MySQL | ||
37 | { | ||
38 | public class MySqlMuteListData : MySQLGenericTableHandler<MuteData>, IMuteListData | ||
39 | { | ||
40 | public MySqlMuteListData(string connectionString) | ||
41 | : base(connectionString, "MuteList", "MuteListStore") | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public MuteData[] Get(UUID agentID) | ||
46 | { | ||
47 | MuteData[] data = base.Get("AgentID", agentID.ToString()); | ||
48 | return data; | ||
49 | } | ||
50 | |||
51 | public bool Delete(UUID agentID, UUID muteID, string muteName) | ||
52 | { | ||
53 | string cmnd ="delete from MuteList where AgentID = ?AgentID and MuteID = ?MuteID and MuteName = ?MuteName"; | ||
54 | |||
55 | using (MySqlCommand cmd = new MySqlCommand(cmnd)) | ||
56 | { | ||
57 | cmd.Parameters.AddWithValue("?AgentID", agentID.ToString()); | ||
58 | cmd.Parameters.AddWithValue("?MuteID", muteID.ToString()); | ||
59 | cmd.Parameters.AddWithValue("?MuteName", muteName); | ||
60 | |||
61 | if (ExecuteNonQuery(cmd) > 0) | ||
62 | return true; | ||
63 | return false; | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/MySQL/MySQLOfflineIMData.cs b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs index bafd204..7608858 100644 --- a/OpenSim/Data/MySQL/MySQLOfflineIMData.cs +++ b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Data.MySQL | |||
50 | using (MySqlCommand cmd = new MySqlCommand()) | 50 | using (MySqlCommand cmd = new MySqlCommand()) |
51 | { | 51 | { |
52 | cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm); | 52 | cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm); |
53 | 53 | ||
54 | ExecuteNonQuery(cmd); | 54 | ExecuteNonQuery(cmd); |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 3f90639..b9114eb 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs | |||
@@ -52,8 +52,17 @@ namespace OpenSim.Data.MySQL | |||
52 | 52 | ||
53 | public PresenceData Get(UUID sessionID) | 53 | public PresenceData Get(UUID sessionID) |
54 | { | 54 | { |
55 | PresenceData[] ret = Get("SessionID", | 55 | PresenceData[] ret = Get("SessionID", sessionID.ToString()); |
56 | sessionID.ToString()); | 56 | |
57 | if (ret.Length == 0) | ||
58 | return null; | ||
59 | |||
60 | return ret[0]; | ||
61 | } | ||
62 | |||
63 | public PresenceData GetByUser(UUID userID) | ||
64 | { | ||
65 | PresenceData[] ret = Get("UserID", userID.ToString()); | ||
57 | 66 | ||
58 | if (ret.Length == 0) | 67 | if (ret.Length == 0) |
59 | return null; | 68 | return null; |
@@ -66,9 +75,9 @@ namespace OpenSim.Data.MySQL | |||
66 | using (MySqlCommand cmd = new MySqlCommand()) | 75 | using (MySqlCommand cmd = new MySqlCommand()) |
67 | { | 76 | { |
68 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); | 77 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); |
69 | 78 | ||
70 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 79 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
71 | 80 | ||
72 | ExecuteNonQuery(cmd); | 81 | ExecuteNonQuery(cmd); |
73 | } | 82 | } |
74 | } | 83 | } |
@@ -85,10 +94,10 @@ namespace OpenSim.Data.MySQL | |||
85 | using (MySqlCommand cmd = new MySqlCommand()) | 94 | using (MySqlCommand cmd = new MySqlCommand()) |
86 | { | 95 | { |
87 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); | 96 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); |
88 | 97 | ||
89 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); | 98 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); |
90 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 99 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
91 | 100 | ||
92 | if (ExecuteNonQuery(cmd) == 0) | 101 | if (ExecuteNonQuery(cmd) == 0) |
93 | return false; | 102 | return false; |
94 | } | 103 | } |
diff --git a/OpenSim/Data/MySQL/MySQLRaw.cs b/OpenSim/Data/MySQL/MySQLRaw.cs new file mode 100644 index 0000000..bb8c96c --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLRaw.cs | |||
@@ -0,0 +1,197 @@ | |||
1 | // https://dev.mysql.com/doc/connector-net/en/ | ||
2 | |||
3 | |||
4 | using System; | ||
5 | using System.Collections; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Data; | ||
8 | using System.Reflection; | ||
9 | using System.Text; | ||
10 | using log4net; | ||
11 | using MySql.Data.MySqlClient; | ||
12 | |||
13 | namespace OpenSim.Data.MySQL | ||
14 | { | ||
15 | public class MySQLRaw | ||
16 | { | ||
17 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
18 | private string m_connectString; | ||
19 | |||
20 | public MySQLRaw(string connect) | ||
21 | { | ||
22 | m_connectString = connect; | ||
23 | } | ||
24 | |||
25 | public int Count(string table) | ||
26 | { | ||
27 | return Count(table, ""); | ||
28 | } | ||
29 | public int Count(string table, string wher) | ||
30 | { | ||
31 | string query = "SELECT Count(*) FROM " + table; | ||
32 | if ("" != wher) | ||
33 | query = query + " WHERE " + wher; | ||
34 | int result = -1; | ||
35 | |||
36 | object r = doScalarQuery(query); | ||
37 | if (r != null) | ||
38 | result = Convert.ToInt32(r); | ||
39 | |||
40 | return result; | ||
41 | } | ||
42 | |||
43 | public List< Hashtable > Join(string table, string select, string join, string wher, string order) | ||
44 | { | ||
45 | if ("" == select) | ||
46 | select = "*"; | ||
47 | string query = "SELECT " + select + " FROM " + table; | ||
48 | if ("" != join) | ||
49 | query = query + " " + join; | ||
50 | if ("" != wher) | ||
51 | query = query + " WHERE " + wher; | ||
52 | if ("" != order) | ||
53 | query = query + " ORDER BY " + order; | ||
54 | |||
55 | using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) | ||
56 | { | ||
57 | dbcon.Open(); | ||
58 | MySqlCommand cmd = new MySqlCommand(query, dbcon); | ||
59 | MySqlDataReader rdr = cmd.ExecuteReader(); | ||
60 | List<string> names = new List<string>(); | ||
61 | DataTable schema = rdr.GetSchemaTable(); | ||
62 | List< Hashtable > list = new List< Hashtable >(); | ||
63 | |||
64 | foreach (DataRow row in schema.Rows) | ||
65 | { | ||
66 | string tbl = ""; | ||
67 | string nm = ""; | ||
68 | string tp = ""; | ||
69 | foreach (DataColumn col in schema.Columns) | ||
70 | { | ||
71 | if ("BaseTableName" == col.ColumnName) tbl = row[col].ToString(); | ||
72 | if ("ColumnName" == col.ColumnName) nm = row[col].ToString(); | ||
73 | if ("DataType" == col.ColumnName) tp = row[col].ToString(); | ||
74 | } | ||
75 | names.Add(nm); | ||
76 | } | ||
77 | |||
78 | while (rdr.Read()) | ||
79 | { | ||
80 | Hashtable r = new Hashtable(); | ||
81 | foreach (string name in names) | ||
82 | { | ||
83 | r[name] = rdr[name]; | ||
84 | } | ||
85 | list.Add(r); | ||
86 | } | ||
87 | |||
88 | rdr.Close(); | ||
89 | dbcon.Close(); | ||
90 | return list; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public List< Hashtable > Select(string table, string select, string wher, string order) | ||
95 | { | ||
96 | if ("" == select) | ||
97 | select = "*"; | ||
98 | string query = "SELECT " + select + " FROM " + table; | ||
99 | if ("" != wher) | ||
100 | query = query + " WHERE " + wher; | ||
101 | if ("" != order) | ||
102 | query = query + " ORDER BY " + order; | ||
103 | |||
104 | using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) | ||
105 | { | ||
106 | dbcon.Open(); | ||
107 | MySqlCommand cmd = new MySqlCommand(query, dbcon); | ||
108 | MySqlDataReader rdr = cmd.ExecuteReader(); | ||
109 | List<string> names = new List<string>(); | ||
110 | DataTable schema = rdr.GetSchemaTable(); | ||
111 | List< Hashtable > list = new List< Hashtable >(); | ||
112 | |||
113 | foreach (DataRow row in schema.Rows) | ||
114 | { | ||
115 | string tbl = ""; | ||
116 | string nm = ""; | ||
117 | string tp = ""; | ||
118 | foreach (DataColumn col in schema.Columns) | ||
119 | { | ||
120 | if ("BaseTableName" == col.ColumnName) tbl = row[col].ToString(); | ||
121 | if ("ColumnName" == col.ColumnName) nm = row[col].ToString(); | ||
122 | if ("DataType" == col.ColumnName) tp = row[col].ToString(); | ||
123 | } | ||
124 | names.Add(nm); | ||
125 | } | ||
126 | |||
127 | while (rdr.Read()) | ||
128 | { | ||
129 | Hashtable r = new Hashtable(); | ||
130 | foreach (string name in names) | ||
131 | { | ||
132 | r[name] = rdr[name]; | ||
133 | } | ||
134 | list.Add(r); | ||
135 | } | ||
136 | |||
137 | rdr.Close(); | ||
138 | dbcon.Close(); | ||
139 | return list; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | private object doScalarQuery(string query) | ||
144 | { | ||
145 | try | ||
146 | { | ||
147 | using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) | ||
148 | { | ||
149 | dbcon.Open(); | ||
150 | MySqlCommand cmd = new MySqlCommand(query, dbcon); | ||
151 | Object ret = cmd.ExecuteScalar(); | ||
152 | dbcon.Close(); | ||
153 | return ret; | ||
154 | } | ||
155 | } | ||
156 | catch (MySqlException e) | ||
157 | { | ||
158 | m_log.ErrorFormat("[MYSQL RAW]: Problem connecting to the database {0}", e.Message); | ||
159 | return null; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | private void doNonQuery(string query) | ||
164 | { | ||
165 | using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) | ||
166 | { | ||
167 | dbcon.Open(); | ||
168 | MySqlCommand cmd = new MySqlCommand(query, dbcon); | ||
169 | cmd.ExecuteNonQuery(); | ||
170 | dbcon.Close(); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | public void Insert(string table) | ||
175 | { | ||
176 | string query = "INSERT INTO " + table + " (name, age) VALUES('John Smith', '33')"; | ||
177 | doNonQuery(query); | ||
178 | } | ||
179 | |||
180 | public void Update(string table, string wher) | ||
181 | { | ||
182 | string query = "UPDATE " + table + " SET name='Joe', age='22'"; | ||
183 | if ("" != wher) | ||
184 | query = query + " WHERE " + wher; | ||
185 | doNonQuery(query); | ||
186 | } | ||
187 | |||
188 | public void Delete(string table, string wher) | ||
189 | { | ||
190 | string query = "DELETE FROM " + table; | ||
191 | if ("" != wher) | ||
192 | query = query + " WHERE " + wher; | ||
193 | doNonQuery(query); | ||
194 | } | ||
195 | |||
196 | } | ||
197 | } | ||
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 2ad7590..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 | ||
@@ -82,6 +83,7 @@ namespace OpenSim.Data.MySQL | |||
82 | 83 | ||
83 | public RegionData Get(int posX, int posY, UUID scopeID) | 84 | public RegionData Get(int posX, int posY, UUID scopeID) |
84 | { | 85 | { |
86 | /* fixed size regions | ||
85 | string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY"; | 87 | string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY"; |
86 | if (scopeID != UUID.Zero) | 88 | if (scopeID != UUID.Zero) |
87 | command += " and ScopeID = ?scopeID"; | 89 | command += " and ScopeID = ?scopeID"; |
@@ -98,6 +100,45 @@ namespace OpenSim.Data.MySQL | |||
98 | 100 | ||
99 | return ret[0]; | 101 | return ret[0]; |
100 | } | 102 | } |
103 | */ | ||
104 | // extend database search for maximum region size area | ||
105 | string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY"; | ||
106 | if (scopeID != UUID.Zero) | ||
107 | command += " and ScopeID = ?scopeID"; | ||
108 | |||
109 | int startX = posX - (int)Constants.MaximumRegionSize; | ||
110 | int startY = posY - (int)Constants.MaximumRegionSize; | ||
111 | int endX = posX; | ||
112 | int endY = posY; | ||
113 | |||
114 | List<RegionData> ret; | ||
115 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
116 | { | ||
117 | cmd.Parameters.AddWithValue("?startX", startX.ToString()); | ||
118 | cmd.Parameters.AddWithValue("?startY", startY.ToString()); | ||
119 | cmd.Parameters.AddWithValue("?endX", endX.ToString()); | ||
120 | cmd.Parameters.AddWithValue("?endY", endY.ToString()); | ||
121 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
122 | |||
123 | ret = RunCommand(cmd); | ||
124 | } | ||
125 | |||
126 | if (ret.Count == 0) | ||
127 | return null; | ||
128 | |||
129 | // find the first that contains pos | ||
130 | RegionData rg = null; | ||
131 | foreach (RegionData r in ret) | ||
132 | { | ||
133 | if (posX >= r.posX && posX < r.posX + r.sizeX | ||
134 | && posY >= r.posY && posY < r.posY + r.sizeY) | ||
135 | { | ||
136 | rg = r; | ||
137 | break; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | return rg; | ||
101 | } | 142 | } |
102 | 143 | ||
103 | public RegionData Get(UUID regionID, UUID scopeID) | 144 | public RegionData Get(UUID regionID, UUID scopeID) |
@@ -121,6 +162,7 @@ namespace OpenSim.Data.MySQL | |||
121 | 162 | ||
122 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) | 163 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) |
123 | { | 164 | { |
165 | /* fix size regions | ||
124 | string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; | 166 | string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; |
125 | if (scopeID != UUID.Zero) | 167 | if (scopeID != UUID.Zero) |
126 | command += " and ScopeID = ?scopeID"; | 168 | command += " and ScopeID = ?scopeID"; |
@@ -135,6 +177,38 @@ namespace OpenSim.Data.MySQL | |||
135 | 177 | ||
136 | return RunCommand(cmd); | 178 | return RunCommand(cmd); |
137 | } | 179 | } |
180 | */ | ||
181 | string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY"; | ||
182 | if (scopeID != UUID.Zero) | ||
183 | command += " and ScopeID = ?scopeID"; | ||
184 | |||
185 | int qstartX = startX - (int)Constants.MaximumRegionSize; | ||
186 | int qstartY = startY - (int)Constants.MaximumRegionSize; | ||
187 | |||
188 | List<RegionData> dbret; | ||
189 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
190 | { | ||
191 | cmd.Parameters.AddWithValue("?startX", qstartX.ToString()); | ||
192 | cmd.Parameters.AddWithValue("?startY", qstartY.ToString()); | ||
193 | cmd.Parameters.AddWithValue("?endX", endX.ToString()); | ||
194 | cmd.Parameters.AddWithValue("?endY", endY.ToString()); | ||
195 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
196 | |||
197 | dbret = RunCommand(cmd); | ||
198 | } | ||
199 | |||
200 | List<RegionData> ret = new List<RegionData>(); | ||
201 | |||
202 | if (dbret.Count == 0) | ||
203 | return ret; | ||
204 | |||
205 | foreach (RegionData r in dbret) | ||
206 | { | ||
207 | if (r.posX + r.sizeX > startX && r.posX <= endX | ||
208 | && r.posY + r.sizeY > startY && r.posY <= endY) | ||
209 | ret.Add(r); | ||
210 | } | ||
211 | return ret; | ||
138 | } | 212 | } |
139 | 213 | ||
140 | public List<RegionData> RunCommand(MySqlCommand cmd) | 214 | public List<RegionData> RunCommand(MySqlCommand cmd) |
@@ -187,6 +261,8 @@ namespace OpenSim.Data.MySQL | |||
187 | retList.Add(ret); | 261 | retList.Add(ret); |
188 | } | 262 | } |
189 | } | 263 | } |
264 | cmd.Connection = null; | ||
265 | dbcon.Close(); | ||
190 | } | 266 | } |
191 | 267 | ||
192 | return retList; | 268 | return retList; |
@@ -337,7 +413,7 @@ namespace OpenSim.Data.MySQL | |||
337 | using (MySqlCommand cmd = new MySqlCommand(command)) | 413 | using (MySqlCommand cmd = new MySqlCommand(command)) |
338 | { | 414 | { |
339 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 415 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
340 | 416 | ||
341 | return RunCommand(cmd); | 417 | return RunCommand(cmd); |
342 | } | 418 | } |
343 | } | 419 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index bb0ab75..e754522 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL | |||
55 | /// <summary> | 55 | /// <summary> |
56 | /// This lock was being used to serialize database operations when the connection was shared, but this has | 56 | /// This lock was being used to serialize database operations when the connection was shared, but this has |
57 | /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead. | 57 | /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead. |
58 | /// FIXME: However, the locks remain in many places since they are effectively providing a level of | 58 | /// FIXME: However, the locks remain in many places since they are effectively providing a level of |
59 | /// transactionality. This should be replaced by more efficient database transactions which would not require | 59 | /// transactionality. This should be replaced by more efficient database transactions which would not require |
60 | /// unrelated operations to block each other or unrelated operations on the same tables from blocking each | 60 | /// unrelated operations to block each other or unrelated operations on the same tables from blocking each |
61 | /// other. | 61 | /// other. |
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL | |||
76 | Initialise(connectionString); | 76 | Initialise(connectionString); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void Initialise(string connectionString) | 79 | public virtual void Initialise(string connectionString) |
80 | { | 80 | { |
81 | m_connectionString = connectionString; | 81 | m_connectionString = connectionString; |
82 | 82 | ||
@@ -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 | ||
@@ -123,7 +124,7 @@ namespace OpenSim.Data.MySQL | |||
123 | 124 | ||
124 | public void Dispose() {} | 125 | public void Dispose() {} |
125 | 126 | ||
126 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 127 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
127 | { | 128 | { |
128 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 129 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
129 | 130 | ||
@@ -167,7 +168,7 @@ namespace OpenSim.Data.MySQL | |||
167 | "SitTargetOrientY, SitTargetOrientZ, " + | 168 | "SitTargetOrientY, SitTargetOrientZ, " + |
168 | "RegionUUID, CreatorID, " + | 169 | "RegionUUID, CreatorID, " + |
169 | "OwnerID, GroupID, " + | 170 | "OwnerID, GroupID, " + |
170 | "LastOwnerID, SceneGroupID, " + | 171 | "LastOwnerID, RezzerID, SceneGroupID, " + |
171 | "PayPrice, PayButton1, " + | 172 | "PayPrice, PayButton1, " + |
172 | "PayButton2, PayButton3, " + | 173 | "PayButton2, PayButton3, " + |
173 | "PayButton4, LoopedSound, " + | 174 | "PayButton4, LoopedSound, " + |
@@ -183,10 +184,12 @@ namespace OpenSim.Data.MySQL | |||
183 | "ParticleSystem, ClickAction, Material, " + | 184 | "ParticleSystem, ClickAction, Material, " + |
184 | "CollisionSound, CollisionSoundVolume, " + | 185 | "CollisionSound, CollisionSoundVolume, " + |
185 | "PassTouches, " + | 186 | "PassTouches, " + |
186 | "LinkNumber, MediaURL, AttachedPosX, " + | 187 | "PassCollisions, " + |
187 | "AttachedPosY, AttachedPosZ, KeyframeMotion, " + | 188 | "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " + |
189 | "AttachedPosY, AttachedPosZ, " + | ||
188 | "PhysicsShapeType, Density, GravityModifier, " + | 190 | "PhysicsShapeType, Density, GravityModifier, " + |
189 | "Friction, Restitution, DynAttrs " + | 191 | "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " + |
192 | "RotationAxisLocks" + | ||
190 | ") values (" + "?UUID, " + | 193 | ") values (" + "?UUID, " + |
191 | "?CreationDate, ?Name, ?Text, " + | 194 | "?CreationDate, ?Name, ?Text, " + |
192 | "?Description, ?SitName, ?TouchName, " + | 195 | "?Description, ?SitName, ?TouchName, " + |
@@ -205,7 +208,7 @@ namespace OpenSim.Data.MySQL | |||
205 | "?SitTargetOrientW, ?SitTargetOrientX, " + | 208 | "?SitTargetOrientW, ?SitTargetOrientX, " + |
206 | "?SitTargetOrientY, ?SitTargetOrientZ, " + | 209 | "?SitTargetOrientY, ?SitTargetOrientZ, " + |
207 | "?RegionUUID, ?CreatorID, ?OwnerID, " + | 210 | "?RegionUUID, ?CreatorID, ?OwnerID, " + |
208 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + | 211 | "?GroupID, ?LastOwnerID, ?RezzerID, ?SceneGroupID, " + |
209 | "?PayPrice, ?PayButton1, ?PayButton2, " + | 212 | "?PayPrice, ?PayButton1, ?PayButton2, " + |
210 | "?PayButton3, ?PayButton4, ?LoopedSound, " + | 213 | "?PayButton3, ?PayButton4, ?LoopedSound, " + |
211 | "?LoopedSoundGain, ?TextureAnimation, " + | 214 | "?LoopedSoundGain, ?TextureAnimation, " + |
@@ -218,11 +221,12 @@ namespace OpenSim.Data.MySQL | |||
218 | "?SaleType, ?ColorR, ?ColorG, " + | 221 | "?SaleType, ?ColorR, ?ColorG, " + |
219 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 222 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
220 | "?ClickAction, ?Material, ?CollisionSound, " + | 223 | "?ClickAction, ?Material, ?CollisionSound, " + |
221 | "?CollisionSoundVolume, ?PassTouches, " + | 224 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
222 | "?LinkNumber, ?MediaURL, ?AttachedPosX, " + | 225 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " + |
223 | "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + | 226 | "?AttachedPosY, ?AttachedPosZ, " + |
224 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 227 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
225 | "?Friction, ?Restitution, ?DynAttrs)"; | 228 | "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," + |
229 | "?RotationAxisLocks)"; | ||
226 | 230 | ||
227 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 231 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
228 | 232 | ||
@@ -258,14 +262,15 @@ namespace OpenSim.Data.MySQL | |||
258 | ExecuteNonQuery(cmd); | 262 | ExecuteNonQuery(cmd); |
259 | } | 263 | } |
260 | } | 264 | } |
265 | dbcon.Close(); | ||
261 | } | 266 | } |
262 | } | 267 | } |
263 | } | 268 | } |
264 | 269 | ||
265 | public void RemoveObject(UUID obj, UUID regionUUID) | 270 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
266 | { | 271 | { |
267 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 272 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
268 | 273 | ||
269 | List<UUID> uuids = new List<UUID>(); | 274 | List<UUID> uuids = new List<UUID>(); |
270 | 275 | ||
271 | // Formerly, this used to check the region UUID. | 276 | // Formerly, this used to check the region UUID. |
@@ -297,6 +302,7 @@ namespace OpenSim.Data.MySQL | |||
297 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; | 302 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; |
298 | ExecuteNonQuery(cmd); | 303 | ExecuteNonQuery(cmd); |
299 | } | 304 | } |
305 | dbcon.Close(); | ||
300 | } | 306 | } |
301 | } | 307 | } |
302 | 308 | ||
@@ -317,7 +323,8 @@ namespace OpenSim.Data.MySQL | |||
317 | /// <param name="uuid">the Item UUID</param> | 323 | /// <param name="uuid">the Item UUID</param> |
318 | private void RemoveItems(UUID uuid) | 324 | private void RemoveItems(UUID uuid) |
319 | { | 325 | { |
320 | lock (m_dbLock) | 326 | // locked by caller |
327 | // lock (m_dbLock) | ||
321 | { | 328 | { |
322 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 329 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
323 | { | 330 | { |
@@ -330,6 +337,7 @@ namespace OpenSim.Data.MySQL | |||
330 | 337 | ||
331 | ExecuteNonQuery(cmd); | 338 | ExecuteNonQuery(cmd); |
332 | } | 339 | } |
340 | dbcon.Close(); | ||
333 | } | 341 | } |
334 | } | 342 | } |
335 | } | 343 | } |
@@ -368,6 +376,7 @@ namespace OpenSim.Data.MySQL | |||
368 | 376 | ||
369 | ExecuteNonQuery(cmd); | 377 | ExecuteNonQuery(cmd); |
370 | } | 378 | } |
379 | dbcon.Close(); | ||
371 | } | 380 | } |
372 | } | 381 | } |
373 | } | 382 | } |
@@ -407,11 +416,12 @@ namespace OpenSim.Data.MySQL | |||
407 | 416 | ||
408 | ExecuteNonQuery(cmd); | 417 | ExecuteNonQuery(cmd); |
409 | } | 418 | } |
419 | dbcon.Close(); | ||
410 | } | 420 | } |
411 | } | 421 | } |
412 | } | 422 | } |
413 | 423 | ||
414 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 424 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
415 | { | 425 | { |
416 | const int ROWS_PER_QUERY = 5000; | 426 | const int ROWS_PER_QUERY = 5000; |
417 | 427 | ||
@@ -456,6 +466,7 @@ namespace OpenSim.Data.MySQL | |||
456 | } | 466 | } |
457 | } | 467 | } |
458 | } | 468 | } |
469 | dbcon.Close(); | ||
459 | } | 470 | } |
460 | } | 471 | } |
461 | 472 | ||
@@ -505,7 +516,7 @@ namespace OpenSim.Data.MySQL | |||
505 | #region Prim Inventory Loading | 516 | #region Prim Inventory Loading |
506 | 517 | ||
507 | // Instead of attempting to LoadItems on every prim, | 518 | // Instead of attempting to LoadItems on every prim, |
508 | // most of which probably have no items... get a | 519 | // most of which probably have no items... get a |
509 | // list from DB of all prims which have items and | 520 | // list from DB of all prims which have items and |
510 | // LoadItems only on those | 521 | // LoadItems only on those |
511 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); | 522 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); |
@@ -531,6 +542,7 @@ namespace OpenSim.Data.MySQL | |||
531 | } | 542 | } |
532 | } | 543 | } |
533 | } | 544 | } |
545 | dbcon.Close(); | ||
534 | } | 546 | } |
535 | } | 547 | } |
536 | 548 | ||
@@ -576,6 +588,7 @@ namespace OpenSim.Data.MySQL | |||
576 | } | 588 | } |
577 | } | 589 | } |
578 | } | 590 | } |
591 | dbcon.Close(); | ||
579 | } | 592 | } |
580 | 593 | ||
581 | prim.Inventory.RestoreInventoryItems(inventory); | 594 | prim.Inventory.RestoreInventoryItems(inventory); |
@@ -590,40 +603,102 @@ namespace OpenSim.Data.MySQL | |||
590 | 603 | ||
591 | public void StoreTerrain(TerrainData terrData, UUID regionID) | 604 | public void StoreTerrain(TerrainData terrData, UUID regionID) |
592 | { | 605 | { |
593 | lock (m_dbLock) | 606 | Util.FireAndForget(delegate(object x) |
594 | { | 607 | { |
595 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 608 | m_log.Info("[REGION DB]: Storing terrain"); |
596 | { | ||
597 | dbcon.Open(); | ||
598 | 609 | ||
599 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 610 | int terrainDBRevision; |
611 | Array terrainDBblob; | ||
612 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
613 | |||
614 | lock (m_dbLock) | ||
615 | { | ||
616 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
600 | { | 617 | { |
601 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 618 | dbcon.Open(); |
602 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
603 | 619 | ||
604 | ExecuteNonQuery(cmd); | 620 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
621 | { | ||
622 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
623 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
605 | 624 | ||
606 | int terrainDBRevision; | 625 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
607 | Array terrainDBblob; | 626 | { |
608 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | 627 | try |
628 | { | ||
629 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
630 | "Revision, Heightfield) values (?RegionUUID, " + | ||
631 | "?Revision, ?Heightfield)"; | ||
609 | 632 | ||
610 | m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", | 633 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
611 | LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); | 634 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); |
635 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
612 | 636 | ||
613 | cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" | 637 | ExecuteNonQuery(cmd); |
614 | + "values (?RegionUUID, ?Revision, ?Heightfield)"; | 638 | ExecuteNonQuery(cmd2); |
639 | } | ||
640 | catch (Exception e) | ||
641 | { | ||
642 | m_log.ErrorFormat(e.ToString()); | ||
643 | } | ||
644 | } | ||
645 | } | ||
646 | dbcon.Close(); | ||
647 | } | ||
648 | } | ||
649 | }); | ||
650 | } | ||
615 | 651 | ||
616 | cmd.Parameters.AddWithValue("Revision", terrainDBRevision); | 652 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) |
617 | cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); | 653 | { |
654 | Util.FireAndForget(delegate(object x) | ||
655 | { | ||
656 | m_log.Info("[REGION DB]: Storing Baked terrain"); | ||
618 | 657 | ||
619 | ExecuteNonQuery(cmd); | 658 | int terrainDBRevision; |
659 | Array terrainDBblob; | ||
660 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
661 | |||
662 | lock (m_dbLock) | ||
663 | { | ||
664 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
665 | { | ||
666 | dbcon.Open(); | ||
667 | |||
668 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
669 | { | ||
670 | cmd.CommandText = "delete from bakedterrain where RegionUUID = ?RegionUUID"; | ||
671 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
672 | |||
673 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) | ||
674 | { | ||
675 | try | ||
676 | { | ||
677 | cmd2.CommandText = "insert into bakedterrain (RegionUUID, " + | ||
678 | "Revision, Heightfield) values (?RegionUUID, " + | ||
679 | "?Revision, ?Heightfield)"; | ||
680 | |||
681 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
682 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); | ||
683 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
684 | |||
685 | ExecuteNonQuery(cmd); | ||
686 | ExecuteNonQuery(cmd2); | ||
687 | } | ||
688 | catch (Exception e) | ||
689 | { | ||
690 | m_log.ErrorFormat(e.ToString()); | ||
691 | } | ||
692 | } | ||
693 | } | ||
694 | dbcon.Close(); | ||
620 | } | 695 | } |
621 | } | 696 | } |
622 | } | 697 | }); |
623 | } | 698 | } |
624 | 699 | ||
625 | // Legacy region loading | 700 | // Legacy region loading |
626 | public double[,] LoadTerrain(UUID regionID) | 701 | public virtual double[,] LoadTerrain(UUID regionID) |
627 | { | 702 | { |
628 | double[,] ret = null; | 703 | double[,] ret = null; |
629 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | 704 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); |
@@ -636,9 +711,12 @@ namespace OpenSim.Data.MySQL | |||
636 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | 711 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) |
637 | { | 712 | { |
638 | TerrainData terrData = null; | 713 | TerrainData terrData = null; |
714 | byte[] blob = null; | ||
715 | int rev = 0; | ||
639 | 716 | ||
640 | lock (m_dbLock) | 717 | lock (m_dbLock) |
641 | { | 718 | { |
719 | |||
642 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 720 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
643 | { | 721 | { |
644 | dbcon.Open(); | 722 | dbcon.Open(); |
@@ -654,19 +732,64 @@ namespace OpenSim.Data.MySQL | |||
654 | { | 732 | { |
655 | while (reader.Read()) | 733 | while (reader.Read()) |
656 | { | 734 | { |
657 | int rev = Convert.ToInt32(reader["Revision"]); | 735 | rev = Convert.ToInt32(reader["Revision"]); |
658 | byte[] blob = (byte[])reader["Heightfield"]; | 736 | if ((reader["Heightfield"] != DBNull.Value)) |
659 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | 737 | { |
738 | blob = (byte[])reader["Heightfield"]; | ||
739 | } | ||
740 | } | ||
741 | } | ||
742 | } | ||
743 | dbcon.Close(); | ||
744 | } | ||
745 | } | ||
746 | |||
747 | if(blob != null) | ||
748 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
749 | |||
750 | return terrData; | ||
751 | } | ||
752 | |||
753 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
754 | { | ||
755 | TerrainData terrData = null; | ||
756 | byte[] blob = null; | ||
757 | int rev = 0; | ||
758 | |||
759 | lock (m_dbLock) | ||
760 | { | ||
761 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
762 | { | ||
763 | dbcon.Open(); | ||
764 | |||
765 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
766 | { | ||
767 | cmd.CommandText = "select RegionUUID, Revision, Heightfield " + | ||
768 | "from bakedterrain where RegionUUID = ?RegionUUID "; | ||
769 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
770 | |||
771 | using (IDataReader reader = ExecuteReader(cmd)) | ||
772 | { | ||
773 | while (reader.Read()) | ||
774 | { | ||
775 | rev = Convert.ToInt32(reader["Revision"]); | ||
776 | if ((reader["Heightfield"] != DBNull.Value)) | ||
777 | { | ||
778 | blob = (byte[])reader["Heightfield"]; | ||
779 | } | ||
660 | } | 780 | } |
661 | } | 781 | } |
662 | } | 782 | } |
783 | dbcon.Close(); | ||
663 | } | 784 | } |
664 | } | 785 | } |
786 | if(blob != null) | ||
787 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
665 | 788 | ||
666 | return terrData; | 789 | return terrData; |
667 | } | 790 | } |
668 | 791 | ||
669 | public void RemoveLandObject(UUID globalID) | 792 | public virtual void RemoveLandObject(UUID globalID) |
670 | { | 793 | { |
671 | lock (m_dbLock) | 794 | lock (m_dbLock) |
672 | { | 795 | { |
@@ -681,11 +804,12 @@ namespace OpenSim.Data.MySQL | |||
681 | 804 | ||
682 | ExecuteNonQuery(cmd); | 805 | ExecuteNonQuery(cmd); |
683 | } | 806 | } |
807 | dbcon.Close(); | ||
684 | } | 808 | } |
685 | } | 809 | } |
686 | } | 810 | } |
687 | 811 | ||
688 | public void StoreLandObject(ILandObject parcel) | 812 | public virtual void StoreLandObject(ILandObject parcel) |
689 | { | 813 | { |
690 | lock (m_dbLock) | 814 | lock (m_dbLock) |
691 | { | 815 | { |
@@ -705,7 +829,8 @@ namespace OpenSim.Data.MySQL | |||
705 | "UserLocationX, UserLocationY, UserLocationZ, " + | 829 | "UserLocationX, UserLocationY, UserLocationZ, " + |
706 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + | 830 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + |
707 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + | 831 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + |
708 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + | 832 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " + |
833 | "SeeAVs, AnyAVSounds, GroupAVSounds) values (" + | ||
709 | "?UUID, ?RegionUUID, " + | 834 | "?UUID, ?RegionUUID, " + |
710 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + | 835 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + |
711 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + | 836 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + |
@@ -716,7 +841,8 @@ namespace OpenSim.Data.MySQL | |||
716 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + | 841 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + |
717 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + | 842 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + |
718 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ | 843 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ |
719 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; | 844 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " + |
845 | "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)"; | ||
720 | 846 | ||
721 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); | 847 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); |
722 | 848 | ||
@@ -738,11 +864,12 @@ namespace OpenSim.Data.MySQL | |||
738 | cmd.Parameters.Clear(); | 864 | cmd.Parameters.Clear(); |
739 | } | 865 | } |
740 | } | 866 | } |
867 | dbcon.Close(); | ||
741 | } | 868 | } |
742 | } | 869 | } |
743 | } | 870 | } |
744 | 871 | ||
745 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 872 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
746 | { | 873 | { |
747 | RegionLightShareData nWP = new RegionLightShareData(); | 874 | RegionLightShareData nWP = new RegionLightShareData(); |
748 | nWP.OnSave += StoreRegionWindlightSettings; | 875 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -759,90 +886,94 @@ namespace OpenSim.Data.MySQL | |||
759 | 886 | ||
760 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | 887 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
761 | 888 | ||
762 | IDataReader result = ExecuteReader(cmd); | 889 | using(IDataReader result = ExecuteReader(cmd)) |
763 | if (!result.Read()) | ||
764 | { | 890 | { |
765 | //No result, so store our default windlight profile and return it | 891 | if(!result.Read()) |
766 | nWP.regionID = regionUUID; | 892 | { |
767 | // StoreRegionWindlightSettings(nWP); | 893 | //No result, so store our default windlight profile and return it |
768 | return nWP; | 894 | nWP.regionID = regionUUID; |
769 | } | 895 | // StoreRegionWindlightSettings(nWP); |
770 | else | 896 | return nWP; |
771 | { | 897 | } |
772 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | 898 | else |
773 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 899 | { |
774 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 900 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
775 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 901 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
776 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 902 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
777 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 903 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
778 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 904 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
779 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 905 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
780 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 906 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
781 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 907 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
782 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 908 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
783 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 909 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
784 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 910 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
785 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 911 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
786 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 912 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
787 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 913 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
788 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 914 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
789 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 915 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
790 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 916 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
791 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 917 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
792 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 918 | UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture); |
793 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 919 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
794 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 920 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
795 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 921 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
796 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 922 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
797 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 923 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
798 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 924 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
799 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 925 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
800 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 926 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
801 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 927 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
802 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 928 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
803 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 929 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
804 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 930 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
805 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 931 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
806 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 932 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
807 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 933 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
808 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 934 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
809 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 935 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
810 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 936 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
811 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 937 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
812 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 938 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
813 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 939 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
814 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 940 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
815 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 941 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
816 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 942 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
817 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 943 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
818 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 944 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
819 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 945 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
820 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 946 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
821 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 947 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
822 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 948 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
823 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 949 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
824 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 950 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); |
825 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 951 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); |
826 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 952 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); |
827 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 953 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); |
828 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 954 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); |
829 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 955 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); |
830 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 956 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); |
831 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 957 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); |
832 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 958 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); |
833 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 959 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); |
834 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 960 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); |
835 | nWP.valid = true; | 961 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); |
962 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
963 | nWP.valid = true; | ||
964 | } | ||
836 | } | 965 | } |
837 | } | 966 | } |
967 | dbcon.Close(); | ||
838 | } | 968 | } |
839 | 969 | ||
840 | return nWP; | 970 | return nWP; |
841 | } | 971 | } |
842 | 972 | ||
843 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 973 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
844 | { | 974 | { |
845 | RegionSettings rs = null; | 975 | RegionSettings rs = null; |
976 | bool needStore = false; | ||
846 | 977 | ||
847 | lock (m_dbLock) | 978 | lock (m_dbLock) |
848 | { | 979 | { |
@@ -868,19 +999,23 @@ namespace OpenSim.Data.MySQL | |||
868 | rs.RegionUUID = regionUUID; | 999 | rs.RegionUUID = regionUUID; |
869 | rs.OnSave += StoreRegionSettings; | 1000 | rs.OnSave += StoreRegionSettings; |
870 | 1001 | ||
871 | StoreRegionSettings(rs); | 1002 | needStore = true; |
872 | } | 1003 | } |
873 | } | 1004 | } |
874 | } | 1005 | } |
1006 | dbcon.Close(); | ||
875 | } | 1007 | } |
876 | } | 1008 | } |
877 | 1009 | ||
1010 | if(needStore) | ||
1011 | StoreRegionSettings(rs); | ||
1012 | |||
878 | LoadSpawnPoints(rs); | 1013 | LoadSpawnPoints(rs); |
879 | 1014 | ||
880 | return rs; | 1015 | return rs; |
881 | } | 1016 | } |
882 | 1017 | ||
883 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 1018 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
884 | { | 1019 | { |
885 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1020 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
886 | { | 1021 | { |
@@ -888,31 +1023,32 @@ namespace OpenSim.Data.MySQL | |||
888 | 1023 | ||
889 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1024 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
890 | { | 1025 | { |
891 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 1026 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, " |
892 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 1027 | + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, " |
893 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; | 1028 | + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, " |
894 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; | 1029 | + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, " |
895 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; | 1030 | + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, " |
896 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; | 1031 | + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, " |
897 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; | 1032 | + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, " |
898 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; | 1033 | + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, " |
899 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; | 1034 | + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, " |
900 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; | 1035 | + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, " |
901 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; | 1036 | + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, " |
902 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; | 1037 | + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, " |
903 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; | 1038 | + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, " |
904 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; | 1039 | + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, " |
905 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; | 1040 | + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, " |
906 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; | 1041 | + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, " |
907 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; | 1042 | + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, " |
908 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; | 1043 | + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, " |
909 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; | 1044 | + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, " |
910 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; | 1045 | + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, " |
911 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; | 1046 | + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, " |
912 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 1047 | + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, " |
913 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; | 1048 | + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, " |
914 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; | 1049 | + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, " |
915 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 1050 | + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)" |
1051 | ; | ||
916 | 1052 | ||
917 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 1053 | cmd.Parameters.AddWithValue("region_id", wl.regionID); |
918 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 1054 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); |
@@ -977,13 +1113,14 @@ namespace OpenSim.Data.MySQL | |||
977 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | 1113 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); |
978 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | 1114 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); |
979 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | 1115 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); |
980 | 1116 | ||
981 | ExecuteNonQuery(cmd); | 1117 | ExecuteNonQuery(cmd); |
982 | } | 1118 | } |
1119 | dbcon.Close(); | ||
983 | } | 1120 | } |
984 | } | 1121 | } |
985 | 1122 | ||
986 | public void RemoveRegionWindlightSettings(UUID regionID) | 1123 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
987 | { | 1124 | { |
988 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1125 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
989 | { | 1126 | { |
@@ -995,6 +1132,7 @@ namespace OpenSim.Data.MySQL | |||
995 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | 1132 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); |
996 | ExecuteNonQuery(cmd); | 1133 | ExecuteNonQuery(cmd); |
997 | } | 1134 | } |
1135 | dbcon.Close(); | ||
998 | } | 1136 | } |
999 | } | 1137 | } |
1000 | 1138 | ||
@@ -1013,14 +1151,19 @@ namespace OpenSim.Data.MySQL | |||
1013 | 1151 | ||
1014 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1152 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1015 | 1153 | ||
1016 | IDataReader result = ExecuteReader(cmd); | 1154 | using(IDataReader result = ExecuteReader(cmd)) |
1017 | if (!result.Read()) | ||
1018 | { | 1155 | { |
1019 | return String.Empty; | 1156 | if(!result.Read()) |
1020 | } | 1157 | { |
1021 | else | 1158 | dbcon.Close(); |
1022 | { | 1159 | return String.Empty; |
1023 | return Convert.ToString(result["llsd_settings"]); | 1160 | } |
1161 | else | ||
1162 | { | ||
1163 | string ret = Convert.ToString(result["llsd_settings"]); | ||
1164 | dbcon.Close(); | ||
1165 | return ret; | ||
1166 | } | ||
1024 | } | 1167 | } |
1025 | } | 1168 | } |
1026 | } | 1169 | } |
@@ -1041,6 +1184,7 @@ namespace OpenSim.Data.MySQL | |||
1041 | 1184 | ||
1042 | ExecuteNonQuery(cmd); | 1185 | ExecuteNonQuery(cmd); |
1043 | } | 1186 | } |
1187 | dbcon.Close(); | ||
1044 | } | 1188 | } |
1045 | } | 1189 | } |
1046 | 1190 | ||
@@ -1056,11 +1200,12 @@ namespace OpenSim.Data.MySQL | |||
1056 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1200 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1057 | ExecuteNonQuery(cmd); | 1201 | ExecuteNonQuery(cmd); |
1058 | } | 1202 | } |
1203 | dbcon.Close(); | ||
1059 | } | 1204 | } |
1060 | } | 1205 | } |
1061 | #endregion | 1206 | #endregion |
1062 | 1207 | ||
1063 | public void StoreRegionSettings(RegionSettings rs) | 1208 | public virtual void StoreRegionSettings(RegionSettings rs) |
1064 | { | 1209 | { |
1065 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1210 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1066 | { | 1211 | { |
@@ -1069,52 +1214,51 @@ namespace OpenSim.Data.MySQL | |||
1069 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1214 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1070 | { | 1215 | { |
1071 | cmd.CommandText = "replace into regionsettings (regionUUID, " + | 1216 | cmd.CommandText = "replace into regionsettings (regionUUID, " + |
1072 | "block_terraform, block_fly, allow_damage, " + | 1217 | "block_terraform, block_fly, allow_damage, " + |
1073 | "restrict_pushing, allow_land_resell, " + | 1218 | "restrict_pushing, allow_land_resell, " + |
1074 | "allow_land_join_divide, block_show_in_search, " + | 1219 | "allow_land_join_divide, block_show_in_search, " + |
1075 | "agent_limit, object_bonus, maturity, " + | 1220 | "agent_limit, object_bonus, maturity, " + |
1076 | "disable_scripts, disable_collisions, " + | 1221 | "disable_scripts, disable_collisions, " + |
1077 | "disable_physics, terrain_texture_1, " + | 1222 | "disable_physics, terrain_texture_1, " + |
1078 | "terrain_texture_2, terrain_texture_3, " + | 1223 | "terrain_texture_2, terrain_texture_3, " + |
1079 | "terrain_texture_4, elevation_1_nw, " + | 1224 | "terrain_texture_4, elevation_1_nw, " + |
1080 | "elevation_2_nw, elevation_1_ne, " + | 1225 | "elevation_2_nw, elevation_1_ne, " + |
1081 | "elevation_2_ne, elevation_1_se, " + | 1226 | "elevation_2_ne, elevation_1_se, " + |
1082 | "elevation_2_se, elevation_1_sw, " + | 1227 | "elevation_2_se, elevation_1_sw, " + |
1083 | "elevation_2_sw, water_height, " + | 1228 | "elevation_2_sw, water_height, " + |
1084 | "terrain_raise_limit, terrain_lower_limit, " + | 1229 | "terrain_raise_limit, terrain_lower_limit, " + |
1085 | "use_estate_sun, fixed_sun, sun_position, " + | 1230 | "use_estate_sun, fixed_sun, sun_position, " + |
1086 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1231 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1087 | "sunvectorz, loaded_creation_datetime, " + | 1232 | "sunvectorz, loaded_creation_datetime, " + |
1088 | "loaded_creation_id, map_tile_ID, " + | 1233 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1089 | "TelehubObject, parcel_tile_ID) " + | 1234 | "TelehubObject, parcel_tile_ID) " + |
1090 | "values (?RegionUUID, ?BlockTerraform, " + | 1235 | "values (?RegionUUID, ?BlockTerraform, " + |
1091 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1236 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
1092 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 1237 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
1093 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 1238 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
1094 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + | 1239 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + |
1095 | "?DisablePhysics, ?TerrainTexture1, " + | 1240 | "?DisablePhysics, ?TerrainTexture1, " + |
1096 | "?TerrainTexture2, ?TerrainTexture3, " + | 1241 | "?TerrainTexture2, ?TerrainTexture3, " + |
1097 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + | 1242 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + |
1098 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + | 1243 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + |
1099 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + | 1244 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + |
1100 | "?WaterHeight, ?TerrainRaiseLimit, " + | 1245 | "?WaterHeight, ?TerrainRaiseLimit, " + |
1101 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + | 1246 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + |
1102 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1247 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1103 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1248 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1104 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1249 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1105 | "?TerrainImageID, " + | 1250 | "?TerrainImageID, ?block_search, ?casino, " + |
1106 | "?TelehubObject, ?ParcelImageID)"; | 1251 | "?TelehubObject, ?ParcelImageID)"; |
1107 | 1252 | ||
1108 | FillRegionSettingsCommand(cmd, rs); | 1253 | FillRegionSettingsCommand(cmd, rs); |
1109 | |||
1110 | ExecuteNonQuery(cmd); | 1254 | ExecuteNonQuery(cmd); |
1111 | } | 1255 | } |
1256 | dbcon.Close(); | ||
1257 | SaveSpawnPoints(rs); | ||
1112 | } | 1258 | } |
1113 | |||
1114 | SaveSpawnPoints(rs); | ||
1115 | } | 1259 | } |
1116 | 1260 | ||
1117 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1261 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1118 | { | 1262 | { |
1119 | List<LandData> landData = new List<LandData>(); | 1263 | List<LandData> landData = new List<LandData>(); |
1120 | 1264 | ||
@@ -1156,6 +1300,7 @@ namespace OpenSim.Data.MySQL | |||
1156 | } | 1300 | } |
1157 | } | 1301 | } |
1158 | } | 1302 | } |
1303 | dbcon.Close(); | ||
1159 | } | 1304 | } |
1160 | } | 1305 | } |
1161 | 1306 | ||
@@ -1170,12 +1315,16 @@ namespace OpenSim.Data.MySQL | |||
1170 | { | 1315 | { |
1171 | SceneObjectPart prim = new SceneObjectPart(); | 1316 | SceneObjectPart prim = new SceneObjectPart(); |
1172 | 1317 | ||
1173 | // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! | 1318 | // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! |
1174 | prim.UUID = DBGuid.FromDB(row["UUID"]); | 1319 | prim.UUID = DBGuid.FromDB(row["UUID"]); |
1175 | prim.CreatorIdentification = (string)row["CreatorID"]; | 1320 | prim.CreatorIdentification = (string)row["CreatorID"]; |
1176 | prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); | 1321 | prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); |
1177 | prim.GroupID = DBGuid.FromDB(row["GroupID"]); | 1322 | prim.GroupID = DBGuid.FromDB(row["GroupID"]); |
1178 | prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); | 1323 | prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); |
1324 | if (row["RezzerID"] != DBNull.Value) | ||
1325 | prim.RezzerID = DBGuid.FromDB(row["RezzerID"]); | ||
1326 | else | ||
1327 | prim.RezzerID = UUID.Zero; | ||
1179 | 1328 | ||
1180 | // explicit conversion of integers is required, which sort | 1329 | // explicit conversion of integers is required, which sort |
1181 | // of sucks. No idea if there is a shortcut here or not. | 1330 | // of sucks. No idea if there is a shortcut here or not. |
@@ -1294,10 +1443,11 @@ namespace OpenSim.Data.MySQL | |||
1294 | 1443 | ||
1295 | prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); | 1444 | prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); |
1296 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1445 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1297 | 1446 | ||
1298 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1447 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1448 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1299 | prim.LinkNum = (int)row["LinkNumber"]; | 1449 | prim.LinkNum = (int)row["LinkNumber"]; |
1300 | 1450 | ||
1301 | if (!(row["MediaURL"] is System.DBNull)) | 1451 | if (!(row["MediaURL"] is System.DBNull)) |
1302 | prim.MediaUrl = (string)row["MediaURL"]; | 1452 | prim.MediaUrl = (string)row["MediaURL"]; |
1303 | 1453 | ||
@@ -1313,7 +1463,7 @@ namespace OpenSim.Data.MySQL | |||
1313 | if (!(row["DynAttrs"] is System.DBNull)) | 1463 | if (!(row["DynAttrs"] is System.DBNull)) |
1314 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); | 1464 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); |
1315 | else | 1465 | else |
1316 | prim.DynAttrs = new DAMap(); | 1466 | prim.DynAttrs = new DAMap(); |
1317 | 1467 | ||
1318 | if (!(row["KeyframeMotion"] is DBNull)) | 1468 | if (!(row["KeyframeMotion"] is DBNull)) |
1319 | { | 1469 | { |
@@ -1333,7 +1483,22 @@ namespace OpenSim.Data.MySQL | |||
1333 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | 1483 | prim.GravityModifier = (float)(double)row["GravityModifier"]; |
1334 | prim.Friction = (float)(double)row["Friction"]; | 1484 | prim.Friction = (float)(double)row["Friction"]; |
1335 | prim.Restitution = (float)(double)row["Restitution"]; | 1485 | prim.Restitution = (float)(double)row["Restitution"]; |
1336 | 1486 | prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString()); | |
1487 | |||
1488 | SOPVehicle vehicle = null; | ||
1489 | |||
1490 | if (row["Vehicle"].ToString() != String.Empty) | ||
1491 | { | ||
1492 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1493 | if (vehicle != null) | ||
1494 | prim.VehicleParams = vehicle; | ||
1495 | } | ||
1496 | |||
1497 | PhysicsInertiaData pdata = null; | ||
1498 | if (row["PhysInertia"].ToString() != String.Empty) | ||
1499 | pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString()); | ||
1500 | prim.PhysicsInertia = pdata; | ||
1501 | |||
1337 | return prim; | 1502 | return prim; |
1338 | } | 1503 | } |
1339 | 1504 | ||
@@ -1344,32 +1509,40 @@ namespace OpenSim.Data.MySQL | |||
1344 | /// <returns></returns> | 1509 | /// <returns></returns> |
1345 | private static TaskInventoryItem BuildItem(IDataReader row) | 1510 | private static TaskInventoryItem BuildItem(IDataReader row) |
1346 | { | 1511 | { |
1347 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1512 | try |
1348 | 1513 | { | |
1349 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1514 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1350 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1515 | |
1351 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1516 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1352 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1517 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1353 | 1518 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1354 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1519 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1355 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1520 | |
1356 | 1521 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1357 | taskItem.Name = (String)row["name"]; | 1522 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1358 | taskItem.Description = (String)row["description"]; | 1523 | |
1359 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1524 | taskItem.Name = (String)row["name"]; |
1360 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1525 | taskItem.Description = (String)row["description"]; |
1361 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1526 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1362 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1527 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1363 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1528 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1364 | 1529 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1365 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1530 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1366 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1531 | |
1367 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1532 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1368 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1533 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1369 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1534 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1370 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1535 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1371 | 1536 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1372 | return taskItem; | 1537 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1538 | |||
1539 | return taskItem; | ||
1540 | } | ||
1541 | catch | ||
1542 | { | ||
1543 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1544 | throw; | ||
1545 | } | ||
1373 | } | 1546 | } |
1374 | 1547 | ||
1375 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1548 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1417,16 +1590,19 @@ namespace OpenSim.Data.MySQL | |||
1417 | newSettings.Covenant = DBGuid.FromDB(row["covenant"]); | 1590 | newSettings.Covenant = DBGuid.FromDB(row["covenant"]); |
1418 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); | 1591 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); |
1419 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); | 1592 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); |
1420 | 1593 | ||
1421 | if (row["loaded_creation_id"] is DBNull) | 1594 | if (row["loaded_creation_id"] is DBNull) |
1422 | newSettings.LoadedCreationID = ""; | 1595 | newSettings.LoadedCreationID = ""; |
1423 | else | 1596 | else |
1424 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; | 1597 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; |
1425 | 1598 | ||
1426 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); | 1599 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); |
1427 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1600 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1428 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1601 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1429 | 1602 | ||
1603 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1604 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1605 | |||
1430 | return newSettings; | 1606 | return newSettings; |
1431 | } | 1607 | } |
1432 | 1608 | ||
@@ -1503,6 +1679,13 @@ namespace OpenSim.Data.MySQL | |||
1503 | 1679 | ||
1504 | newData.ParcelAccessList = new List<LandAccessEntry>(); | 1680 | newData.ParcelAccessList = new List<LandAccessEntry>(); |
1505 | 1681 | ||
1682 | if (!(row["SeeAVs"] is System.DBNull)) | ||
1683 | newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false; | ||
1684 | if (!(row["AnyAVSounds"] is System.DBNull)) | ||
1685 | newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false; | ||
1686 | if (!(row["GroupAVSounds"] is System.DBNull)) | ||
1687 | newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false; | ||
1688 | |||
1506 | return newData; | 1689 | return newData; |
1507 | } | 1690 | } |
1508 | 1691 | ||
@@ -1550,6 +1733,7 @@ namespace OpenSim.Data.MySQL | |||
1550 | cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); | 1733 | cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); |
1551 | cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); | 1734 | cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); |
1552 | cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); | 1735 | cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); |
1736 | cmd.Parameters.AddWithValue("RezzerID", prim.RezzerID.ToString()); | ||
1553 | cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); | 1737 | cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); |
1554 | cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); | 1738 | cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); |
1555 | cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); | 1739 | cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); |
@@ -1654,6 +1838,11 @@ namespace OpenSim.Data.MySQL | |||
1654 | else | 1838 | else |
1655 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1839 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1656 | 1840 | ||
1841 | if (prim.PassCollisions) | ||
1842 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1843 | else | ||
1844 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1845 | |||
1657 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1846 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1658 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1847 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1659 | if (prim.AttachedPos != null) | 1848 | if (prim.AttachedPos != null) |
@@ -1668,6 +1857,16 @@ namespace OpenSim.Data.MySQL | |||
1668 | else | 1857 | else |
1669 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1858 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1670 | 1859 | ||
1860 | if (prim.PhysicsInertia != null) | ||
1861 | cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2()); | ||
1862 | else | ||
1863 | cmd.Parameters.AddWithValue("PhysInertia", String.Empty); | ||
1864 | |||
1865 | if (prim.VehicleParams != null) | ||
1866 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1867 | else | ||
1868 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1869 | |||
1671 | if (prim.DynAttrs.CountNamespaces > 0) | 1870 | if (prim.DynAttrs.CountNamespaces > 0) |
1672 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1871 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1673 | else | 1872 | else |
@@ -1678,6 +1877,7 @@ namespace OpenSim.Data.MySQL | |||
1678 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | 1877 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); |
1679 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | 1878 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); |
1680 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); | 1879 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); |
1880 | cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks); | ||
1681 | } | 1881 | } |
1682 | 1882 | ||
1683 | /// <summary> | 1883 | /// <summary> |
@@ -1756,6 +1956,8 @@ namespace OpenSim.Data.MySQL | |||
1756 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1956 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1757 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1957 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1758 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1958 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1959 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1960 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1759 | 1961 | ||
1760 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1962 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1761 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1963 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1813,6 +2015,10 @@ namespace OpenSim.Data.MySQL | |||
1813 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); | 2015 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); |
1814 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); | 2016 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); |
1815 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); | 2017 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); |
2018 | cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0); | ||
2019 | cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0); | ||
2020 | cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0); | ||
2021 | |||
1816 | } | 2022 | } |
1817 | 2023 | ||
1818 | /// <summary> | 2024 | /// <summary> |
@@ -1869,7 +2075,7 @@ namespace OpenSim.Data.MySQL | |||
1869 | 2075 | ||
1870 | s.State = (byte)(int)row["State"]; | 2076 | s.State = (byte)(int)row["State"]; |
1871 | s.LastAttachPoint = (byte)(int)row["LastAttachPoint"]; | 2077 | s.LastAttachPoint = (byte)(int)row["LastAttachPoint"]; |
1872 | 2078 | ||
1873 | if (!(row["Media"] is System.DBNull)) | 2079 | if (!(row["Media"] is System.DBNull)) |
1874 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 2080 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1875 | 2081 | ||
@@ -1919,7 +2125,7 @@ namespace OpenSim.Data.MySQL | |||
1919 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 2125 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1920 | } | 2126 | } |
1921 | 2127 | ||
1922 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 2128 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1923 | { | 2129 | { |
1924 | lock (m_dbLock) | 2130 | lock (m_dbLock) |
1925 | { | 2131 | { |
@@ -1949,20 +2155,53 @@ namespace OpenSim.Data.MySQL | |||
1949 | "?flags, ?itemID, ?primID, ?assetID, " + | 2155 | "?flags, ?itemID, ?primID, ?assetID, " + |
1950 | "?parentFolderID, ?creatorID, ?ownerID, " + | 2156 | "?parentFolderID, ?creatorID, ?ownerID, " + |
1951 | "?groupID, ?lastOwnerID)"; | 2157 | "?groupID, ?lastOwnerID)"; |
1952 | 2158 | ||
1953 | foreach (TaskInventoryItem item in items) | 2159 | foreach (TaskInventoryItem item in items) |
1954 | { | 2160 | { |
1955 | cmd.Parameters.Clear(); | 2161 | cmd.Parameters.Clear(); |
1956 | 2162 | ||
1957 | FillItemCommand(cmd, item); | 2163 | FillItemCommand(cmd, item); |
1958 | 2164 | ||
1959 | ExecuteNonQuery(cmd); | 2165 | ExecuteNonQuery(cmd); |
1960 | } | 2166 | } |
1961 | } | 2167 | } |
2168 | dbcon.Close(); | ||
1962 | } | 2169 | } |
1963 | } | 2170 | } |
1964 | } | 2171 | } |
1965 | 2172 | ||
2173 | public UUID[] GetObjectIDs(UUID regionID) | ||
2174 | { | ||
2175 | List<UUID> uuids = new List<UUID>(); | ||
2176 | |||
2177 | lock (m_dbLock) | ||
2178 | { | ||
2179 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2180 | { | ||
2181 | dbcon.Open(); | ||
2182 | |||
2183 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2184 | { | ||
2185 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2186 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2187 | |||
2188 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2189 | { | ||
2190 | while (reader.Read()) | ||
2191 | { | ||
2192 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2193 | |||
2194 | uuids.Add(id); | ||
2195 | } | ||
2196 | } | ||
2197 | } | ||
2198 | dbcon.Close(); | ||
2199 | } | ||
2200 | } | ||
2201 | |||
2202 | return uuids.ToArray(); | ||
2203 | } | ||
2204 | |||
1966 | private void LoadSpawnPoints(RegionSettings rs) | 2205 | private void LoadSpawnPoints(RegionSettings rs) |
1967 | { | 2206 | { |
1968 | rs.ClearSpawnPoints(); | 2207 | rs.ClearSpawnPoints(); |
@@ -1992,6 +2231,7 @@ namespace OpenSim.Data.MySQL | |||
1992 | } | 2231 | } |
1993 | } | 2232 | } |
1994 | } | 2233 | } |
2234 | dbcon.Close(); | ||
1995 | } | 2235 | } |
1996 | } | 2236 | } |
1997 | } | 2237 | } |
@@ -2026,6 +2266,7 @@ namespace OpenSim.Data.MySQL | |||
2026 | cmd.Parameters.Clear(); | 2266 | cmd.Parameters.Clear(); |
2027 | } | 2267 | } |
2028 | } | 2268 | } |
2269 | dbcon.Close(); | ||
2029 | } | 2270 | } |
2030 | } | 2271 | } |
2031 | } | 2272 | } |
@@ -2045,6 +2286,7 @@ namespace OpenSim.Data.MySQL | |||
2045 | 2286 | ||
2046 | cmd.ExecuteNonQuery(); | 2287 | cmd.ExecuteNonQuery(); |
2047 | } | 2288 | } |
2289 | dbcon.Close(); | ||
2048 | } | 2290 | } |
2049 | } | 2291 | } |
2050 | 2292 | ||
@@ -2062,6 +2304,7 @@ namespace OpenSim.Data.MySQL | |||
2062 | 2304 | ||
2063 | cmd.ExecuteNonQuery(); | 2305 | cmd.ExecuteNonQuery(); |
2064 | } | 2306 | } |
2307 | dbcon.Close(); | ||
2065 | } | 2308 | } |
2066 | } | 2309 | } |
2067 | 2310 | ||
@@ -2085,6 +2328,7 @@ namespace OpenSim.Data.MySQL | |||
2085 | } | 2328 | } |
2086 | } | 2329 | } |
2087 | } | 2330 | } |
2331 | dbcon.Close(); | ||
2088 | } | 2332 | } |
2089 | 2333 | ||
2090 | return ret; | 2334 | return ret; |
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index e964295..59cfe70 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -46,17 +46,21 @@ namespace OpenSim.Data.MySQL | |||
46 | { | 46 | { |
47 | string[] words = query.Split(new char[] {' '}); | 47 | string[] words = query.Split(new char[] {' '}); |
48 | 48 | ||
49 | bool valid = false; | ||
50 | |||
49 | for (int i = 0 ; i < words.Length ; i++) | 51 | for (int i = 0 ; i < words.Length ; i++) |
50 | { | 52 | { |
51 | if (words[i].Length < 3) | 53 | if (words[i].Length > 2) |
52 | { | 54 | valid = true; |
53 | if (i != words.Length - 1) | 55 | // if (words[i].Length < 3) |
54 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | 56 | // { |
55 | Array.Resize(ref words, words.Length - 1); | 57 | // if (i != words.Length - 1) |
56 | } | 58 | // Array.Copy(words, i + 1, words, i, words.Length - i - 1); |
59 | // Array.Resize(ref words, words.Length - 1); | ||
60 | // } | ||
57 | } | 61 | } |
58 | 62 | ||
59 | if (words.Length == 0) | 63 | if ((!valid) || words.Length == 0) |
60 | return new UserAccountData[0]; | 64 | return new UserAccountData[0]; |
61 | 65 | ||
62 | if (words.Length > 2) | 66 | if (words.Length > 2) |
@@ -66,13 +70,13 @@ namespace OpenSim.Data.MySQL | |||
66 | { | 70 | { |
67 | if (words.Length == 1) | 71 | if (words.Length == 1) |
68 | { | 72 | { |
69 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm); | 73 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search) and active=1", m_Realm); |
70 | cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); | 74 | cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%"); |
71 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 75 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
72 | } | 76 | } |
73 | else | 77 | else |
74 | { | 78 | { |
75 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm); | 79 | cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst and LastName like ?searchLast) and active=1", m_Realm); |
76 | cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); | 80 | cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%"); |
77 | cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); | 81 | cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%"); |
78 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | 82 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); |
@@ -81,5 +85,21 @@ namespace OpenSim.Data.MySQL | |||
81 | return DoQuery(cmd); | 85 | return DoQuery(cmd); |
82 | } | 86 | } |
83 | } | 87 | } |
88 | |||
89 | public UserAccountData[] GetUsersWhere(UUID scopeID, string where) | ||
90 | { | ||
91 | using (MySqlCommand cmd = new MySqlCommand()) | ||
92 | { | ||
93 | if (scopeID != UUID.Zero) | ||
94 | { | ||
95 | where = "(ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (" + where + ")"; | ||
96 | cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString()); | ||
97 | } | ||
98 | |||
99 | cmd.CommandText = String.Format("select * from {0} where " + where, m_Realm); | ||
100 | |||
101 | return DoQuery(cmd); | ||
102 | } | ||
103 | } | ||
84 | } | 104 | } |
85 | } \ No newline at end of file | 105 | } |
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index b35595d..16637c3 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -40,39 +40,40 @@ namespace OpenSim.Data.MySQL | |||
40 | public class UserProfilesData: IProfilesData | 40 | public class UserProfilesData: IProfilesData |
41 | { | 41 | { |
42 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | #region Properites | 44 | #region Properites |
45 | string ConnectionString | 45 | string ConnectionString |
46 | { | 46 | { |
47 | get; set; | 47 | get; set; |
48 | } | 48 | } |
49 | 49 | ||
50 | protected virtual Assembly Assembly | 50 | protected virtual Assembly Assembly |
51 | { | 51 | { |
52 | get { return GetType().Assembly; } | 52 | get { return GetType().Assembly; } |
53 | } | 53 | } |
54 | 54 | ||
55 | #endregion Properties | 55 | #endregion Properties |
56 | 56 | ||
57 | #region class Member Functions | 57 | #region class Member Functions |
58 | public UserProfilesData(string connectionString) | 58 | public UserProfilesData(string connectionString) |
59 | { | 59 | { |
60 | ConnectionString = connectionString; | 60 | ConnectionString = connectionString; |
61 | Init(); | 61 | Init(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Init() | 64 | void Init() |
65 | { | 65 | { |
66 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 66 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
67 | { | 67 | { |
68 | dbcon.Open(); | 68 | dbcon.Open(); |
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 |
75 | 76 | ||
76 | #region Classifieds Queries | 77 | #region Classifieds Queries |
77 | /// <summary> | 78 | /// <summary> |
78 | /// Gets the classified records. | 79 | /// Gets the classified records. |
@@ -86,10 +87,10 @@ namespace OpenSim.Data.MySQL | |||
86 | public OSDArray GetClassifiedRecords(UUID creatorId) | 87 | public OSDArray GetClassifiedRecords(UUID creatorId) |
87 | { | 88 | { |
88 | OSDArray data = new OSDArray(); | 89 | OSDArray data = new OSDArray(); |
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 | { |
@@ -102,7 +103,7 @@ namespace OpenSim.Data.MySQL | |||
102 | { | 103 | { |
103 | OSDMap n = new OSDMap(); | 104 | OSDMap n = new OSDMap(); |
104 | UUID Id = UUID.Zero; | 105 | UUID Id = UUID.Zero; |
105 | 106 | ||
106 | string Name = null; | 107 | string Name = null; |
107 | try | 108 | try |
108 | { | 109 | { |
@@ -111,8 +112,7 @@ namespace OpenSim.Data.MySQL | |||
111 | } | 112 | } |
112 | catch (Exception e) | 113 | catch (Exception e) |
113 | { | 114 | { |
114 | m_log.ErrorFormat("[PROFILES_DATA]" + | 115 | m_log.ErrorFormat("[PROFILES_DATA] GetClassifiedRecords exception {0}", e.Message); |
115 | ": UserAccount exception {0}", e.Message); | ||
116 | } | 116 | } |
117 | n.Add("classifieduuid", OSD.FromUUID(Id)); | 117 | n.Add("classifieduuid", OSD.FromUUID(Id)); |
118 | n.Add("name", OSD.FromString(Name)); | 118 | n.Add("name", OSD.FromString(Name)); |
@@ -121,73 +121,73 @@ namespace OpenSim.Data.MySQL | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | dbcon.Close(); | ||
124 | } | 125 | } |
125 | return data; | 126 | return data; |
126 | } | 127 | } |
127 | 128 | ||
128 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) | 129 | public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result) |
129 | { | 130 | { |
130 | string query = string.Empty; | 131 | const string query = |
131 | 132 | "INSERT INTO classifieds (" | |
132 | 133 | + "`classifieduuid`," | |
133 | query += "INSERT INTO classifieds ("; | 134 | + "`creatoruuid`," |
134 | query += "`classifieduuid`,"; | 135 | + "`creationdate`," |
135 | query += "`creatoruuid`,"; | 136 | + "`expirationdate`," |
136 | query += "`creationdate`,"; | 137 | + "`category`," |
137 | query += "`expirationdate`,"; | 138 | + "`name`," |
138 | query += "`category`,"; | 139 | + "`description`," |
139 | query += "`name`,"; | 140 | + "`parceluuid`," |
140 | query += "`description`,"; | 141 | + "`parentestate`," |
141 | query += "`parceluuid`,"; | 142 | + "`snapshotuuid`," |
142 | query += "`parentestate`,"; | 143 | + "`simname`," |
143 | query += "`snapshotuuid`,"; | 144 | + "`posglobal`," |
144 | query += "`simname`,"; | 145 | + "`parcelname`," |
145 | query += "`posglobal`,"; | 146 | + "`classifiedflags`," |
146 | query += "`parcelname`,"; | 147 | + "`priceforlisting`) " |
147 | query += "`classifiedflags`,"; | 148 | + "VALUES (" |
148 | query += "`priceforlisting`) "; | 149 | + "?ClassifiedId," |
149 | query += "VALUES ("; | 150 | + "?CreatorId," |
150 | query += "?ClassifiedId,"; | 151 | + "?CreatedDate," |
151 | query += "?CreatorId,"; | 152 | + "?ExpirationDate," |
152 | query += "?CreatedDate,"; | 153 | + "?Category," |
153 | query += "?ExpirationDate,"; | 154 | + "?Name," |
154 | query += "?Category,"; | 155 | + "?Description," |
155 | query += "?Name,"; | 156 | + "?ParcelId," |
156 | query += "?Description,"; | 157 | + "?ParentEstate," |
157 | query += "?ParcelId,"; | 158 | + "?SnapshotId," |
158 | query += "?ParentEstate,"; | 159 | + "?SimName," |
159 | query += "?SnapshotId,"; | 160 | + "?GlobalPos," |
160 | query += "?SimName,"; | 161 | + "?ParcelName," |
161 | query += "?GlobalPos,"; | 162 | + "?Flags," |
162 | query += "?ParcelName,"; | 163 | + "?ListingPrice ) " |
163 | query += "?Flags,"; | 164 | + "ON DUPLICATE KEY UPDATE " |
164 | query += "?ListingPrice ) "; | 165 | + "category=?Category, " |
165 | query += "ON DUPLICATE KEY UPDATE "; | 166 | + "expirationdate=?ExpirationDate, " |
166 | query += "category=?Category, "; | 167 | + "name=?Name, " |
167 | query += "expirationdate=?ExpirationDate, "; | 168 | + "description=?Description, " |
168 | query += "name=?Name, "; | 169 | + "parentestate=?ParentEstate, " |
169 | query += "description=?Description, "; | 170 | + "posglobal=?GlobalPos, " |
170 | query += "parentestate=?ParentEstate, "; | 171 | + "parcelname=?ParcelName, " |
171 | query += "posglobal=?GlobalPos, "; | 172 | + "classifiedflags=?Flags, " |
172 | query += "parcelname=?ParcelName, "; | 173 | + "priceforlisting=?ListingPrice, " |
173 | query += "classifiedflags=?Flags, "; | 174 | + "snapshotuuid=?SnapshotId" |
174 | query += "priceforlisting=?ListingPrice, "; | 175 | ; |
175 | query += "snapshotuuid=?SnapshotId"; | 176 | |
176 | |||
177 | if(string.IsNullOrEmpty(ad.ParcelName)) | 177 | if(string.IsNullOrEmpty(ad.ParcelName)) |
178 | ad.ParcelName = "Unknown"; | 178 | ad.ParcelName = "Unknown"; |
179 | if(ad.ParcelId == null) | 179 | if(ad.ParcelId == null) |
180 | ad.ParcelId = UUID.Zero; | 180 | ad.ParcelId = UUID.Zero; |
181 | if(string.IsNullOrEmpty(ad.Description)) | 181 | if(string.IsNullOrEmpty(ad.Description)) |
182 | ad.Description = "No Description"; | 182 | ad.Description = "No Description"; |
183 | 183 | ||
184 | DateTime epoch = new DateTime(1970, 1, 1); | 184 | DateTime epoch = new DateTime(1970, 1, 1); |
185 | DateTime now = DateTime.Now; | 185 | DateTime now = DateTime.Now; |
186 | TimeSpan epochnow = now - epoch; | 186 | TimeSpan epochnow = now - epoch; |
187 | TimeSpan duration; | 187 | TimeSpan duration; |
188 | DateTime expiration; | 188 | DateTime expiration; |
189 | TimeSpan epochexp; | 189 | TimeSpan epochexp; |
190 | 190 | ||
191 | if(ad.Flags == 2) | 191 | if(ad.Flags == 2) |
192 | { | 192 | { |
193 | duration = new TimeSpan(7,0,0,0); | 193 | duration = new TimeSpan(7,0,0,0); |
@@ -202,7 +202,7 @@ namespace OpenSim.Data.MySQL | |||
202 | } | 202 | } |
203 | ad.CreationDate = (int)epochnow.TotalSeconds; | 203 | ad.CreationDate = (int)epochnow.TotalSeconds; |
204 | ad.ExpirationDate = (int)epochexp.TotalSeconds; | 204 | ad.ExpirationDate = (int)epochexp.TotalSeconds; |
205 | 205 | ||
206 | try | 206 | try |
207 | { | 207 | { |
208 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 208 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -225,57 +225,52 @@ namespace OpenSim.Data.MySQL | |||
225 | cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString()); | 225 | cmd.Parameters.AddWithValue("?ParcelName", ad.ParcelName.ToString()); |
226 | cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString()); | 226 | cmd.Parameters.AddWithValue("?Flags", ad.Flags.ToString()); |
227 | cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ()); | 227 | cmd.Parameters.AddWithValue("?ListingPrice", ad.Price.ToString ()); |
228 | 228 | ||
229 | cmd.ExecuteNonQuery(); | 229 | cmd.ExecuteNonQuery(); |
230 | } | 230 | } |
231 | dbcon.Close(); | ||
231 | } | 232 | } |
232 | } | 233 | } |
233 | catch (Exception e) | 234 | catch (Exception e) |
234 | { | 235 | { |
235 | m_log.ErrorFormat("[PROFILES_DATA]" + | 236 | m_log.ErrorFormat("[PROFILES_DATA]: UpdateClassifiedRecord exception {0}", e.Message); |
236 | ": ClassifiedesUpdate exception {0}", e.Message); | ||
237 | result = e.Message; | 237 | result = e.Message; |
238 | return false; | 238 | return false; |
239 | } | 239 | } |
240 | return true; | 240 | return true; |
241 | } | 241 | } |
242 | 242 | ||
243 | public bool DeleteClassifiedRecord(UUID recordId) | 243 | public bool DeleteClassifiedRecord(UUID recordId) |
244 | { | 244 | { |
245 | string query = string.Empty; | 245 | const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId"; |
246 | 246 | ||
247 | query += "DELETE FROM classifieds WHERE "; | ||
248 | query += "classifieduuid = ?recordId"; | ||
249 | |||
250 | try | 247 | try |
251 | { | 248 | { |
252 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 249 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
253 | { | 250 | { |
254 | dbcon.Open(); | 251 | dbcon.Open(); |
255 | 252 | ||
256 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 253 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
257 | { | 254 | { |
258 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); | 255 | cmd.Parameters.AddWithValue("?recordId", recordId.ToString()); |
259 | cmd.ExecuteNonQuery(); | 256 | cmd.ExecuteNonQuery(); |
260 | } | 257 | } |
258 | dbcon.Close(); | ||
261 | } | 259 | } |
262 | } | 260 | } |
263 | catch (Exception e) | 261 | catch (Exception e) |
264 | { | 262 | { |
265 | m_log.ErrorFormat("[PROFILES_DATA]" + | 263 | m_log.ErrorFormat("[PROFILES_DATA]: DeleteClassifiedRecord exception {0}", e.Message); |
266 | ": DeleteClassifiedRecord exception {0}", e.Message); | ||
267 | return false; | 264 | return false; |
268 | } | 265 | } |
269 | return true; | 266 | return true; |
270 | } | 267 | } |
271 | 268 | ||
272 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) | 269 | public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result) |
273 | { | 270 | { |
274 | string query = string.Empty; | 271 | |
275 | 272 | const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId"; | |
276 | query += "SELECT * FROM classifieds WHERE "; | 273 | |
277 | query += "classifieduuid = ?AdId"; | ||
278 | |||
279 | try | 274 | try |
280 | { | 275 | { |
281 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 276 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -284,7 +279,7 @@ namespace OpenSim.Data.MySQL | |||
284 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 279 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
285 | { | 280 | { |
286 | cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString()); | 281 | cmd.Parameters.AddWithValue("?AdId", ad.ClassifiedId.ToString()); |
287 | 282 | ||
288 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 283 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
289 | { | 284 | { |
290 | if(reader.Read ()) | 285 | if(reader.Read ()) |
@@ -303,7 +298,7 @@ namespace OpenSim.Data.MySQL | |||
303 | ad.SimName = reader.GetString("simname"); | 298 | ad.SimName = reader.GetString("simname"); |
304 | ad.GlobalPos = reader.GetString("posglobal"); | 299 | ad.GlobalPos = reader.GetString("posglobal"); |
305 | ad.ParcelName = reader.GetString("parcelname"); | 300 | ad.ParcelName = reader.GetString("parcelname"); |
306 | 301 | ||
307 | } | 302 | } |
308 | } | 303 | } |
309 | } | 304 | } |
@@ -312,22 +307,19 @@ namespace OpenSim.Data.MySQL | |||
312 | } | 307 | } |
313 | catch (Exception e) | 308 | catch (Exception e) |
314 | { | 309 | { |
315 | m_log.ErrorFormat("[PROFILES_DATA]" + | 310 | m_log.ErrorFormat("[PROFILES_DATA]: GetClassifiedInfo exception {0}", e.Message); |
316 | ": GetPickInfo exception {0}", e.Message); | ||
317 | } | 311 | } |
318 | return true; | 312 | return true; |
319 | } | 313 | } |
320 | #endregion Classifieds Queries | 314 | #endregion Classifieds Queries |
321 | 315 | ||
322 | #region Picks Queries | 316 | #region Picks Queries |
323 | public OSDArray GetAvatarPicks(UUID avatarId) | 317 | public OSDArray GetAvatarPicks(UUID avatarId) |
324 | { | 318 | { |
325 | string query = string.Empty; | 319 | const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id"; |
326 | 320 | ||
327 | query += "SELECT `pickuuid`,`name` FROM userpicks WHERE "; | ||
328 | query += "creatoruuid = ?Id"; | ||
329 | OSDArray data = new OSDArray(); | 321 | OSDArray data = new OSDArray(); |
330 | 322 | ||
331 | try | 323 | try |
332 | { | 324 | { |
333 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 325 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -336,7 +328,7 @@ namespace OpenSim.Data.MySQL | |||
336 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 328 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
337 | { | 329 | { |
338 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 330 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
339 | 331 | ||
340 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 332 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
341 | { | 333 | { |
342 | if(reader.HasRows) | 334 | if(reader.HasRows) |
@@ -344,7 +336,7 @@ namespace OpenSim.Data.MySQL | |||
344 | while (reader.Read()) | 336 | while (reader.Read()) |
345 | { | 337 | { |
346 | OSDMap record = new OSDMap(); | 338 | OSDMap record = new OSDMap(); |
347 | 339 | ||
348 | record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); | 340 | record.Add("pickuuid",OSD.FromString((string)reader["pickuuid"])); |
349 | record.Add("name",OSD.FromString((string)reader["name"])); | 341 | record.Add("name",OSD.FromString((string)reader["name"])); |
350 | data.Add(record); | 342 | data.Add(record); |
@@ -352,25 +344,21 @@ namespace OpenSim.Data.MySQL | |||
352 | } | 344 | } |
353 | } | 345 | } |
354 | } | 346 | } |
347 | dbcon.Close(); | ||
355 | } | 348 | } |
356 | } | 349 | } |
357 | catch (Exception e) | 350 | catch (Exception e) |
358 | { | 351 | { |
359 | m_log.ErrorFormat("[PROFILES_DATA]" + | 352 | m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarPicks exception {0}", e.Message); |
360 | ": GetAvatarPicks exception {0}", e.Message); | ||
361 | } | 353 | } |
362 | return data; | 354 | return data; |
363 | } | 355 | } |
364 | 356 | ||
365 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) | 357 | public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId) |
366 | { | 358 | { |
367 | string query = string.Empty; | ||
368 | UserProfilePick pick = new UserProfilePick(); | 359 | UserProfilePick pick = new UserProfilePick(); |
369 | 360 | const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId"; | |
370 | query += "SELECT * FROM userpicks WHERE "; | 361 | |
371 | query += "creatoruuid = ?CreatorId AND "; | ||
372 | query += "pickuuid = ?PickId"; | ||
373 | |||
374 | try | 362 | try |
375 | { | 363 | { |
376 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 364 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -380,18 +368,18 @@ namespace OpenSim.Data.MySQL | |||
380 | { | 368 | { |
381 | cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString()); | 369 | cmd.Parameters.AddWithValue("?CreatorId", avatarId.ToString()); |
382 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); | 370 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); |
383 | 371 | ||
384 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 372 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
385 | { | 373 | { |
386 | if(reader.HasRows) | 374 | if(reader.HasRows) |
387 | { | 375 | { |
388 | reader.Read(); | 376 | reader.Read(); |
389 | 377 | ||
390 | string description = (string)reader["description"]; | 378 | string description = (string)reader["description"]; |
391 | 379 | ||
392 | if (string.IsNullOrEmpty(description)) | 380 | if (string.IsNullOrEmpty(description)) |
393 | description = "No description given."; | 381 | description = "No description given."; |
394 | 382 | ||
395 | UUID.TryParse((string)reader["pickuuid"], out pick.PickId); | 383 | UUID.TryParse((string)reader["pickuuid"], out pick.PickId); |
396 | UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); | 384 | UUID.TryParse((string)reader["creatoruuid"], out pick.CreatorId); |
397 | UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); | 385 | UUID.TryParse((string)reader["parceluuid"], out pick.ParcelId); |
@@ -414,42 +402,41 @@ namespace OpenSim.Data.MySQL | |||
414 | } | 402 | } |
415 | catch (Exception e) | 403 | catch (Exception e) |
416 | { | 404 | { |
417 | m_log.ErrorFormat("[PROFILES_DATA]" + | 405 | m_log.ErrorFormat("[PROFILES_DATA]: GetPickInfo exception {0}", e.Message); |
418 | ": GetPickInfo exception {0}", e.Message); | ||
419 | } | 406 | } |
420 | return pick; | 407 | return pick; |
421 | } | 408 | } |
422 | 409 | ||
423 | public bool UpdatePicksRecord(UserProfilePick pick) | 410 | public bool UpdatePicksRecord(UserProfilePick pick) |
424 | { | 411 | { |
425 | string query = string.Empty; | 412 | const string query = |
426 | 413 | "INSERT INTO userpicks VALUES (" | |
427 | query += "INSERT INTO userpicks VALUES ("; | 414 | + "?PickId," |
428 | query += "?PickId,"; | 415 | + "?CreatorId," |
429 | query += "?CreatorId,"; | 416 | + "?TopPick," |
430 | query += "?TopPick,"; | 417 | + "?ParcelId," |
431 | query += "?ParcelId,"; | 418 | + "?Name," |
432 | query += "?Name,"; | 419 | + "?Desc," |
433 | query += "?Desc,"; | 420 | + "?SnapshotId," |
434 | query += "?SnapshotId,"; | 421 | + "?User," |
435 | query += "?User,"; | 422 | + "?Original," |
436 | query += "?Original,"; | 423 | + "?SimName," |
437 | query += "?SimName,"; | 424 | + "?GlobalPos," |
438 | query += "?GlobalPos,"; | 425 | + "?SortOrder," |
439 | query += "?SortOrder,"; | 426 | + "?Enabled," |
440 | query += "?Enabled,"; | 427 | + "?Gatekeeper)" |
441 | query += "?Gatekeeper)"; | 428 | + "ON DUPLICATE KEY UPDATE " |
442 | query += "ON DUPLICATE KEY UPDATE "; | 429 | + "parceluuid=?ParcelId," |
443 | query += "parceluuid=?ParcelId,"; | 430 | + "name=?Name," |
444 | query += "name=?Name,"; | 431 | + "description=?Desc," |
445 | query += "description=?Desc,"; | 432 | + "user=?User," |
446 | query += "user=?User,"; | 433 | + "simname=?SimName," |
447 | query += "simname=?SimName,"; | 434 | + "snapshotuuid=?SnapshotId," |
448 | query += "snapshotuuid=?SnapshotId,"; | 435 | + "pickuuid=?PickId," |
449 | query += "pickuuid=?PickId,"; | 436 | + "posglobal=?GlobalPos," |
450 | query += "posglobal=?GlobalPos,"; | 437 | + "gatekeeper=?Gatekeeper" |
451 | query += "gatekeeper=?Gatekeeper"; | 438 | ; |
452 | 439 | ||
453 | try | 440 | try |
454 | { | 441 | { |
455 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 442 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -471,61 +458,53 @@ namespace OpenSim.Data.MySQL | |||
471 | cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper); | 458 | cmd.Parameters.AddWithValue("?Gatekeeper",pick.Gatekeeper); |
472 | cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); | 459 | cmd.Parameters.AddWithValue("?SortOrder", pick.SortOrder.ToString ()); |
473 | cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); | 460 | cmd.Parameters.AddWithValue("?Enabled", pick.Enabled.ToString()); |
474 | 461 | ||
475 | cmd.ExecuteNonQuery(); | 462 | cmd.ExecuteNonQuery(); |
476 | } | 463 | } |
464 | dbcon.Close(); | ||
477 | } | 465 | } |
478 | } | 466 | } |
479 | catch (Exception e) | 467 | catch (Exception e) |
480 | { | 468 | { |
481 | m_log.ErrorFormat("[PROFILES_DATA]" + | 469 | m_log.ErrorFormat("[PROFILES_DATA]: UpdatePicksRecord exception {0}", e.Message); |
482 | ": UpdateAvatarNotes exception {0}", e.Message); | ||
483 | return false; | 470 | return false; |
484 | } | 471 | } |
485 | return true; | 472 | return true; |
486 | } | 473 | } |
487 | 474 | ||
488 | public bool DeletePicksRecord(UUID pickId) | 475 | public bool DeletePicksRecord(UUID pickId) |
489 | { | 476 | { |
490 | string query = string.Empty; | 477 | string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId"; |
491 | 478 | ||
492 | query += "DELETE FROM userpicks WHERE "; | ||
493 | query += "pickuuid = ?PickId"; | ||
494 | |||
495 | try | 479 | try |
496 | { | 480 | { |
497 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 481 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
498 | { | 482 | { |
499 | dbcon.Open(); | 483 | dbcon.Open(); |
500 | 484 | ||
501 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 485 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
502 | { | 486 | { |
503 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); | 487 | cmd.Parameters.AddWithValue("?PickId", pickId.ToString()); |
504 | 488 | ||
505 | cmd.ExecuteNonQuery(); | 489 | cmd.ExecuteNonQuery(); |
506 | } | 490 | } |
491 | dbcon.Close(); | ||
507 | } | 492 | } |
508 | } | 493 | } |
509 | catch (Exception e) | 494 | catch (Exception e) |
510 | { | 495 | { |
511 | m_log.ErrorFormat("[PROFILES_DATA]" + | 496 | m_log.ErrorFormat("[PROFILES_DATA]: DeletePicksRecord exception {0}", e.Message); |
512 | ": DeleteUserPickRecord exception {0}", e.Message); | ||
513 | return false; | 497 | return false; |
514 | } | 498 | } |
515 | return true; | 499 | return true; |
516 | } | 500 | } |
517 | #endregion Picks Queries | 501 | #endregion Picks Queries |
518 | 502 | ||
519 | #region Avatar Notes Queries | 503 | #region Avatar Notes Queries |
520 | public bool GetAvatarNotes(ref UserProfileNotes notes) | 504 | public bool GetAvatarNotes(ref UserProfileNotes notes) |
521 | { // WIP | 505 | { // WIP |
522 | string query = string.Empty; | 506 | const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId"; |
523 | 507 | ||
524 | query += "SELECT `notes` FROM usernotes WHERE "; | ||
525 | query += "useruuid = ?Id AND "; | ||
526 | query += "targetuuid = ?TargetId"; | ||
527 | OSDArray data = new OSDArray(); | ||
528 | |||
529 | try | 508 | try |
530 | { | 509 | { |
531 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 510 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -535,7 +514,7 @@ namespace OpenSim.Data.MySQL | |||
535 | { | 514 | { |
536 | cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString()); | 515 | cmd.Parameters.AddWithValue("?Id", notes.UserId.ToString()); |
537 | cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString()); | 516 | cmd.Parameters.AddWithValue("?TargetId", notes.TargetId.ToString()); |
538 | 517 | ||
539 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 518 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
540 | { | 519 | { |
541 | if(reader.HasRows) | 520 | if(reader.HasRows) |
@@ -549,40 +528,39 @@ namespace OpenSim.Data.MySQL | |||
549 | } | 528 | } |
550 | } | 529 | } |
551 | } | 530 | } |
531 | dbcon.Close(); | ||
552 | } | 532 | } |
553 | } | 533 | } |
554 | catch (Exception e) | 534 | catch (Exception e) |
555 | { | 535 | { |
556 | m_log.ErrorFormat("[PROFILES_DATA]" + | 536 | m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarNotes exception {0}", e.Message); |
557 | ": GetAvatarNotes exception {0}", e.Message); | ||
558 | } | 537 | } |
559 | return true; | 538 | return true; |
560 | } | 539 | } |
561 | 540 | ||
562 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) | 541 | public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result) |
563 | { | 542 | { |
564 | string query = string.Empty; | 543 | string query; |
565 | bool remove; | 544 | bool remove; |
566 | 545 | ||
567 | if(string.IsNullOrEmpty(note.Notes)) | 546 | if(string.IsNullOrEmpty(note.Notes)) |
568 | { | 547 | { |
569 | remove = true; | 548 | remove = true; |
570 | query += "DELETE FROM usernotes WHERE "; | 549 | query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId"; |
571 | query += "useruuid=?UserId AND "; | ||
572 | query += "targetuuid=?TargetId"; | ||
573 | } | 550 | } |
574 | else | 551 | else |
575 | { | 552 | { |
576 | remove = false; | 553 | remove = false; |
577 | query += "INSERT INTO usernotes VALUES ( "; | 554 | query = "INSERT INTO usernotes VALUES (" |
578 | query += "?UserId,"; | 555 | + "?UserId," |
579 | query += "?TargetId,"; | 556 | + "?TargetId," |
580 | query += "?Notes )"; | 557 | + "?Notes )" |
581 | query += "ON DUPLICATE KEY "; | 558 | + "ON DUPLICATE KEY " |
582 | query += "UPDATE "; | 559 | + "UPDATE " |
583 | query += "notes=?Notes"; | 560 | + "notes=?Notes" |
561 | ; | ||
584 | } | 562 | } |
585 | 563 | ||
586 | try | 564 | try |
587 | { | 565 | { |
588 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 566 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -594,30 +572,27 @@ namespace OpenSim.Data.MySQL | |||
594 | cmd.Parameters.AddWithValue("?Notes", note.Notes); | 572 | cmd.Parameters.AddWithValue("?Notes", note.Notes); |
595 | cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ()); | 573 | cmd.Parameters.AddWithValue("?TargetId", note.TargetId.ToString ()); |
596 | cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString()); | 574 | cmd.Parameters.AddWithValue("?UserId", note.UserId.ToString()); |
597 | 575 | ||
598 | cmd.ExecuteNonQuery(); | 576 | cmd.ExecuteNonQuery(); |
599 | } | 577 | } |
578 | dbcon.Close(); | ||
600 | } | 579 | } |
601 | } | 580 | } |
602 | catch (Exception e) | 581 | catch (Exception e) |
603 | { | 582 | { |
604 | m_log.ErrorFormat("[PROFILES_DATA]" + | 583 | m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarNotes exception {0}", e.Message); |
605 | ": UpdateAvatarNotes exception {0}", e.Message); | ||
606 | return false; | 584 | return false; |
607 | } | 585 | } |
608 | return true; | 586 | return true; |
609 | 587 | ||
610 | } | 588 | } |
611 | #endregion Avatar Notes Queries | 589 | #endregion Avatar Notes Queries |
612 | 590 | ||
613 | #region Avatar Properties | 591 | #region Avatar Properties |
614 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) | 592 | public bool GetAvatarProperties(ref UserProfileProperties props, ref string result) |
615 | { | 593 | { |
616 | string query = string.Empty; | 594 | string query = "SELECT * FROM userprofile WHERE useruuid = ?Id"; |
617 | 595 | ||
618 | query += "SELECT * FROM userprofile WHERE "; | ||
619 | query += "useruuid = ?Id"; | ||
620 | |||
621 | try | 596 | try |
622 | { | 597 | { |
623 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 598 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -626,11 +601,13 @@ namespace OpenSim.Data.MySQL | |||
626 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 601 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
627 | { | 602 | { |
628 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); | 603 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); |
629 | 604 | ||
630 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 605 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
631 | { | 606 | { |
632 | if(reader.HasRows) | 607 | if(reader.HasRows) |
633 | { | 608 | { |
609 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
610 | ": Getting data for {0}.", props.UserId); | ||
634 | reader.Read(); | 611 | reader.Read(); |
635 | props.WebUrl = (string)reader["profileURL"]; | 612 | props.WebUrl = (string)reader["profileURL"]; |
636 | UUID.TryParse((string)reader["profileImage"], out props.ImageId); | 613 | UUID.TryParse((string)reader["profileImage"], out props.ImageId); |
@@ -646,6 +623,9 @@ namespace OpenSim.Data.MySQL | |||
646 | } | 623 | } |
647 | else | 624 | else |
648 | { | 625 | { |
626 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
627 | ": No data for {0}", props.UserId); | ||
628 | |||
649 | props.WebUrl = string.Empty; | 629 | props.WebUrl = string.Empty; |
650 | props.ImageId = UUID.Zero; | 630 | props.ImageId = UUID.Zero; |
651 | props.AboutText = string.Empty; | 631 | props.AboutText = string.Empty; |
@@ -660,35 +640,36 @@ namespace OpenSim.Data.MySQL | |||
660 | props.PublishProfile = false; | 640 | props.PublishProfile = false; |
661 | props.PublishMature = false; | 641 | props.PublishMature = false; |
662 | 642 | ||
663 | query = "INSERT INTO userprofile ("; | 643 | query = "INSERT INTO userprofile (" |
664 | query += "useruuid, "; | 644 | + "useruuid, " |
665 | query += "profilePartner, "; | 645 | + "profilePartner, " |
666 | query += "profileAllowPublish, "; | 646 | + "profileAllowPublish, " |
667 | query += "profileMaturePublish, "; | 647 | + "profileMaturePublish, " |
668 | query += "profileURL, "; | 648 | + "profileURL, " |
669 | query += "profileWantToMask, "; | 649 | + "profileWantToMask, " |
670 | query += "profileWantToText, "; | 650 | + "profileWantToText, " |
671 | query += "profileSkillsMask, "; | 651 | + "profileSkillsMask, " |
672 | query += "profileSkillsText, "; | 652 | + "profileSkillsText, " |
673 | query += "profileLanguages, "; | 653 | + "profileLanguages, " |
674 | query += "profileImage, "; | 654 | + "profileImage, " |
675 | query += "profileAboutText, "; | 655 | + "profileAboutText, " |
676 | query += "profileFirstImage, "; | 656 | + "profileFirstImage, " |
677 | query += "profileFirstText) VALUES ("; | 657 | + "profileFirstText) VALUES (" |
678 | query += "?userId, "; | 658 | + "?userId, " |
679 | query += "?profilePartner, "; | 659 | + "?profilePartner, " |
680 | query += "?profileAllowPublish, "; | 660 | + "?profileAllowPublish, " |
681 | query += "?profileMaturePublish, "; | 661 | + "?profileMaturePublish, " |
682 | query += "?profileURL, "; | 662 | + "?profileURL, " |
683 | query += "?profileWantToMask, "; | 663 | + "?profileWantToMask, " |
684 | query += "?profileWantToText, "; | 664 | + "?profileWantToText, " |
685 | query += "?profileSkillsMask, "; | 665 | + "?profileSkillsMask, " |
686 | query += "?profileSkillsText, "; | 666 | + "?profileSkillsText, " |
687 | query += "?profileLanguages, "; | 667 | + "?profileLanguages, " |
688 | query += "?profileImage, "; | 668 | + "?profileImage, " |
689 | query += "?profileAboutText, "; | 669 | + "?profileAboutText, " |
690 | query += "?profileFirstImage, "; | 670 | + "?profileFirstImage, " |
691 | query += "?profileFirstText)"; | 671 | + "?profileFirstText)" |
672 | ; | ||
692 | 673 | ||
693 | dbcon.Close(); | 674 | dbcon.Close(); |
694 | dbcon.Open(); | 675 | dbcon.Open(); |
@@ -715,30 +696,25 @@ namespace OpenSim.Data.MySQL | |||
715 | } | 696 | } |
716 | } | 697 | } |
717 | } | 698 | } |
699 | dbcon.Close(); | ||
718 | } | 700 | } |
719 | } | 701 | } |
720 | catch (Exception e) | 702 | catch (Exception e) |
721 | { | 703 | { |
722 | m_log.ErrorFormat("[PROFILES_DATA]" + | 704 | m_log.ErrorFormat("[PROFILES_DATA]: GetAvatarProperties exception {0}", e.Message); |
723 | ": Requst properties exception {0}", e.Message); | ||
724 | result = e.Message; | 705 | result = e.Message; |
725 | return false; | 706 | return false; |
726 | } | 707 | } |
727 | return true; | 708 | return true; |
728 | } | 709 | } |
729 | 710 | ||
730 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) | 711 | public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result) |
731 | { | 712 | { |
732 | string query = string.Empty; | 713 | const string query = "UPDATE userprofile SET profileURL=?profileURL," |
733 | 714 | + "profileImage=?image, profileAboutText=?abouttext," | |
734 | query += "UPDATE userprofile SET "; | 715 | + "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext " |
735 | query += "profileURL=?profileURL, "; | 716 | + "WHERE useruuid=?uuid"; |
736 | query += "profileImage=?image, "; | 717 | |
737 | query += "profileAboutText=?abouttext,"; | ||
738 | query += "profileFirstImage=?firstlifeimage,"; | ||
739 | query += "profileFirstText=?firstlifetext "; | ||
740 | query += "WHERE useruuid=?uuid"; | ||
741 | |||
742 | try | 718 | try |
743 | { | 719 | { |
744 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 720 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -752,35 +728,33 @@ namespace OpenSim.Data.MySQL | |||
752 | cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); | 728 | cmd.Parameters.AddWithValue("?firstlifeimage", props.FirstLifeImageId.ToString()); |
753 | cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText); | 729 | cmd.Parameters.AddWithValue("?firstlifetext", props.FirstLifeText); |
754 | cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString()); | 730 | cmd.Parameters.AddWithValue("?uuid", props.UserId.ToString()); |
755 | 731 | ||
756 | cmd.ExecuteNonQuery(); | 732 | cmd.ExecuteNonQuery(); |
757 | } | 733 | } |
734 | dbcon.Close(); | ||
758 | } | 735 | } |
759 | } | 736 | } |
760 | catch (Exception e) | 737 | catch (Exception e) |
761 | { | 738 | { |
762 | m_log.ErrorFormat("[PROFILES_DATA]" + | 739 | m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarProperties exception {0}", e.Message); |
763 | ": AgentPropertiesUpdate exception {0}", e.Message); | 740 | |
764 | |||
765 | return false; | 741 | return false; |
766 | } | 742 | } |
767 | return true; | 743 | return true; |
768 | } | 744 | } |
769 | #endregion Avatar Properties | 745 | #endregion Avatar Properties |
770 | 746 | ||
771 | #region Avatar Interests | 747 | #region Avatar Interests |
772 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) | 748 | public bool UpdateAvatarInterests(UserProfileProperties up, ref string result) |
773 | { | 749 | { |
774 | string query = string.Empty; | 750 | const string query = "UPDATE userprofile SET " |
775 | 751 | + "profileWantToMask=?WantMask, " | |
776 | query += "UPDATE userprofile SET "; | 752 | + "profileWantToText=?WantText," |
777 | query += "profileWantToMask=?WantMask, "; | 753 | + "profileSkillsMask=?SkillsMask," |
778 | query += "profileWantToText=?WantText,"; | 754 | + "profileSkillsText=?SkillsText, " |
779 | query += "profileSkillsMask=?SkillsMask,"; | 755 | + "profileLanguages=?Languages " |
780 | query += "profileSkillsText=?SkillsText, "; | 756 | + "WHERE useruuid=?uuid"; |
781 | query += "profileLanguages=?Languages "; | 757 | |
782 | query += "WHERE useruuid=?uuid"; | ||
783 | |||
784 | try | 758 | try |
785 | { | 759 | { |
786 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 760 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -794,15 +768,14 @@ namespace OpenSim.Data.MySQL | |||
794 | cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText); | 768 | cmd.Parameters.AddWithValue("?SkillsText", up.SkillsText); |
795 | cmd.Parameters.AddWithValue("?Languages", up.Language); | 769 | cmd.Parameters.AddWithValue("?Languages", up.Language); |
796 | cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString()); | 770 | cmd.Parameters.AddWithValue("?uuid", up.UserId.ToString()); |
797 | 771 | ||
798 | cmd.ExecuteNonQuery(); | 772 | cmd.ExecuteNonQuery(); |
799 | } | 773 | } |
800 | } | 774 | } |
801 | } | 775 | } |
802 | catch (Exception e) | 776 | catch (Exception e) |
803 | { | 777 | { |
804 | m_log.ErrorFormat("[PROFILES_DATA]" + | 778 | m_log.ErrorFormat("[PROFILES_DATA]: UpdateAvatarInterests exception {0}", e.Message); |
805 | ": AgentInterestsUpdate exception {0}", e.Message); | ||
806 | result = e.Message; | 779 | result = e.Message; |
807 | return false; | 780 | return false; |
808 | } | 781 | } |
@@ -813,21 +786,20 @@ namespace OpenSim.Data.MySQL | |||
813 | public OSDArray GetUserImageAssets(UUID avatarId) | 786 | public OSDArray GetUserImageAssets(UUID avatarId) |
814 | { | 787 | { |
815 | OSDArray data = new OSDArray(); | 788 | OSDArray data = new OSDArray(); |
816 | string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; | 789 | const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id"; |
817 | 790 | ||
818 | // Get classified image assets | 791 | // Get classified image assets |
819 | 792 | ||
820 | |||
821 | try | 793 | try |
822 | { | 794 | { |
823 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 795 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
824 | { | 796 | { |
825 | dbcon.Open(); | 797 | dbcon.Open(); |
826 | 798 | ||
827 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon)) | 799 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon)) |
828 | { | 800 | { |
829 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 801 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
830 | 802 | ||
831 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 803 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
832 | { | 804 | { |
833 | if(reader.HasRows) | 805 | if(reader.HasRows) |
@@ -843,10 +815,10 @@ namespace OpenSim.Data.MySQL | |||
843 | dbcon.Close(); | 815 | dbcon.Close(); |
844 | dbcon.Open(); | 816 | dbcon.Open(); |
845 | 817 | ||
846 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 818 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon)) |
847 | { | 819 | { |
848 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 820 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
849 | 821 | ||
850 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 822 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
851 | { | 823 | { |
852 | if(reader.HasRows) | 824 | if(reader.HasRows) |
@@ -858,16 +830,16 @@ namespace OpenSim.Data.MySQL | |||
858 | } | 830 | } |
859 | } | 831 | } |
860 | } | 832 | } |
861 | 833 | ||
862 | dbcon.Close(); | 834 | dbcon.Close(); |
863 | dbcon.Open(); | 835 | dbcon.Open(); |
864 | 836 | ||
865 | query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; | 837 | const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id"; |
866 | 838 | ||
867 | using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon)) | 839 | using (MySqlCommand cmd = new MySqlCommand(string.Format (queryB,"`userpicks`"), dbcon)) |
868 | { | 840 | { |
869 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); | 841 | cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); |
870 | 842 | ||
871 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 843 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
872 | { | 844 | { |
873 | if(reader.HasRows) | 845 | if(reader.HasRows) |
@@ -880,27 +852,21 @@ namespace OpenSim.Data.MySQL | |||
880 | } | 852 | } |
881 | } | 853 | } |
882 | } | 854 | } |
855 | dbcon.Close(); | ||
883 | } | 856 | } |
884 | } | 857 | } |
885 | catch (Exception e) | 858 | catch (Exception e) |
886 | { | 859 | { |
887 | m_log.ErrorFormat("[PROFILES_DATA]" + | 860 | m_log.ErrorFormat("[PROFILES_DATA]: GetUserImageAssets exception {0}", e.Message); |
888 | ": GetAvatarNotes exception {0}", e.Message); | ||
889 | } | 861 | } |
890 | return data; | 862 | return data; |
891 | } | 863 | } |
892 | 864 | ||
893 | #region User Preferences | 865 | #region User Preferences |
894 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | 866 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) |
895 | { | 867 | { |
896 | string query = string.Empty; | 868 | const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id"; |
897 | 869 | ||
898 | query += "SELECT imviaemail,visible,email FROM "; | ||
899 | query += "usersettings WHERE "; | ||
900 | query += "useruuid = ?Id"; | ||
901 | |||
902 | OSDArray data = new OSDArray(); | ||
903 | |||
904 | try | 870 | try |
905 | { | 871 | { |
906 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 872 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -909,10 +875,9 @@ namespace OpenSim.Data.MySQL | |||
909 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) | 875 | using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) |
910 | { | 876 | { |
911 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | 877 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); |
912 | |||
913 | using (MySqlDataReader reader = cmd.ExecuteReader()) | 878 | using (MySqlDataReader reader = cmd.ExecuteReader()) |
914 | { | 879 | { |
915 | if(reader.HasRows) | 880 | if (reader.HasRows) |
916 | { | 881 | { |
917 | reader.Read(); | 882 | reader.Read(); |
918 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | 883 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); |
@@ -923,13 +888,12 @@ namespace OpenSim.Data.MySQL | |||
923 | { | 888 | { |
924 | dbcon.Close(); | 889 | dbcon.Close(); |
925 | dbcon.Open(); | 890 | dbcon.Open(); |
926 | |||
927 | query = "INSERT INTO usersettings VALUES "; | ||
928 | query += "(?uuid,'false','false', ?Email)"; | ||
929 | 891 | ||
930 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 892 | const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)"; |
893 | |||
894 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) | ||
931 | { | 895 | { |
932 | 896 | ||
933 | put.Parameters.AddWithValue("?Email", pref.EMail); | 897 | put.Parameters.AddWithValue("?Email", pref.EMail); |
934 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); | 898 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
935 | 899 | ||
@@ -938,28 +902,24 @@ namespace OpenSim.Data.MySQL | |||
938 | } | 902 | } |
939 | } | 903 | } |
940 | } | 904 | } |
905 | dbcon.Close(); | ||
941 | } | 906 | } |
942 | } | 907 | } |
943 | catch (Exception e) | 908 | catch (Exception e) |
944 | { | 909 | { |
945 | m_log.ErrorFormat("[PROFILES_DATA]" + | 910 | m_log.ErrorFormat("[PROFILES_DATA]: GetUserPreferences exception {0}", e.Message); |
946 | ": Get preferences exception {0}", e.Message); | ||
947 | result = e.Message; | 911 | result = e.Message; |
948 | return false; | 912 | return false; |
949 | } | 913 | } |
950 | return true; | 914 | return true; |
951 | } | 915 | } |
952 | 916 | ||
953 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | 917 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) |
954 | { | 918 | { |
955 | string query = string.Empty; | 919 | const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail," |
956 | 920 | + "visible=?Visible, email=?EMail " | |
957 | query += "UPDATE usersettings SET "; | 921 | + "WHERE useruuid=?uuid"; |
958 | query += "imviaemail=?ImViaEmail, "; | 922 | |
959 | query += "visible=?Visible, "; | ||
960 | query += "email=?EMail "; | ||
961 | query += "WHERE useruuid=?uuid"; | ||
962 | |||
963 | try | 923 | try |
964 | { | 924 | { |
965 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 925 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -974,28 +934,24 @@ namespace OpenSim.Data.MySQL | |||
974 | 934 | ||
975 | cmd.ExecuteNonQuery(); | 935 | cmd.ExecuteNonQuery(); |
976 | } | 936 | } |
937 | dbcon.Close(); | ||
977 | } | 938 | } |
978 | } | 939 | } |
979 | catch (Exception e) | 940 | catch (Exception e) |
980 | { | 941 | { |
981 | m_log.ErrorFormat("[PROFILES_DATA]" + | 942 | m_log.ErrorFormat("[PROFILES_DATA]: UpdateUserPreferences exception {0} {1}", e.Message, e.InnerException); |
982 | ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException); | ||
983 | result = e.Message; | 943 | result = e.Message; |
984 | return false; | 944 | return false; |
985 | } | 945 | } |
986 | return true; | 946 | return true; |
987 | } | 947 | } |
988 | #endregion User Preferences | 948 | #endregion User Preferences |
989 | 949 | ||
990 | #region Integration | 950 | #region Integration |
991 | public bool GetUserAppData(ref UserAppData props, ref string result) | 951 | public bool GetUserAppData(ref UserAppData props, ref string result) |
992 | { | 952 | { |
993 | string query = string.Empty; | 953 | const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId"; |
994 | 954 | ||
995 | query += "SELECT * FROM `userdata` WHERE "; | ||
996 | query += "UserId = ?Id AND "; | ||
997 | query += "TagId = ?TagId"; | ||
998 | |||
999 | try | 955 | try |
1000 | { | 956 | { |
1001 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 957 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -1005,7 +961,7 @@ namespace OpenSim.Data.MySQL | |||
1005 | { | 961 | { |
1006 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); | 962 | cmd.Parameters.AddWithValue("?Id", props.UserId.ToString()); |
1007 | cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString()); | 963 | cmd.Parameters.AddWithValue ("?TagId", props.TagId.ToString()); |
1008 | 964 | ||
1009 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 965 | using (MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
1010 | { | 966 | { |
1011 | if(reader.HasRows) | 967 | if(reader.HasRows) |
@@ -1016,13 +972,8 @@ namespace OpenSim.Data.MySQL | |||
1016 | } | 972 | } |
1017 | else | 973 | else |
1018 | { | 974 | { |
1019 | query += "INSERT INTO userdata VALUES ( "; | 975 | const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)"; |
1020 | query += "?UserId,"; | 976 | using (MySqlCommand put = new MySqlCommand(queryB, dbcon)) |
1021 | query += "?TagId,"; | ||
1022 | query += "?DataKey,"; | ||
1023 | query += "?DataVal) "; | ||
1024 | |||
1025 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | ||
1026 | { | 977 | { |
1027 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); | 978 | put.Parameters.AddWithValue("?UserId", props.UserId.ToString()); |
1028 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); | 979 | put.Parameters.AddWithValue("?TagId", props.TagId.ToString()); |
@@ -1034,12 +985,12 @@ namespace OpenSim.Data.MySQL | |||
1034 | } | 985 | } |
1035 | } | 986 | } |
1036 | } | 987 | } |
988 | dbcon.Close(); | ||
1037 | } | 989 | } |
1038 | } | 990 | } |
1039 | catch (Exception e) | 991 | catch (Exception e) |
1040 | { | 992 | { |
1041 | m_log.ErrorFormat("[PROFILES_DATA]" + | 993 | m_log.ErrorFormat("[PROFILES_DATA]: GetUserAppData exception {0}", e.Message); |
1042 | ": Requst application data exception {0}", e.Message); | ||
1043 | result = e.Message; | 994 | result = e.Message; |
1044 | return false; | 995 | return false; |
1045 | } | 996 | } |
@@ -1047,16 +998,9 @@ namespace OpenSim.Data.MySQL | |||
1047 | } | 998 | } |
1048 | 999 | ||
1049 | public bool SetUserAppData(UserAppData props, ref string result) | 1000 | public bool SetUserAppData(UserAppData props, ref string result) |
1050 | { | 1001 | { |
1051 | string query = string.Empty; | 1002 | const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId"; |
1052 | 1003 | ||
1053 | query += "UPDATE userdata SET "; | ||
1054 | query += "TagId = ?TagId, "; | ||
1055 | query += "DataKey = ?DataKey, "; | ||
1056 | query += "DataVal = ?DataVal WHERE "; | ||
1057 | query += "UserId = ?UserId AND "; | ||
1058 | query += "TagId = ?TagId"; | ||
1059 | |||
1060 | try | 1004 | try |
1061 | { | 1005 | { |
1062 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) | 1006 | using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) |
@@ -1071,12 +1015,12 @@ namespace OpenSim.Data.MySQL | |||
1071 | 1015 | ||
1072 | cmd.ExecuteNonQuery(); | 1016 | cmd.ExecuteNonQuery(); |
1073 | } | 1017 | } |
1018 | dbcon.Close(); | ||
1074 | } | 1019 | } |
1075 | } | 1020 | } |
1076 | catch (Exception e) | 1021 | catch (Exception e) |
1077 | { | 1022 | { |
1078 | m_log.ErrorFormat("[PROFILES_DATA]" + | 1023 | m_log.ErrorFormat("[PROFILES_DATA]: SetUserAppData exception {0}", e.Message); |
1079 | ": SetUserData exception {0}", e.Message); | ||
1080 | return false; | 1024 | return false; |
1081 | } | 1025 | } |
1082 | return true; | 1026 | return true; |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index af7e876..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> |
@@ -209,7 +223,7 @@ namespace OpenSim.Data.MySQL | |||
209 | { | 223 | { |
210 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | 224 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); |
211 | m_log.WarnFormat( | 225 | m_log.WarnFormat( |
212 | "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | 226 | "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", |
213 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | 227 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); |
214 | } | 228 | } |
215 | 229 | ||
@@ -218,7 +232,7 @@ namespace OpenSim.Data.MySQL | |||
218 | { | 232 | { |
219 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 233 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); |
220 | m_log.WarnFormat( | 234 | m_log.WarnFormat( |
221 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 235 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", |
222 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 236 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); |
223 | } | 237 | } |
224 | 238 | ||
@@ -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 | ||
@@ -341,9 +356,10 @@ namespace OpenSim.Data.MySQL | |||
341 | catch (Exception) | 356 | catch (Exception) |
342 | { | 357 | { |
343 | m_log.ErrorFormat( | 358 | m_log.ErrorFormat( |
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 | ||
@@ -440,38 +456,41 @@ namespace OpenSim.Data.MySQL | |||
440 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 456 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
441 | { | 457 | { |
442 | dbcon.Open(); | 458 | dbcon.Open(); |
443 | MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon); | 459 | using(MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count",dbcon)) |
444 | cmd.Parameters.AddWithValue("?start", start); | ||
445 | cmd.Parameters.AddWithValue("?count", count); | ||
446 | |||
447 | try | ||
448 | { | 460 | { |
449 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) | 461 | cmd.Parameters.AddWithValue("?start",start); |
462 | cmd.Parameters.AddWithValue("?count", count); | ||
463 | |||
464 | try | ||
450 | { | 465 | { |
451 | while (dbReader.Read()) | 466 | using (MySqlDataReader dbReader = cmd.ExecuteReader()) |
452 | { | 467 | { |
453 | AssetMetadata metadata = new AssetMetadata(); | 468 | while (dbReader.Read()) |
454 | metadata.Name = (string)dbReader["Name"]; | 469 | { |
455 | metadata.Description = (string)dbReader["Description"]; | 470 | AssetMetadata metadata = new AssetMetadata(); |
456 | metadata.Type = (sbyte)dbReader["AssetType"]; | 471 | metadata.Name = (string)dbReader["Name"]; |
457 | metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct. | 472 | metadata.Description = (string)dbReader["Description"]; |
458 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); | 473 | metadata.Type = (sbyte)dbReader["AssetType"]; |
459 | metadata.FullID = DBGuid.FromDB(dbReader["ID"]); | 474 | metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct. |
460 | metadata.CreatorID = dbReader["CreatorID"].ToString(); | 475 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); |
476 | metadata.FullID = DBGuid.FromDB(dbReader["ID"]); | ||
477 | metadata.CreatorID = dbReader["CreatorID"].ToString(); | ||
461 | 478 | ||
462 | // We'll ignore this for now - it appears unused! | 479 | // We'll ignore this for now - it appears unused! |
463 | // metadata.SHA1 = dbReader["hash"]); | 480 | // metadata.SHA1 = dbReader["hash"]); |
464 | 481 | ||
465 | UpdateAccessTime(metadata, (int)dbReader["AccessTime"]); | 482 | UpdateAccessTime(metadata, (int)dbReader["AccessTime"]); |
466 | 483 | ||
467 | retList.Add(metadata); | 484 | retList.Add(metadata); |
485 | } | ||
468 | } | 486 | } |
469 | } | 487 | } |
488 | catch (Exception e) | ||
489 | { | ||
490 | m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); | ||
491 | } | ||
470 | } | 492 | } |
471 | catch (Exception e) | 493 | dbcon.Close(); |
472 | { | ||
473 | m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); | ||
474 | } | ||
475 | } | 494 | } |
476 | 495 | ||
477 | return retList; | 496 | return retList; |
@@ -490,9 +509,9 @@ namespace OpenSim.Data.MySQL | |||
490 | cmd.Parameters.AddWithValue("?ID", id); | 509 | cmd.Parameters.AddWithValue("?ID", id); |
491 | cmd.ExecuteNonQuery(); | 510 | cmd.ExecuteNonQuery(); |
492 | } | 511 | } |
493 | |||
494 | // 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 |
495 | // keep a reference count (?) | 513 | // keep a reference count (?) |
514 | dbcon.Close(); | ||
496 | } | 515 | } |
497 | 516 | ||
498 | return true; | 517 | return true; |
@@ -500,4 +519,4 @@ namespace OpenSim.Data.MySQL | |||
500 | 519 | ||
501 | #endregion | 520 | #endregion |
502 | } | 521 | } |
503 | } \ No newline at end of file | 522 | } |
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index c74033e..5019994 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Data.MySQL | |||
80 | 80 | ||
81 | return m_Items.Store(item); | 81 | return m_Items.Store(item); |
82 | } | 82 | } |
83 | 83 | ||
84 | public bool DeleteFolders(string field, string val) | 84 | public bool DeleteFolders(string field, string val) |
85 | { | 85 | { |
86 | return m_Folders.Delete(field, val); | 86 | return m_Folders.Delete(field, val); |
@@ -193,7 +193,9 @@ namespace OpenSim.Data.MySQL | |||
193 | { | 193 | { |
194 | using (MySqlCommand cmd = new MySqlCommand()) | 194 | using (MySqlCommand cmd = new MySqlCommand()) |
195 | { | 195 | { |
196 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); | 196 | // cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); |
197 | |||
198 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1"); | ||
197 | 199 | ||
198 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); | 200 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); |
199 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); | 201 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); |
@@ -212,15 +214,18 @@ namespace OpenSim.Data.MySQL | |||
212 | { | 214 | { |
213 | cmd.Connection = dbcon; | 215 | cmd.Connection = dbcon; |
214 | 216 | ||
215 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); | 217 | // cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); |
218 | |||
219 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID"); | ||
220 | |||
216 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 221 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); |
217 | cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); | 222 | cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); |
218 | 223 | ||
219 | using (IDataReader reader = cmd.ExecuteReader()) | 224 | using (IDataReader reader = cmd.ExecuteReader()) |
220 | { | 225 | { |
221 | 226 | ||
222 | int perms = 0; | 227 | int perms = 0; |
223 | 228 | ||
224 | if (reader.Read()) | 229 | if (reader.Read()) |
225 | { | 230 | { |
226 | perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); | 231 | perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); |
@@ -323,7 +328,6 @@ namespace OpenSim.Data.MySQL | |||
323 | { | 328 | { |
324 | return false; | 329 | return false; |
325 | } | 330 | } |
326 | cmd.Dispose(); | ||
327 | } | 331 | } |
328 | 332 | ||
329 | dbcon.Close(); | 333 | dbcon.Close(); |
diff --git a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs index b46d175..6507a37 100644 --- a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.8.2.*")] | 64 | [assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] |
65 | 65 | ||
diff --git a/OpenSim/Data/MySQL/Resources/AgentPrefs.migrations b/OpenSim/Data/MySQL/Resources/AgentPrefs.migrations index e76db07..d41ae66 100644 --- a/OpenSim/Data/MySQL/Resources/AgentPrefs.migrations +++ b/OpenSim/Data/MySQL/Resources/AgentPrefs.migrations | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `AgentPrefs` ( | 5 | CREATE TABLE IF NOT EXISTS `AgentPrefs` ( |
6 | `PrincipalID` CHAR(36) NOT NULL, | 6 | `PrincipalID` CHAR(36) NOT NULL, |
7 | `AccessPrefs` CHAR(2) NOT NULL DEFAULT 'M', | 7 | `AccessPrefs` CHAR(2) NOT NULL DEFAULT 'M', |
8 | `HoverHeight` DOUBLE(30, 27) NOT NULL DEFAULT 0, | 8 | `HoverHeight` DOUBLE(30, 27) NOT NULL DEFAULT 0, |
diff --git a/OpenSim/Data/MySQL/Resources/AssetStore.migrations b/OpenSim/Data/MySQL/Resources/AssetStore.migrations index 52715fd..07f521b 100644 --- a/OpenSim/Data/MySQL/Resources/AssetStore.migrations +++ b/OpenSim/Data/MySQL/Resources/AssetStore.migrations | |||
@@ -1,81 +1,21 @@ | |||
1 | # ----------------- | 1 | # ----------------- |
2 | :VERSION 1 | 2 | :VERSION 10 |
3 | 3 | ||
4 | BEGIN; | 4 | BEGIN; |
5 | 5 | ||
6 | CREATE TABLE `assets` ( | 6 | CREATE TABLE IF NOT EXISTS `assets` ( |
7 | `id` binary(16) NOT NULL, | ||
8 | `name` varchar(64) NOT NULL, | 7 | `name` varchar(64) NOT NULL, |
9 | `description` varchar(64) NOT NULL, | 8 | `description` varchar(64) NOT NULL, |
10 | `assetType` tinyint(4) NOT NULL, | 9 | `assetType` tinyint(4) NOT NULL, |
11 | `invType` tinyint(4) NOT NULL, | ||
12 | `local` tinyint(1) NOT NULL, | 10 | `local` tinyint(1) NOT NULL, |
13 | `temporary` tinyint(1) NOT NULL, | 11 | `temporary` tinyint(1) NOT NULL, |
14 | `data` longblob NOT NULL, | 12 | `data` longblob NOT NULL, |
13 | `id` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
14 | `create_time` int(11) DEFAULT '0', | ||
15 | `access_time` int(11) DEFAULT '0', | ||
16 | `asset_flags` int(11) NOT NULL DEFAULT '0', | ||
17 | `CreatorID` varchar(128) NOT NULL DEFAULT '', | ||
15 | PRIMARY KEY (`id`) | 18 | PRIMARY KEY (`id`) |
16 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | 19 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
17 | 20 | ||
18 | COMMIT; | 21 | COMMIT; |
19 | |||
20 | # ----------------- | ||
21 | :VERSION 2 | ||
22 | |||
23 | BEGIN; | ||
24 | |||
25 | ALTER TABLE assets change id oldid binary(16); | ||
26 | ALTER TABLE assets add id varchar(36) not null default ''; | ||
27 | UPDATE assets set id = concat(substr(hex(oldid),1,8),"-",substr(hex(oldid),9,4),"-",substr(hex(oldid),13,4),"-",substr(hex(oldid),17,4),"-",substr(hex(oldid),21,12)); | ||
28 | ALTER TABLE assets drop oldid; | ||
29 | ALTER TABLE assets add constraint primary key(id); | ||
30 | |||
31 | COMMIT; | ||
32 | |||
33 | # ----------------- | ||
34 | :VERSION 3 | ||
35 | |||
36 | BEGIN; | ||
37 | |||
38 | ALTER TABLE assets change id oldid varchar(36); | ||
39 | ALTER TABLE assets add id char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
40 | UPDATE assets set id = oldid; | ||
41 | ALTER TABLE assets drop oldid; | ||
42 | ALTER TABLE assets add constraint primary key(id); | ||
43 | |||
44 | COMMIT; | ||
45 | |||
46 | # ----------------- | ||
47 | :VERSION 4 | ||
48 | |||
49 | BEGIN; | ||
50 | |||
51 | ALTER TABLE assets drop InvType; | ||
52 | |||
53 | COMMIT; | ||
54 | |||
55 | # ----------------- | ||
56 | :VERSION 5 | ||
57 | |||
58 | BEGIN; | ||
59 | |||
60 | ALTER TABLE assets add create_time integer default 0; | ||
61 | ALTER TABLE assets add access_time integer default 0; | ||
62 | |||
63 | COMMIT; | ||
64 | |||
65 | # ----------------- | ||
66 | :VERSION 6 | ||
67 | |||
68 | DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621' | ||
69 | |||
70 | :VERSION 7 | ||
71 | |||
72 | ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0; | ||
73 | |||
74 | :VERSION 8 | ||
75 | |||
76 | ALTER TABLE assets ADD COLUMN CreatorID varchar(128) NOT NULL DEFAULT ''; | ||
77 | |||
78 | :VERSION 9 | ||
79 | |||
80 | BEGIN; | ||
81 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/AuthStore.migrations b/OpenSim/Data/MySQL/Resources/AuthStore.migrations index 9450940..8d24fbd 100644 --- a/OpenSim/Data/MySQL/Resources/AuthStore.migrations +++ b/OpenSim/Data/MySQL/Resources/AuthStore.migrations | |||
@@ -1,16 +1,17 @@ | |||
1 | :VERSION 1 # ------------------------------- | 1 | :VERSION 4 # ------------------------------- |
2 | 2 | ||
3 | begin; | 3 | begin; |
4 | 4 | ||
5 | CREATE TABLE `auth` ( | 5 | CREATE TABLE IF NOT EXISTS `auth` ( |
6 | `UUID` char(36) NOT NULL, | 6 | `UUID` char(36) NOT NULL, |
7 | `passwordHash` char(32) NOT NULL default '', | 7 | `passwordHash` char(32) NOT NULL DEFAULT '', |
8 | `passwordSalt` char(32) NOT NULL default '', | 8 | `passwordSalt` char(32) NOT NULL DEFAULT '', |
9 | `webLoginKey` varchar(255) NOT NULL default '', | 9 | `webLoginKey` varchar(255) NOT NULL DEFAULT '', |
10 | PRIMARY KEY (`UUID`) | 10 | `accountType` varchar(32) NOT NULL DEFAULT 'UserAccount', |
11 | ) ENGINE=MyISAM; | 11 | PRIMARY KEY (`UUID`) |
12 | 12 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
13 | CREATE TABLE `tokens` ( | 13 | |
14 | CREATE TABLE IF NOT EXISTS `tokens` ( | ||
14 | `UUID` char(36) NOT NULL, | 15 | `UUID` char(36) NOT NULL, |
15 | `token` varchar(255) NOT NULL, | 16 | `token` varchar(255) NOT NULL, |
16 | `validity` datetime NOT NULL, | 17 | `validity` datetime NOT NULL, |
@@ -18,22 +19,6 @@ CREATE TABLE `tokens` ( | |||
18 | KEY `UUID` (`UUID`), | 19 | KEY `UUID` (`UUID`), |
19 | KEY `token` (`token`), | 20 | KEY `token` (`token`), |
20 | KEY `validity` (`validity`) | 21 | KEY `validity` (`validity`) |
21 | ) ENGINE=MyISAM; | 22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
22 | |||
23 | commit; | ||
24 | |||
25 | :VERSION 2 # ------------------------------- | ||
26 | |||
27 | BEGIN; | ||
28 | |||
29 | INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users; | ||
30 | |||
31 | COMMIT; | ||
32 | |||
33 | :VERSION 3 # ------------------------------- | ||
34 | |||
35 | BEGIN; | ||
36 | |||
37 | ALTER TABLE `auth` ADD COLUMN `accountType` VARCHAR(32) NOT NULL DEFAULT 'UserAccount'; | ||
38 | 23 | ||
39 | COMMIT; | 24 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/Avatar.migrations b/OpenSim/Data/MySQL/Resources/Avatar.migrations index f7cf176..66f75b2 100644 --- a/OpenSim/Data/MySQL/Resources/Avatar.migrations +++ b/OpenSim/Data/MySQL/Resources/Avatar.migrations | |||
@@ -1,20 +1,13 @@ | |||
1 | :VERSION 1 | 1 | :VERSION 3 |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE Avatars ( | 5 | CREATE TABLE IF NOT EXISTS `Avatars` ( |
6 | PrincipalID CHAR(36) NOT NULL, | 6 | `PrincipalID` char(36) NOT NULL, |
7 | Name VARCHAR(32) NOT NULL, | 7 | `Name` varchar(32) NOT NULL, |
8 | Value VARCHAR(255) NOT NULL DEFAULT '', | 8 | `Value` text, |
9 | PRIMARY KEY(PrincipalID, Name), | 9 | PRIMARY KEY (`PrincipalID`,`Name`), |
10 | KEY(PrincipalID)); | 10 | KEY `PrincipalID` (`PrincipalID`) |
11 | 11 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
12 | COMMIT; | ||
13 | |||
14 | :VERSION 2 | ||
15 | |||
16 | BEGIN; | ||
17 | |||
18 | alter table Avatars change column Value Value text; | ||
19 | 12 | ||
20 | COMMIT; | 13 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/EstateStore.migrations b/OpenSim/Data/MySQL/Resources/EstateStore.migrations index 9dfb77b..9c1ed83 100644 --- a/OpenSim/Data/MySQL/Resources/EstateStore.migrations +++ b/OpenSim/Data/MySQL/Resources/EstateStore.migrations | |||
@@ -1,41 +1,29 @@ | |||
1 | :VERSION 13 | 1 | :VERSION 34 |
2 | |||
3 | # The estate migrations used to be in Region store | ||
4 | # here they will do nothing (bad) if the tables are already there, | ||
5 | # just update the store version. | ||
6 | 2 | ||
7 | BEGIN; | 3 | BEGIN; |
8 | 4 | ||
9 | CREATE TABLE IF NOT EXISTS `estate_managers` ( | ||
10 | `EstateID` int(10) unsigned NOT NULL, | ||
11 | `uuid` char(36) NOT NULL, | ||
12 | KEY `EstateID` (`EstateID`) | ||
13 | ) ENGINE=MyISAM; | ||
14 | |||
15 | CREATE TABLE IF NOT EXISTS `estate_groups` ( | 5 | CREATE TABLE IF NOT EXISTS `estate_groups` ( |
16 | `EstateID` int(10) unsigned NOT NULL, | 6 | `EstateID` int(10) unsigned NOT NULL, |
17 | `uuid` char(36) NOT NULL, | 7 | `uuid` char(36) NOT NULL, |
18 | KEY `EstateID` (`EstateID`) | 8 | KEY `EstateID` (`EstateID`) |
19 | ) ENGINE=MyISAM; | 9 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
20 | 10 | ||
21 | CREATE TABLE IF NOT EXISTS `estate_users` ( | 11 | CREATE TABLE IF NOT EXISTS `estate_managers` ( |
22 | `EstateID` int(10) unsigned NOT NULL, | 12 | `EstateID` int(10) unsigned NOT NULL, |
23 | `uuid` char(36) NOT NULL, | 13 | `uuid` char(36) NOT NULL, |
24 | KEY `EstateID` (`EstateID`) | 14 | KEY `EstateID` (`EstateID`) |
25 | ) ENGINE=MyISAM; | 15 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
26 | 16 | ||
27 | CREATE TABLE IF NOT EXISTS `estateban` ( | 17 | CREATE TABLE IF NOT EXISTS `estate_map` ( |
28 | `EstateID` int(10) unsigned NOT NULL, | 18 | `RegionID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
29 | `bannedUUID` varchar(36) NOT NULL, | 19 | `EstateID` int(11) NOT NULL, |
30 | `bannedIp` varchar(16) NOT NULL, | 20 | PRIMARY KEY (`RegionID`), |
31 | `bannedIpHostMask` varchar(16) NOT NULL, | 21 | KEY `EstateID` (`EstateID`) |
32 | `bannedNameMask` varchar(64) default NULL, | 22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
33 | KEY `estateban_EstateID` (`EstateID`) | ||
34 | ) ENGINE=MyISAM; | ||
35 | 23 | ||
36 | CREATE TABLE IF NOT EXISTS `estate_settings` ( | 24 | CREATE TABLE IF NOT EXISTS `estate_settings` ( |
37 | `EstateID` int(10) unsigned NOT NULL auto_increment, | 25 | `EstateID` int(10) unsigned NOT NULL AUTO_INCREMENT, |
38 | `EstateName` varchar(64) default NULL, | 26 | `EstateName` varchar(64) DEFAULT NULL, |
39 | `AbuseEmailToEstateOwner` tinyint(4) NOT NULL, | 27 | `AbuseEmailToEstateOwner` tinyint(4) NOT NULL, |
40 | `DenyAnonymous` tinyint(4) NOT NULL, | 28 | `DenyAnonymous` tinyint(4) NOT NULL, |
41 | `ResetHomeOnTeleport` tinyint(4) NOT NULL, | 29 | `ResetHomeOnTeleport` tinyint(4) NOT NULL, |
@@ -55,33 +43,29 @@ CREATE TABLE IF NOT EXISTS `estate_settings` ( | |||
55 | `EstateSkipScripts` tinyint(4) NOT NULL, | 43 | `EstateSkipScripts` tinyint(4) NOT NULL, |
56 | `BillableFactor` float NOT NULL, | 44 | `BillableFactor` float NOT NULL, |
57 | `PublicAccess` tinyint(4) NOT NULL, | 45 | `PublicAccess` tinyint(4) NOT NULL, |
58 | `AbuseEmail` varchar(255) not null, | 46 | `AbuseEmail` varchar(255) NOT NULL, |
59 | `EstateOwner` varchar(36) not null, | 47 | `EstateOwner` varchar(36) NOT NULL, |
60 | `DenyMinors` tinyint not null, | 48 | `DenyMinors` tinyint(4) NOT NULL, |
61 | 49 | `AllowLandmark` tinyint(4) NOT NULL DEFAULT '1', | |
62 | PRIMARY KEY (`EstateID`) | 50 | `AllowParcelChanges` tinyint(4) NOT NULL DEFAULT '1', |
63 | ) ENGINE=MyISAM AUTO_INCREMENT=100; | 51 | `AllowSetHome` tinyint(4) NOT NULL DEFAULT '1', |
52 | PRIMARY KEY (`EstateID`) | ||
53 | ) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=utf8; | ||
64 | 54 | ||
65 | CREATE TABLE IF NOT EXISTS `estate_map` ( | 55 | CREATE TABLE IF NOT EXISTS `estate_users` ( |
66 | `RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000', | 56 | `EstateID` int(10) unsigned NOT NULL, |
67 | `EstateID` int(11) NOT NULL, | 57 | `uuid` char(36) NOT NULL, |
68 | PRIMARY KEY (`RegionID`), | ||
69 | KEY `EstateID` (`EstateID`) | 58 | KEY `EstateID` (`EstateID`) |
70 | ) ENGINE=MyISAM; | 59 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
71 | 60 | ||
72 | COMMIT; | 61 | CREATE TABLE IF NOT EXISTS `estateban` ( |
73 | 62 | `EstateID` int(10) unsigned NOT NULL, | |
74 | :VERSION 32 #--------------------- (moved from RegionStore migr, just in case) | 63 | `bannedUUID` varchar(36) NOT NULL, |
75 | 64 | `bannedIp` varchar(16) NOT NULL, | |
76 | BEGIN; | 65 | `bannedIpHostMask` varchar(16) NOT NULL, |
77 | ALTER TABLE estate_settings AUTO_INCREMENT = 100; | 66 | `bannedNameMask` varchar(64) DEFAULT NULL, |
78 | COMMIT; | 67 | KEY `estateban_EstateID` (`EstateID`) |
79 | 68 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
80 | :VERSION 33 #--------------------- | ||
81 | 69 | ||
82 | BEGIN; | ||
83 | ALTER TABLE estate_settings ADD COLUMN `AllowLandmark` tinyint(4) NOT NULL default '1'; | ||
84 | ALTER TABLE estate_settings ADD COLUMN `AllowParcelChanges` tinyint(4) NOT NULL default '1'; | ||
85 | ALTER TABLE estate_settings ADD COLUMN `AllowSetHome` tinyint(4) NOT NULL default '1'; | ||
86 | COMMIT; | 70 | COMMIT; |
87 | 71 | ||
diff --git a/OpenSim/Data/MySQL/Resources/FSAssetStore.migrations b/OpenSim/Data/MySQL/Resources/FSAssetStore.migrations index 4194af3..3f65d9e 100644 --- a/OpenSim/Data/MySQL/Resources/FSAssetStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FSAssetStore.migrations | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | BEGIN; | 4 | BEGIN; |
5 | 5 | ||
6 | CREATE TABLE `fsassets` ( | 6 | CREATE TABLE IF NOT EXISTS `fsassets` ( |
7 | `id` char(36) NOT NULL, | 7 | `id` char(36) NOT NULL, |
8 | `name` varchar(64) NOT NULL DEFAULT '', | 8 | `name` varchar(64) NOT NULL DEFAULT '', |
9 | `description` varchar(64) NOT NULL DEFAULT '', | 9 | `description` varchar(64) NOT NULL DEFAULT '', |
@@ -15,4 +15,4 @@ CREATE TABLE `fsassets` ( | |||
15 | PRIMARY KEY (`id`) | 15 | PRIMARY KEY (`id`) |
16 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 16 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
17 | 17 | ||
18 | COMMIT; \ No newline at end of file | 18 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 5de0e35..7dc7607 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations | |||
@@ -1,32 +1,14 @@ | |||
1 | :VERSION 1 # ------------------------- | 1 | :VERSION 4 # ------------------------- |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `Friends` ( | 5 | CREATE TABLE IF NOT EXISTS `Friends` ( |
6 | `PrincipalID` CHAR(36) NOT NULL, | 6 | `PrincipalID` varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
7 | `Friend` VARCHAR(255) NOT NULL, | 7 | `Friend` varchar(255) NOT NULL, |
8 | `Flags` VARCHAR(16) NOT NULL DEFAULT 0, | 8 | `Flags` varchar(16) NOT NULL DEFAULT '0', |
9 | `Offered` VARCHAR(32) NOT NULL DEFAULT 0, | 9 | `Offered` varchar(32) NOT NULL DEFAULT '0', |
10 | PRIMARY KEY(`PrincipalID`, `Friend`), | 10 | PRIMARY KEY (`PrincipalID`(36),`Friend`(36)), |
11 | KEY(`PrincipalID`) | 11 | KEY `PrincipalID` (`PrincipalID`) |
12 | ) ENGINE=MyISAM; | 12 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
13 | |||
14 | COMMIT; | ||
15 | |||
16 | :VERSION 2 # ------------------------- | ||
17 | |||
18 | BEGIN; | ||
19 | |||
20 | INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`; | ||
21 | |||
22 | COMMIT; | ||
23 | |||
24 | :VERSION 3 # ------------------------- | ||
25 | |||
26 | BEGIN; | ||
27 | |||
28 | ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
29 | ALTER TABLE `Friends` DROP PRIMARY KEY; | ||
30 | ALTER TABLE `Friends` ADD PRIMARY KEY(PrincipalID(36), Friend(36)); | ||
31 | 13 | ||
32 | COMMIT; | 14 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/GridStore.migrations b/OpenSim/Data/MySQL/Resources/GridStore.migrations index 52ced24..4116235 100644 --- a/OpenSim/Data/MySQL/Resources/GridStore.migrations +++ b/OpenSim/Data/MySQL/Resources/GridStore.migrations | |||
@@ -1,109 +1,52 @@ | |||
1 | :VERSION 1 | 1 | :VERSION 10 |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `regions` ( | 5 | CREATE TABLE IF NOT EXISTS `regions` ( |
6 | `uuid` varchar(36) NOT NULL, | 6 | `uuid` varchar(36) NOT NULL, |
7 | `regionHandle` bigint(20) unsigned NOT NULL, | 7 | `regionHandle` bigint(20) unsigned NOT NULL, |
8 | `regionName` varchar(32) default NULL, | 8 | `regionName` varchar(128) DEFAULT NULL, |
9 | `regionRecvKey` varchar(128) default NULL, | 9 | `regionRecvKey` varchar(128) DEFAULT NULL, |
10 | `regionSendKey` varchar(128) default NULL, | 10 | `regionSendKey` varchar(128) DEFAULT NULL, |
11 | `regionSecret` varchar(128) default NULL, | 11 | `regionSecret` varchar(128) DEFAULT NULL, |
12 | `regionDataURI` varchar(255) default NULL, | 12 | `regionDataURI` varchar(255) DEFAULT NULL, |
13 | `serverIP` varchar(64) default NULL, | 13 | `serverIP` varchar(64) DEFAULT NULL, |
14 | `serverPort` int(10) unsigned default NULL, | 14 | `serverPort` int(10) unsigned DEFAULT NULL, |
15 | `serverURI` varchar(255) default NULL, | 15 | `serverURI` varchar(255) DEFAULT NULL, |
16 | `locX` int(10) unsigned default NULL, | 16 | `locX` int(10) unsigned DEFAULT NULL, |
17 | `locY` int(10) unsigned default NULL, | 17 | `locY` int(10) unsigned DEFAULT NULL, |
18 | `locZ` int(10) unsigned default NULL, | 18 | `locZ` int(10) unsigned DEFAULT NULL, |
19 | `eastOverrideHandle` bigint(20) unsigned default NULL, | 19 | `eastOverrideHandle` bigint(20) unsigned DEFAULT NULL, |
20 | `westOverrideHandle` bigint(20) unsigned default NULL, | 20 | `westOverrideHandle` bigint(20) unsigned DEFAULT NULL, |
21 | `southOverrideHandle` bigint(20) unsigned default NULL, | 21 | `southOverrideHandle` bigint(20) unsigned DEFAULT NULL, |
22 | `northOverrideHandle` bigint(20) unsigned default NULL, | 22 | `northOverrideHandle` bigint(20) unsigned DEFAULT NULL, |
23 | `regionAssetURI` varchar(255) default NULL, | 23 | `regionAssetURI` varchar(255) DEFAULT NULL, |
24 | `regionAssetRecvKey` varchar(128) default NULL, | 24 | `regionAssetRecvKey` varchar(128) DEFAULT NULL, |
25 | `regionAssetSendKey` varchar(128) default NULL, | 25 | `regionAssetSendKey` varchar(128) DEFAULT NULL, |
26 | `regionUserURI` varchar(255) default NULL, | 26 | `regionUserURI` varchar(255) DEFAULT NULL, |
27 | `regionUserRecvKey` varchar(128) default NULL, | 27 | `regionUserRecvKey` varchar(128) DEFAULT NULL, |
28 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, | 28 | `regionUserSendKey` varchar(128) DEFAULT NULL, |
29 | `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, | 29 | `regionMapTexture` varchar(36) DEFAULT NULL, |
30 | `owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null, | 30 | `serverHttpPort` int(10) DEFAULT NULL, |
31 | `originUUID` varchar(36), | 31 | `serverRemotingPort` int(10) DEFAULT NULL, |
32 | PRIMARY KEY (`uuid`), | 32 | `owner_uuid` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
33 | `originUUID` varchar(36) DEFAULT NULL, | ||
34 | `access` int(10) unsigned DEFAULT '1', | ||
35 | `ScopeID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
36 | `sizeX` int(11) NOT NULL DEFAULT '0', | ||
37 | `sizeY` int(11) NOT NULL DEFAULT '0', | ||
38 | `flags` int(11) NOT NULL DEFAULT '0', | ||
39 | `last_seen` int(11) NOT NULL DEFAULT '0', | ||
40 | `PrincipalID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
41 | `Token` varchar(255) NOT NULL, | ||
42 | `parcelMapTexture` varchar(36) DEFAULT NULL, | ||
43 | PRIMARY KEY (`uuid`), | ||
33 | KEY `regionName` (`regionName`), | 44 | KEY `regionName` (`regionName`), |
34 | KEY `regionHandle` (`regionHandle`), | 45 | KEY `regionHandle` (`regionHandle`), |
35 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) | 46 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`), |
47 | KEY `ScopeID` (`ScopeID`), | ||
48 | KEY `flags` (`flags`) | ||
36 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 49 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
37 | 50 | ||
38 | COMMIT; | 51 | COMMIT; |
39 | 52 | ||
40 | :VERSION 2 | ||
41 | |||
42 | BEGIN; | ||
43 | |||
44 | ALTER TABLE regions add column access integer unsigned default 1; | ||
45 | |||
46 | COMMIT; | ||
47 | |||
48 | :VERSION 3 | ||
49 | |||
50 | BEGIN; | ||
51 | |||
52 | ALTER TABLE regions add column ScopeID char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
53 | |||
54 | create index ScopeID on regions(ScopeID); | ||
55 | |||
56 | COMMIT; | ||
57 | |||
58 | :VERSION 4 | ||
59 | |||
60 | BEGIN; | ||
61 | |||
62 | ALTER TABLE regions add column sizeX integer not null default 0; | ||
63 | ALTER TABLE regions add column sizeY integer not null default 0; | ||
64 | |||
65 | COMMIT; | ||
66 | |||
67 | :VERSION 5 | ||
68 | |||
69 | BEGIN; | ||
70 | |||
71 | ALTER TABLE `regions` ADD COLUMN `flags` integer NOT NULL DEFAULT 0; | ||
72 | CREATE INDEX flags ON regions(flags); | ||
73 | |||
74 | COMMIT; | ||
75 | |||
76 | :VERSION 6 | ||
77 | |||
78 | BEGIN; | ||
79 | |||
80 | ALTER TABLE `regions` ADD COLUMN `last_seen` integer NOT NULL DEFAULT 0; | ||
81 | |||
82 | COMMIT; | ||
83 | |||
84 | :VERSION 7 | ||
85 | |||
86 | BEGIN; | ||
87 | |||
88 | ALTER TABLE `regions` ADD COLUMN `PrincipalID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
89 | ALTER TABLE `regions` ADD COLUMN `Token` varchar(255) NOT NULL; | ||
90 | |||
91 | COMMIT; | ||
92 | |||
93 | |||
94 | :VERSION 8 # ------------ | ||
95 | |||
96 | BEGIN; | ||
97 | |||
98 | alter table regions modify column regionName varchar(128) default NULL; | ||
99 | |||
100 | COMMIT; | ||
101 | |||
102 | :VERSION 9 # ------------ | ||
103 | |||
104 | BEGIN; | ||
105 | |||
106 | alter table regions add column `parcelMapTexture` varchar(36) default NULL; | ||
107 | |||
108 | COMMIT; | ||
109 | |||
diff --git a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations index e2be27e..dd73974 100644 --- a/OpenSim/Data/MySQL/Resources/GridUserStore.migrations +++ b/OpenSim/Data/MySQL/Resources/GridUserStore.migrations | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `GridUser` ( | 5 | CREATE TABLE IF NOT EXISTS `GridUser` ( |
6 | `UserID` VARCHAR(255) NOT NULL, | 6 | `UserID` VARCHAR(255) NOT NULL, |
7 | `HomeRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | 7 | `HomeRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
8 | `HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>', | 8 | `HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>', |
@@ -14,11 +14,6 @@ CREATE TABLE `GridUser` ( | |||
14 | `Login` CHAR(16) NOT NULL DEFAULT '0', | 14 | `Login` CHAR(16) NOT NULL DEFAULT '0', |
15 | `Logout` CHAR(16) NOT NULL DEFAULT '0', | 15 | `Logout` CHAR(16) NOT NULL DEFAULT '0', |
16 | PRIMARY KEY (`UserID`) | 16 | PRIMARY KEY (`UserID`) |
17 | ) ENGINE=MyISAM; | 17 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
18 | |||
19 | COMMIT; | ||
20 | |||
21 | :VERSION 2 # -------------------------- | ||
22 | BEGIN; | ||
23 | 18 | ||
24 | COMMIT; | 19 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations index 06ca29d..ed1fede 100644 --- a/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations +++ b/OpenSim/Data/MySQL/Resources/HGTravelStore.migrations | |||
@@ -2,17 +2,16 @@ | |||
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `hg_traveling_data` ( | 5 | CREATE TABLE IF NOT EXISTS `hg_traveling_data` ( |
6 | `SessionID` VARCHAR(36) NOT NULL, | 6 | `SessionID` VARCHAR(36) NOT NULL, |
7 | `UserID` VARCHAR(36) NOT NULL, | 7 | `UserID` VARCHAR(36) NOT NULL, |
8 | `GridExternalName` VARCHAR(255) NOT NULL DEFAULT '', | 8 | `GridExternalName` VARCHAR(255) NOT NULL DEFAULT '', |
9 | `ServiceToken` VARCHAR(255) NOT NULL DEFAULT '', | 9 | `ServiceToken` VARCHAR(255) NOT NULL DEFAULT '', |
10 | `ClientIPAddress` VARCHAR(16) NOT NULL DEFAULT '', | 10 | `ClientIPAddress` VARCHAR(16) NOT NULL DEFAULT '', |
11 | `MyIPAddress` VARCHAR(16) NOT NULL DEFAULT '', | 11 | `MyIPAddress` VARCHAR(16) NOT NULL DEFAULT '', |
12 | `TMStamp` timestamp NOT NULL, | 12 | `TMStamp` timestamp NOT NULL, |
13 | PRIMARY KEY (`SessionID`), | 13 | PRIMARY KEY (`SessionID`), |
14 | KEY (`UserID`) | 14 | KEY (`UserID`) |
15 | ) ENGINE=MyISAM; | 15 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
16 | 16 | ||
17 | COMMIT; | 17 | COMMIT; |
18 | |||
diff --git a/OpenSim/Data/MySQL/Resources/IM_Store.migrations b/OpenSim/Data/MySQL/Resources/IM_Store.migrations index 79ead98..e271fcc 100644 --- a/OpenSim/Data/MySQL/Resources/IM_Store.migrations +++ b/OpenSim/Data/MySQL/Resources/IM_Store.migrations | |||
@@ -1,42 +1,16 @@ | |||
1 | :VERSION 1 # -------------------------- | 1 | :VERSION 5 # -------------------------- |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `im_offline` ( | 5 | CREATE TABLE IF NOT EXISTS `im_offline` ( |
6 | `ID` MEDIUMINT NOT NULL AUTO_INCREMENT, | 6 | `ID` mediumint(9) NOT NULL AUTO_INCREMENT, |
7 | `PrincipalID` char(36) NOT NULL default '', | 7 | `PrincipalID` char(36) NOT NULL DEFAULT '', |
8 | `FromID` char(36) NOT NULL DEFAULT '', | ||
8 | `Message` text NOT NULL, | 9 | `Message` text NOT NULL, |
9 | `TMStamp` timestamp NOT NULL, | 10 | `TMStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
10 | PRIMARY KEY (`ID`), | 11 | PRIMARY KEY (`ID`), |
11 | KEY `PrincipalID` (`PrincipalID`) | 12 | KEY `PrincipalID` (`PrincipalID`), |
12 | ) ENGINE=MyISAM; | 13 | KEY `FromID` (`FromID`) |
13 | 14 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
14 | COMMIT; | ||
15 | |||
16 | :VERSION 2 # -------------------------- | ||
17 | |||
18 | BEGIN; | ||
19 | |||
20 | INSERT INTO `im_offline` SELECT * from `diva_im_offline`; | ||
21 | DROP TABLE `diva_im_offline`; | ||
22 | DELETE FROM `migrations` WHERE name='diva_im_Store'; | ||
23 | |||
24 | COMMIT; | ||
25 | |||
26 | :VERSION 3 # -------------------------- | ||
27 | |||
28 | BEGIN; | ||
29 | |||
30 | ALTER TABLE `im_offline` | ||
31 | ADD `FromID` char(36) NOT NULL default '' AFTER `PrincipalID`, | ||
32 | ADD KEY `FromID` (`FromID`); | ||
33 | |||
34 | COMMIT; | ||
35 | |||
36 | :VERSION 4 # -------------------------- | ||
37 | |||
38 | BEGIN; | ||
39 | |||
40 | ALTER TABLE im_offline CONVERT TO CHARACTER SET utf8; | ||
41 | 15 | ||
42 | COMMIT; | 16 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/InventoryStore.migrations b/OpenSim/Data/MySQL/Resources/InventoryStore.migrations index ca2fe11..7283e41 100644 --- a/OpenSim/Data/MySQL/Resources/InventoryStore.migrations +++ b/OpenSim/Data/MySQL/Resources/InventoryStore.migrations | |||
@@ -1,109 +1,42 @@ | |||
1 | :VERSION 1 # ------------ | 1 | :VERSION 7 # ------------ |
2 | BEGIN; | 2 | BEGIN; |
3 | 3 | ||
4 | CREATE TABLE `inventoryfolders` ( | 4 | CREATE TABLE IF NOT EXISTS `inventoryitems` ( |
5 | `folderID` varchar(36) NOT NULL default '', | 5 | `assetID` varchar(36) DEFAULT NULL, |
6 | `agentID` varchar(36) default NULL, | 6 | `assetType` int(11) DEFAULT NULL, |
7 | `parentFolderID` varchar(36) default NULL, | 7 | `inventoryName` varchar(64) DEFAULT NULL, |
8 | `folderName` varchar(64) default NULL, | 8 | `inventoryDescription` varchar(128) DEFAULT NULL, |
9 | `type` smallint NOT NULL default 0, | 9 | `inventoryNextPermissions` int(10) unsigned DEFAULT NULL, |
10 | `version` int NOT NULL default 0, | 10 | `inventoryCurrentPermissions` int(10) unsigned DEFAULT NULL, |
11 | PRIMARY KEY (`folderID`), | 11 | `invType` int(11) DEFAULT NULL, |
12 | KEY `owner` (`agentID`), | 12 | `creatorID` varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
13 | KEY `parent` (`parentFolderID`) | 13 | `inventoryBasePermissions` int(10) unsigned NOT NULL DEFAULT '0', |
14 | `inventoryEveryOnePermissions` int(10) unsigned NOT NULL DEFAULT '0', | ||
15 | `salePrice` int(11) NOT NULL DEFAULT '0', | ||
16 | `saleType` tinyint(4) NOT NULL DEFAULT '0', | ||
17 | `creationDate` int(11) NOT NULL DEFAULT '0', | ||
18 | `groupID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
19 | `groupOwned` tinyint(4) NOT NULL DEFAULT '0', | ||
20 | `flags` int(11) unsigned NOT NULL DEFAULT '0', | ||
21 | `inventoryID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
22 | `avatarID` char(36) DEFAULT NULL, | ||
23 | `parentFolderID` char(36) DEFAULT NULL, | ||
24 | `inventoryGroupPermissions` int(10) unsigned NOT NULL DEFAULT '0', | ||
25 | PRIMARY KEY (`inventoryID`), | ||
26 | KEY `inventoryitems_avatarid` (`avatarID`), | ||
27 | KEY `inventoryitems_parentFolderid` (`parentFolderID`) | ||
14 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 28 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
15 | 29 | ||
16 | CREATE TABLE `inventoryitems` ( | 30 | CREATE TABLE IF NOT EXISTS `inventoryfolders` ( |
17 | `inventoryID` varchar(36) NOT NULL default '', | 31 | `folderName` varchar(64) DEFAULT NULL, |
18 | `assetID` varchar(36) default NULL, | 32 | `type` smallint(6) NOT NULL DEFAULT '0', |
19 | `assetType` int(11) default NULL, | 33 | `version` int(11) NOT NULL DEFAULT '0', |
20 | `parentFolderID` varchar(36) default NULL, | 34 | `folderID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
21 | `avatarID` varchar(36) default NULL, | 35 | `agentID` char(36) DEFAULT NULL, |
22 | `inventoryName` varchar(64) default NULL, | 36 | `parentFolderID` char(36) DEFAULT NULL, |
23 | `inventoryDescription` varchar(128) default NULL, | 37 | PRIMARY KEY (`folderID`), |
24 | `inventoryNextPermissions` int(10) unsigned default NULL, | 38 | KEY `inventoryfolders_agentid` (`agentID`), |
25 | `inventoryCurrentPermissions` int(10) unsigned default NULL, | 39 | KEY `inventoryfolders_parentFolderid` (`parentFolderID`) |
26 | `invType` int(11) default NULL, | ||
27 | `creatorID` varchar(36) default NULL, | ||
28 | `inventoryBasePermissions` int(10) unsigned NOT NULL default 0, | ||
29 | `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, | ||
30 | `salePrice` int(11) NOT NULL default 0, | ||
31 | `saleType` tinyint(4) NOT NULL default 0, | ||
32 | `creationDate` int(11) NOT NULL default 0, | ||
33 | `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000', | ||
34 | `groupOwned` tinyint(4) NOT NULL default 0, | ||
35 | `flags` int(11) unsigned NOT NULL default 0, | ||
36 | PRIMARY KEY (`inventoryID`), | ||
37 | KEY `owner` (`avatarID`), | ||
38 | KEY `folder` (`parentFolderID`) | ||
39 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 40 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
40 | 41 | ||
41 | COMMIT; | 42 | COMMIT; |
42 | |||
43 | :VERSION 2 # ------------ | ||
44 | |||
45 | BEGIN; | ||
46 | |||
47 | ALTER TABLE inventoryfolders change folderID folderIDold varchar(36); | ||
48 | ALTER TABLE inventoryfolders change agentID agentIDold varchar(36); | ||
49 | ALTER TABLE inventoryfolders change parentFolderID parentFolderIDold varchar(36); | ||
50 | ALTER TABLE inventoryfolders add folderID char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
51 | ALTER TABLE inventoryfolders add agentID char(36) default NULL; | ||
52 | ALTER TABLE inventoryfolders add parentFolderID char(36) default NULL; | ||
53 | UPDATE inventoryfolders set folderID = folderIDold, agentID = agentIDold, parentFolderID = parentFolderIDold; | ||
54 | ALTER TABLE inventoryfolders drop folderIDold; | ||
55 | ALTER TABLE inventoryfolders drop agentIDold; | ||
56 | ALTER TABLE inventoryfolders drop parentFolderIDold; | ||
57 | ALTER TABLE inventoryfolders add constraint primary key(folderID); | ||
58 | ALTER TABLE inventoryfolders add index inventoryfolders_agentid(agentID); | ||
59 | ALTER TABLE inventoryfolders add index inventoryfolders_parentFolderid(parentFolderID); | ||
60 | |||
61 | ALTER TABLE inventoryitems change inventoryID inventoryIDold varchar(36); | ||
62 | ALTER TABLE inventoryitems change avatarID avatarIDold varchar(36); | ||
63 | ALTER TABLE inventoryitems change parentFolderID parentFolderIDold varchar(36); | ||
64 | ALTER TABLE inventoryitems add inventoryID char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
65 | ALTER TABLE inventoryitems add avatarID char(36) default NULL; | ||
66 | ALTER TABLE inventoryitems add parentFolderID char(36) default NULL; | ||
67 | UPDATE inventoryitems set inventoryID = inventoryIDold, avatarID = avatarIDold, parentFolderID = parentFolderIDold; | ||
68 | ALTER TABLE inventoryitems drop inventoryIDold; | ||
69 | ALTER TABLE inventoryitems drop avatarIDold; | ||
70 | ALTER TABLE inventoryitems drop parentFolderIDold; | ||
71 | ALTER TABLE inventoryitems add constraint primary key(inventoryID); | ||
72 | ALTER TABLE inventoryitems add index inventoryitems_avatarid(avatarID); | ||
73 | ALTER TABLE inventoryitems add index inventoryitems_parentFolderid(parentFolderID); | ||
74 | |||
75 | COMMIT; | ||
76 | |||
77 | :VERSION 3 # ------------ | ||
78 | |||
79 | BEGIN; | ||
80 | |||
81 | alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0; | ||
82 | |||
83 | COMMIT; | ||
84 | |||
85 | :VERSION 4 # ------------ | ||
86 | |||
87 | BEGIN; | ||
88 | |||
89 | update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID is NULL; | ||
90 | update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID = ''; | ||
91 | alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000'; | ||
92 | |||
93 | COMMIT; | ||
94 | |||
95 | :VERSION 5 # ------------ | ||
96 | |||
97 | BEGIN; | ||
98 | |||
99 | alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000'; | ||
100 | |||
101 | COMMIT; | ||
102 | |||
103 | :VERSION 6 # ------------ | ||
104 | |||
105 | BEGIN; | ||
106 | |||
107 | alter table inventoryitems modify column creatorID varchar(255) not NULL default '00000000-0000-0000-0000-000000000000'; | ||
108 | |||
109 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/LogStore.migrations b/OpenSim/Data/MySQL/Resources/LogStore.migrations index b572411..f2990cc 100644 --- a/OpenSim/Data/MySQL/Resources/LogStore.migrations +++ b/OpenSim/Data/MySQL/Resources/LogStore.migrations | |||
@@ -1,7 +1,7 @@ | |||
1 | | 1 | |
2 | :VERSION 1 | 2 | :VERSION 1 |
3 | 3 | ||
4 | CREATE TABLE `logs` ( | 4 | CREATE TABLE IF NOT EXISTS `logs` ( |
5 | `logID` int(10) unsigned NOT NULL auto_increment, | 5 | `logID` int(10) unsigned NOT NULL auto_increment, |
6 | `target` varchar(36) default NULL, | 6 | `target` varchar(36) default NULL, |
7 | `server` varchar(64) default NULL, | 7 | `server` varchar(64) default NULL, |
diff --git a/OpenSim/Data/MySQL/Resources/MuteListStore.migrations b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations new file mode 100644 index 0000000..164dc51 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/MuteListStore.migrations | |||
@@ -0,0 +1,16 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | CREATE TABLE IF NOT EXISTS `MuteList` ( | ||
6 | `AgentID` char(36) NOT NULL, | ||
7 | `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
8 | `MuteName` varchar(64) NOT NULL DEFAULT '', | ||
9 | `MuteType` int(11) NOT NULL DEFAULT '1', | ||
10 | `MuteFlags` int(11) NOT NULL DEFAULT '0', | ||
11 | `Stamp` int(11) NOT NULL, | ||
12 | UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`), | ||
13 | KEY `AgentID` (`AgentID`) | ||
14 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
15 | |||
16 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/Presence.migrations b/OpenSim/Data/MySQL/Resources/Presence.migrations index 6dc9384..4d14b9d 100644 --- a/OpenSim/Data/MySQL/Resources/Presence.migrations +++ b/OpenSim/Data/MySQL/Resources/Presence.migrations | |||
@@ -1,31 +1,16 @@ | |||
1 | :VERSION 1 # -------------------------- | 1 | :VERSION 4 # -------------------------- |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `Presence` ( | 5 | CREATE TABLE IF NOT EXISTS `Presence` ( |
6 | `UserID` VARCHAR(255) NOT NULL, | 6 | `UserID` varchar(255) NOT NULL, |
7 | `RegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | 7 | `RegionID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
8 | `SessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | 8 | `SessionID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
9 | `SecureSessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' | 9 | `SecureSessionID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
10 | ) ENGINE=MyISAM; | 10 | `LastSeen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
11 | 11 | UNIQUE KEY `SessionID` (`SessionID`), | |
12 | CREATE UNIQUE INDEX SessionID ON Presence(SessionID); | 12 | KEY `UserID` (`UserID`), |
13 | CREATE INDEX UserID ON Presence(UserID); | 13 | KEY `RegionID` (`RegionID`) |
14 | 14 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
15 | COMMIT; | ||
16 | |||
17 | :VERSION 2 # -------------------------- | ||
18 | |||
19 | BEGIN; | ||
20 | |||
21 | ALTER TABLE `Presence` ADD COLUMN LastSeen timestamp; | ||
22 | |||
23 | COMMIT; | ||
24 | |||
25 | :VERSION 3 # -------------------------- | ||
26 | |||
27 | BEGIN; | ||
28 | |||
29 | CREATE INDEX RegionID ON Presence(RegionID); | ||
30 | 15 | ||
31 | COMMIT; | 16 | COMMIT; |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 834d249..fb7862a 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -1,354 +1,226 @@ | |||
1 | 1 | ||
2 | :VERSION 1 #--------------------- | 2 | :VERSION 51 #--------------------- |
3 | 3 | ||
4 | BEGIN; | 4 | BEGIN; |
5 | 5 | ||
6 | CREATE TABLE `prims` ( | 6 | CREATE TABLE IF NOT EXISTS `prims` ( |
7 | `UUID` varchar(255) NOT NULL, | 7 | `CreationDate` int(11) DEFAULT NULL, |
8 | `RegionUUID` varchar(255) default NULL, | 8 | `Name` varchar(255) DEFAULT NULL, |
9 | `ParentID` int(11) default NULL, | 9 | `Text` varchar(255) DEFAULT NULL, |
10 | `CreationDate` int(11) default NULL, | 10 | `Description` varchar(255) DEFAULT NULL, |
11 | `Name` varchar(255) default NULL, | 11 | `SitName` varchar(255) DEFAULT NULL, |
12 | `SceneGroupID` varchar(255) default NULL, | 12 | `TouchName` varchar(255) DEFAULT NULL, |
13 | `Text` varchar(255) default NULL, | 13 | `ObjectFlags` int(11) DEFAULT NULL, |
14 | `Description` varchar(255) default NULL, | 14 | `OwnerMask` int(11) DEFAULT NULL, |
15 | `SitName` varchar(255) default NULL, | 15 | `NextOwnerMask` int(11) DEFAULT NULL, |
16 | `TouchName` varchar(255) default NULL, | 16 | `GroupMask` int(11) DEFAULT NULL, |
17 | `ObjectFlags` int(11) default NULL, | 17 | `EveryoneMask` int(11) DEFAULT NULL, |
18 | `CreatorID` varchar(255) default NULL, | 18 | `BaseMask` int(11) DEFAULT NULL, |
19 | `OwnerID` varchar(255) default NULL, | 19 | `PositionX` double DEFAULT NULL, |
20 | `GroupID` varchar(255) default NULL, | 20 | `PositionY` double DEFAULT NULL, |
21 | `LastOwnerID` varchar(255) default NULL, | 21 | `PositionZ` double DEFAULT NULL, |
22 | `OwnerMask` int(11) default NULL, | 22 | `GroupPositionX` double DEFAULT NULL, |
23 | `NextOwnerMask` int(11) default NULL, | 23 | `GroupPositionY` double DEFAULT NULL, |
24 | `GroupMask` int(11) default NULL, | 24 | `GroupPositionZ` double DEFAULT NULL, |
25 | `EveryoneMask` int(11) default NULL, | 25 | `VelocityX` double DEFAULT NULL, |
26 | `BaseMask` int(11) default NULL, | 26 | `VelocityY` double DEFAULT NULL, |
27 | `PositionX` float default NULL, | 27 | `VelocityZ` double DEFAULT NULL, |
28 | `PositionY` float default NULL, | 28 | `AngularVelocityX` double DEFAULT NULL, |
29 | `PositionZ` float default NULL, | 29 | `AngularVelocityY` double DEFAULT NULL, |
30 | `GroupPositionX` float default NULL, | 30 | `AngularVelocityZ` double DEFAULT NULL, |
31 | `GroupPositionY` float default NULL, | 31 | `AccelerationX` double DEFAULT NULL, |
32 | `GroupPositionZ` float default NULL, | 32 | `AccelerationY` double DEFAULT NULL, |
33 | `VelocityX` float default NULL, | 33 | `AccelerationZ` double DEFAULT NULL, |
34 | `VelocityY` float default NULL, | 34 | `RotationX` double DEFAULT NULL, |
35 | `VelocityZ` float default NULL, | 35 | `RotationY` double DEFAULT NULL, |
36 | `AngularVelocityX` float default NULL, | 36 | `RotationZ` double DEFAULT NULL, |
37 | `AngularVelocityY` float default NULL, | 37 | `RotationW` double DEFAULT NULL, |
38 | `AngularVelocityZ` float default NULL, | 38 | `SitTargetOffsetX` double DEFAULT NULL, |
39 | `AccelerationX` float default NULL, | 39 | `SitTargetOffsetY` double DEFAULT NULL, |
40 | `AccelerationY` float default NULL, | 40 | `SitTargetOffsetZ` double DEFAULT NULL, |
41 | `AccelerationZ` float default NULL, | 41 | `SitTargetOrientW` double DEFAULT NULL, |
42 | `RotationX` float default NULL, | 42 | `SitTargetOrientX` double DEFAULT NULL, |
43 | `RotationY` float default NULL, | 43 | `SitTargetOrientY` double DEFAULT NULL, |
44 | `RotationZ` float default NULL, | 44 | `SitTargetOrientZ` double DEFAULT NULL, |
45 | `RotationW` float default NULL, | 45 | `UUID` char(36) NOT NULL DEFAULT '', |
46 | `SitTargetOffsetX` float default NULL, | 46 | `RegionUUID` char(36) DEFAULT NULL, |
47 | `SitTargetOffsetY` float default NULL, | 47 | `CreatorID` varchar(255) NOT NULL DEFAULT '', |
48 | `SitTargetOffsetZ` float default NULL, | 48 | `OwnerID` char(36) DEFAULT NULL, |
49 | `SitTargetOrientW` float default NULL, | 49 | `GroupID` char(36) DEFAULT NULL, |
50 | `SitTargetOrientX` float default NULL, | 50 | `LastOwnerID` char(36) DEFAULT NULL, |
51 | `SitTargetOrientY` float default NULL, | 51 | `SceneGroupID` char(36) DEFAULT NULL, |
52 | `SitTargetOrientZ` float default NULL, | 52 | `PayPrice` int(11) NOT NULL DEFAULT '0', |
53 | PRIMARY KEY (`UUID`) | 53 | `PayButton1` int(11) NOT NULL DEFAULT '0', |
54 | `PayButton2` int(11) NOT NULL DEFAULT '0', | ||
55 | `PayButton3` int(11) NOT NULL DEFAULT '0', | ||
56 | `PayButton4` int(11) NOT NULL DEFAULT '0', | ||
57 | `LoopedSound` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
58 | `LoopedSoundGain` double NOT NULL DEFAULT '0', | ||
59 | `TextureAnimation` blob, | ||
60 | `OmegaX` double NOT NULL DEFAULT '0', | ||
61 | `OmegaY` double NOT NULL DEFAULT '0', | ||
62 | `OmegaZ` double NOT NULL DEFAULT '0', | ||
63 | `CameraEyeOffsetX` double NOT NULL DEFAULT '0', | ||
64 | `CameraEyeOffsetY` double NOT NULL DEFAULT '0', | ||
65 | `CameraEyeOffsetZ` double NOT NULL DEFAULT '0', | ||
66 | `CameraAtOffsetX` double NOT NULL DEFAULT '0', | ||
67 | `CameraAtOffsetY` double NOT NULL DEFAULT '0', | ||
68 | `CameraAtOffsetZ` double NOT NULL DEFAULT '0', | ||
69 | `ForceMouselook` tinyint(4) NOT NULL DEFAULT '0', | ||
70 | `ScriptAccessPin` int(11) NOT NULL DEFAULT '0', | ||
71 | `AllowedDrop` tinyint(4) NOT NULL DEFAULT '0', | ||
72 | `DieAtEdge` tinyint(4) NOT NULL DEFAULT '0', | ||
73 | `SalePrice` int(11) NOT NULL DEFAULT '10', | ||
74 | `SaleType` tinyint(4) NOT NULL DEFAULT '0', | ||
75 | `ColorR` int(11) NOT NULL DEFAULT '0', | ||
76 | `ColorG` int(11) NOT NULL DEFAULT '0', | ||
77 | `ColorB` int(11) NOT NULL DEFAULT '0', | ||
78 | `ColorA` int(11) NOT NULL DEFAULT '0', | ||
79 | `ParticleSystem` blob, | ||
80 | `ClickAction` tinyint(4) NOT NULL DEFAULT '0', | ||
81 | `Material` tinyint(4) NOT NULL DEFAULT '3', | ||
82 | `CollisionSound` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
83 | `CollisionSoundVolume` double NOT NULL DEFAULT '0', | ||
84 | `LinkNumber` int(11) NOT NULL DEFAULT '0', | ||
85 | `PassTouches` tinyint(4) NOT NULL DEFAULT '0', | ||
86 | `MediaURL` varchar(255) DEFAULT NULL, | ||
87 | `DynAttrs` text, | ||
88 | `PhysicsShapeType` tinyint(4) NOT NULL DEFAULT '0', | ||
89 | `Density` double NOT NULL DEFAULT '1000', | ||
90 | `GravityModifier` double NOT NULL DEFAULT '1', | ||
91 | `Friction` double NOT NULL DEFAULT '0.6', | ||
92 | `Restitution` double NOT NULL DEFAULT '0.5', | ||
93 | `KeyframeMotion` blob, | ||
94 | `AttachedPosX` double DEFAULT '0', | ||
95 | `AttachedPosY` double DEFAULT '0', | ||
96 | `AttachedPosZ` double DEFAULT '0', | ||
97 | PRIMARY KEY (`UUID`), | ||
98 | KEY `prims_regionuuid` (`RegionUUID`), | ||
99 | KEY `prims_scenegroupid` (`SceneGroupID`) | ||
54 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 100 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
55 | 101 | ||
56 | CREATE TABLE `primshapes` ( | 102 | CREATE TABLE IF NOT EXISTS `primshapes` ( |
57 | `UUID` varchar(255) NOT NULL, | 103 | `Shape` int(11) DEFAULT NULL, |
58 | `Shape` int(11) default NULL, | 104 | `ScaleX` double NOT NULL DEFAULT '0', |
59 | `ScaleX` float default NULL, | 105 | `ScaleY` double NOT NULL DEFAULT '0', |
60 | `ScaleY` float default NULL, | 106 | `ScaleZ` double NOT NULL DEFAULT '0', |
61 | `ScaleZ` float default NULL, | 107 | `PCode` int(11) DEFAULT NULL, |
62 | `PCode` int(11) default NULL, | 108 | `PathBegin` int(11) DEFAULT NULL, |
63 | `PathBegin` int(11) default NULL, | 109 | `PathEnd` int(11) DEFAULT NULL, |
64 | `PathEnd` int(11) default NULL, | 110 | `PathScaleX` int(11) DEFAULT NULL, |
65 | `PathScaleX` int(11) default NULL, | 111 | `PathScaleY` int(11) DEFAULT NULL, |
66 | `PathScaleY` int(11) default NULL, | 112 | `PathShearX` int(11) DEFAULT NULL, |
67 | `PathShearX` int(11) default NULL, | 113 | `PathShearY` int(11) DEFAULT NULL, |
68 | `PathShearY` int(11) default NULL, | 114 | `PathSkew` int(11) DEFAULT NULL, |
69 | `PathSkew` int(11) default NULL, | 115 | `PathCurve` int(11) DEFAULT NULL, |
70 | `PathCurve` int(11) default NULL, | 116 | `PathRadiusOffset` int(11) DEFAULT NULL, |
71 | `PathRadiusOffset` int(11) default NULL, | 117 | `PathRevolutions` int(11) DEFAULT NULL, |
72 | `PathRevolutions` int(11) default NULL, | 118 | `PathTaperX` int(11) DEFAULT NULL, |
73 | `PathTaperX` int(11) default NULL, | 119 | `PathTaperY` int(11) DEFAULT NULL, |
74 | `PathTaperY` int(11) default NULL, | 120 | `PathTwist` int(11) DEFAULT NULL, |
75 | `PathTwist` int(11) default NULL, | 121 | `PathTwistBegin` int(11) DEFAULT NULL, |
76 | `PathTwistBegin` int(11) default NULL, | 122 | `ProfileBegin` int(11) DEFAULT NULL, |
77 | `ProfileBegin` int(11) default NULL, | 123 | `ProfileEnd` int(11) DEFAULT NULL, |
78 | `ProfileEnd` int(11) default NULL, | 124 | `ProfileCurve` int(11) DEFAULT NULL, |
79 | `ProfileCurve` int(11) default NULL, | 125 | `ProfileHollow` int(11) DEFAULT NULL, |
80 | `ProfileHollow` int(11) default NULL, | 126 | `State` int(11) DEFAULT NULL, |
81 | `State` int(11) default NULL, | ||
82 | `Texture` longblob, | 127 | `Texture` longblob, |
83 | `ExtraParams` longblob, | 128 | `ExtraParams` longblob, |
84 | PRIMARY KEY (`UUID`) | 129 | `UUID` char(36) NOT NULL DEFAULT '', |
130 | `Media` text, | ||
131 | `LastAttachPoint` int(4) NOT NULL DEFAULT '0', | ||
132 | PRIMARY KEY (`UUID`) | ||
85 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 133 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
86 | 134 | ||
87 | CREATE TABLE `primitems` ( | 135 | CREATE TABLE IF NOT EXISTS `primitems` ( |
88 | `itemID` varchar(255) NOT NULL, | 136 | `invType` int(11) DEFAULT NULL, |
89 | `primID` varchar(255) default NULL, | 137 | `assetType` int(11) DEFAULT NULL, |
90 | `assetID` varchar(255) default NULL, | 138 | `name` varchar(255) DEFAULT NULL, |
91 | `parentFolderID` varchar(255) default NULL, | 139 | `description` varchar(255) DEFAULT NULL, |
92 | `invType` int(11) default NULL, | 140 | `creationDate` bigint(20) DEFAULT NULL, |
93 | `assetType` int(11) default NULL, | 141 | `nextPermissions` int(11) DEFAULT NULL, |
94 | `name` varchar(255) default NULL, | 142 | `currentPermissions` int(11) DEFAULT NULL, |
95 | `description` varchar(255) default NULL, | 143 | `basePermissions` int(11) DEFAULT NULL, |
96 | `creationDate` bigint(20) default NULL, | 144 | `everyonePermissions` int(11) DEFAULT NULL, |
97 | `creatorID` varchar(255) default NULL, | 145 | `groupPermissions` int(11) DEFAULT NULL, |
98 | `ownerID` varchar(255) default NULL, | 146 | `flags` int(11) NOT NULL DEFAULT '0', |
99 | `lastOwnerID` varchar(255) default NULL, | 147 | `itemID` char(36) NOT NULL DEFAULT '', |
100 | `groupID` varchar(255) default NULL, | 148 | `primID` char(36) DEFAULT NULL, |
101 | `nextPermissions` int(11) default NULL, | 149 | `assetID` char(36) DEFAULT NULL, |
102 | `currentPermissions` int(11) default NULL, | 150 | `parentFolderID` char(36) DEFAULT NULL, |
103 | `basePermissions` int(11) default NULL, | 151 | `CreatorID` varchar(255) NOT NULL DEFAULT '', |
104 | `everyonePermissions` int(11) default NULL, | 152 | `ownerID` char(36) DEFAULT NULL, |
105 | `groupPermissions` int(11) default NULL, | 153 | `groupID` char(36) DEFAULT NULL, |
106 | PRIMARY KEY (`itemID`) | 154 | `lastOwnerID` char(36) DEFAULT NULL, |
155 | PRIMARY KEY (`itemID`), | ||
156 | KEY `primitems_primid` (`primID`) | ||
107 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 157 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
108 | 158 | ||
109 | CREATE TABLE `terrain` ( | 159 | CREATE TABLE IF NOT EXISTS `terrain` ( |
110 | `RegionUUID` varchar(255) default NULL, | 160 | `RegionUUID` varchar(255) DEFAULT NULL, |
111 | `Revision` int(11) default NULL, | 161 | `Revision` int(11) DEFAULT NULL, |
112 | `Heightfield` longblob | 162 | `Heightfield` longblob |
113 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 163 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
114 | 164 | ||
115 | CREATE TABLE `land` ( | 165 | CREATE TABLE IF NOT EXISTS `land` ( |
116 | `UUID` varchar(255) NOT NULL, | 166 | `UUID` varchar(255) NOT NULL, |
117 | `RegionUUID` varchar(255) default NULL, | 167 | `RegionUUID` varchar(255) DEFAULT NULL, |
118 | `LocalLandID` int(11) default NULL, | 168 | `LocalLandID` int(11) DEFAULT NULL, |
119 | `Bitmap` longblob, | 169 | `Bitmap` longblob, |
120 | `Name` varchar(255) default NULL, | 170 | `Name` varchar(255) DEFAULT NULL, |
121 | `Description` varchar(255) default NULL, | 171 | `Description` varchar(255) DEFAULT NULL, |
122 | `OwnerUUID` varchar(255) default NULL, | 172 | `OwnerUUID` varchar(255) DEFAULT NULL, |
123 | `IsGroupOwned` int(11) default NULL, | 173 | `IsGroupOwned` int(11) DEFAULT NULL, |
124 | `Area` int(11) default NULL, | 174 | `Area` int(11) DEFAULT NULL, |
125 | `AuctionID` int(11) default NULL, | 175 | `AuctionID` int(11) DEFAULT NULL, |
126 | `Category` int(11) default NULL, | 176 | `Category` int(11) DEFAULT NULL, |
127 | `ClaimDate` int(11) default NULL, | 177 | `ClaimDate` int(11) DEFAULT NULL, |
128 | `ClaimPrice` int(11) default NULL, | 178 | `ClaimPrice` int(11) DEFAULT NULL, |
129 | `GroupUUID` varchar(255) default NULL, | 179 | `GroupUUID` varchar(255) DEFAULT NULL, |
130 | `SalePrice` int(11) default NULL, | 180 | `SalePrice` int(11) DEFAULT NULL, |
131 | `LandStatus` int(11) default NULL, | 181 | `LandStatus` int(11) DEFAULT NULL, |
132 | `LandFlags` int(11) default NULL, | 182 | `LandFlags` int(10) unsigned DEFAULT NULL, |
133 | `LandingType` int(11) default NULL, | 183 | `LandingType` int(11) DEFAULT NULL, |
134 | `MediaAutoScale` int(11) default NULL, | 184 | `MediaAutoScale` int(11) DEFAULT NULL, |
135 | `MediaTextureUUID` varchar(255) default NULL, | 185 | `MediaTextureUUID` varchar(255) DEFAULT NULL, |
136 | `MediaURL` varchar(255) default NULL, | 186 | `MediaURL` varchar(255) DEFAULT NULL, |
137 | `MusicURL` varchar(255) default NULL, | 187 | `MusicURL` varchar(255) DEFAULT NULL, |
138 | `PassHours` float default NULL, | 188 | `PassHours` float DEFAULT NULL, |
139 | `PassPrice` int(11) default NULL, | 189 | `PassPrice` int(11) DEFAULT NULL, |
140 | `SnapshotUUID` varchar(255) default NULL, | 190 | `SnapshotUUID` varchar(255) DEFAULT NULL, |
141 | `UserLocationX` float default NULL, | 191 | `UserLocationX` float DEFAULT NULL, |
142 | `UserLocationY` float default NULL, | 192 | `UserLocationY` float DEFAULT NULL, |
143 | `UserLocationZ` float default NULL, | 193 | `UserLocationZ` float DEFAULT NULL, |
144 | `UserLookAtX` float default NULL, | 194 | `UserLookAtX` float DEFAULT NULL, |
145 | `UserLookAtY` float default NULL, | 195 | `UserLookAtY` float DEFAULT NULL, |
146 | `UserLookAtZ` float default NULL, | 196 | `UserLookAtZ` float DEFAULT NULL, |
147 | `AuthbuyerID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000', | 197 | `AuthbuyerID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
148 | PRIMARY KEY (`UUID`) | 198 | `OtherCleanTime` int(11) NOT NULL DEFAULT '0', |
199 | `Dwell` int(11) NOT NULL DEFAULT '0', | ||
200 | `MediaType` varchar(32) NOT NULL DEFAULT 'none/none', | ||
201 | `MediaDescription` varchar(255) NOT NULL DEFAULT '', | ||
202 | `MediaSize` varchar(16) NOT NULL DEFAULT '0,0', | ||
203 | `MediaLoop` tinyint(1) NOT NULL DEFAULT '0', | ||
204 | `ObscureMusic` tinyint(1) NOT NULL DEFAULT '0', | ||
205 | `ObscureMedia` tinyint(1) NOT NULL DEFAULT '0', | ||
206 | PRIMARY KEY (`UUID`) | ||
149 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 207 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
150 | 208 | ||
151 | CREATE TABLE `landaccesslist` ( | 209 | CREATE TABLE IF NOT EXISTS `landaccesslist` ( |
152 | `LandUUID` varchar(255) default NULL, | 210 | `LandUUID` varchar(255) DEFAULT NULL, |
153 | `AccessUUID` varchar(255) default NULL, | 211 | `AccessUUID` varchar(255) DEFAULT NULL, |
154 | `Flags` int(11) default NULL | 212 | `Flags` int(11) DEFAULT NULL, |
213 | `Expires` int(11) NOT NULL DEFAULT '0' | ||
155 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 214 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
156 | 215 | ||
157 | COMMIT; | 216 | CREATE TABLE IF NOT EXISTS `regionban` ( |
158 | 217 | `regionUUID` varchar(36) NOT NULL, | |
159 | :VERSION 2 #--------------------- | 218 | `bannedUUID` varchar(36) NOT NULL, |
160 | 219 | `bannedIp` varchar(16) NOT NULL, | |
161 | BEGIN; | 220 | `bannedIpHostMask` varchar(16) NOT NULL |
162 | 221 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
163 | CREATE index prims_regionuuid on prims(RegionUUID); | ||
164 | CREATE index primitems_primid on primitems(primID); | ||
165 | |||
166 | COMMIT; | ||
167 | |||
168 | :VERSION 3 #--------------------- | ||
169 | |||
170 | BEGIN; | ||
171 | CREATE TABLE regionban (regionUUID VARCHAR(36) NOT NULL, bannedUUID VARCHAR(36) NOT NULL, bannedIp VARCHAR(16) NOT NULL, bannedIpHostMask VARCHAR(16) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; | ||
172 | COMMIT; | ||
173 | |||
174 | :VERSION 4 #--------------------- | ||
175 | |||
176 | BEGIN; | ||
177 | |||
178 | ALTER TABLE primitems add flags integer not null default 0; | ||
179 | |||
180 | COMMIT; | ||
181 | |||
182 | :VERSION 5 #--------------------- | ||
183 | BEGIN; | ||
184 | |||
185 | create table regionsettings ( | ||
186 | regionUUID char(36) not null, | ||
187 | block_terraform integer not null, | ||
188 | block_fly integer not null, | ||
189 | allow_damage integer not null, | ||
190 | restrict_pushing integer not null, | ||
191 | allow_land_resell integer not null, | ||
192 | allow_land_join_divide integer not null, | ||
193 | block_show_in_search integer not null, | ||
194 | agent_limit integer not null, | ||
195 | object_bonus float not null, | ||
196 | maturity integer not null, | ||
197 | disable_scripts integer not null, | ||
198 | disable_collisions integer not null, | ||
199 | disable_physics integer not null, | ||
200 | terrain_texture_1 char(36) not null, | ||
201 | terrain_texture_2 char(36) not null, | ||
202 | terrain_texture_3 char(36) not null, | ||
203 | terrain_texture_4 char(36) not null, | ||
204 | elevation_1_nw float not null, | ||
205 | elevation_2_nw float not null, | ||
206 | elevation_1_ne float not null, | ||
207 | elevation_2_ne float not null, | ||
208 | elevation_1_se float not null, | ||
209 | elevation_2_se float not null, | ||
210 | elevation_1_sw float not null, | ||
211 | elevation_2_sw float not null, | ||
212 | water_height float not null, | ||
213 | terrain_raise_limit float not null, | ||
214 | terrain_lower_limit float not null, | ||
215 | use_estate_sun integer not null, | ||
216 | fixed_sun integer not null, | ||
217 | sun_position float not null, | ||
218 | covenant char(36), | ||
219 | primary key(regionUUID) | ||
220 | ); | ||
221 | |||
222 | COMMIT; | ||
223 | |||
224 | |||
225 | :VERSION 6 #--------------------- | ||
226 | |||
227 | BEGIN; | ||
228 | |||
229 | alter table landaccesslist ENGINE = MyISAM; | ||
230 | alter table migrations ENGINE = MyISAM; | ||
231 | alter table primitems ENGINE = MyISAM; | ||
232 | alter table prims ENGINE = MyISAM; | ||
233 | alter table primshapes ENGINE = MyISAM; | ||
234 | alter table regionsettings ENGINE = MyISAM; | ||
235 | alter table terrain ENGINE = MyISAM; | ||
236 | |||
237 | COMMIT; | ||
238 | |||
239 | :VERSION 7 #--------------------- | ||
240 | |||
241 | BEGIN; | ||
242 | |||
243 | ALTER TABLE prims change UUID UUIDold varchar(255); | ||
244 | ALTER TABLE prims change RegionUUID RegionUUIDold varchar(255); | ||
245 | ALTER TABLE prims change CreatorID CreatorIDold varchar(255); | ||
246 | ALTER TABLE prims change OwnerID OwnerIDold varchar(255); | ||
247 | ALTER TABLE prims change GroupID GroupIDold varchar(255); | ||
248 | ALTER TABLE prims change LastOwnerID LastOwnerIDold varchar(255); | ||
249 | ALTER TABLE prims add UUID char(36); | ||
250 | ALTER TABLE prims add RegionUUID char(36); | ||
251 | ALTER TABLE prims add CreatorID char(36); | ||
252 | ALTER TABLE prims add OwnerID char(36); | ||
253 | ALTER TABLE prims add GroupID char(36); | ||
254 | ALTER TABLE prims add LastOwnerID char(36); | ||
255 | UPDATE prims set UUID = UUIDold, RegionUUID = RegionUUIDold, CreatorID = CreatorIDold, OwnerID = OwnerIDold, GroupID = GroupIDold, LastOwnerID = LastOwnerIDold; | ||
256 | ALTER TABLE prims drop UUIDold; | ||
257 | ALTER TABLE prims drop RegionUUIDold; | ||
258 | ALTER TABLE prims drop CreatorIDold; | ||
259 | ALTER TABLE prims drop OwnerIDold; | ||
260 | ALTER TABLE prims drop GroupIDold; | ||
261 | ALTER TABLE prims drop LastOwnerIDold; | ||
262 | ALTER TABLE prims add constraint primary key(UUID); | ||
263 | ALTER TABLE prims add index prims_regionuuid(RegionUUID); | ||
264 | |||
265 | COMMIT; | ||
266 | |||
267 | :VERSION 8 #--------------------- | ||
268 | |||
269 | BEGIN; | ||
270 | |||
271 | ALTER TABLE primshapes change UUID UUIDold varchar(255); | ||
272 | ALTER TABLE primshapes add UUID char(36); | ||
273 | UPDATE primshapes set UUID = UUIDold; | ||
274 | ALTER TABLE primshapes drop UUIDold; | ||
275 | ALTER TABLE primshapes add constraint primary key(UUID); | ||
276 | |||
277 | COMMIT; | ||
278 | |||
279 | :VERSION 9 #--------------------- | ||
280 | |||
281 | BEGIN; | ||
282 | |||
283 | ALTER TABLE primitems change itemID itemIDold varchar(255); | ||
284 | ALTER TABLE primitems change primID primIDold varchar(255); | ||
285 | ALTER TABLE primitems change assetID assetIDold varchar(255); | ||
286 | ALTER TABLE primitems change parentFolderID parentFolderIDold varchar(255); | ||
287 | ALTER TABLE primitems change creatorID creatorIDold varchar(255); | ||
288 | ALTER TABLE primitems change ownerID ownerIDold varchar(255); | ||
289 | ALTER TABLE primitems change groupID groupIDold varchar(255); | ||
290 | ALTER TABLE primitems change lastOwnerID lastOwnerIDold varchar(255); | ||
291 | ALTER TABLE primitems add itemID char(36); | ||
292 | ALTER TABLE primitems add primID char(36); | ||
293 | ALTER TABLE primitems add assetID char(36); | ||
294 | ALTER TABLE primitems add parentFolderID char(36); | ||
295 | ALTER TABLE primitems add creatorID char(36); | ||
296 | ALTER TABLE primitems add ownerID char(36); | ||
297 | ALTER TABLE primitems add groupID char(36); | ||
298 | ALTER TABLE primitems add lastOwnerID char(36); | ||
299 | UPDATE primitems set itemID = itemIDold, primID = primIDold, assetID = assetIDold, parentFolderID = parentFolderIDold, creatorID = creatorIDold, ownerID = ownerIDold, groupID = groupIDold, lastOwnerID = lastOwnerIDold; | ||
300 | ALTER TABLE primitems drop itemIDold; | ||
301 | ALTER TABLE primitems drop primIDold; | ||
302 | ALTER TABLE primitems drop assetIDold; | ||
303 | ALTER TABLE primitems drop parentFolderIDold; | ||
304 | ALTER TABLE primitems drop creatorIDold; | ||
305 | ALTER TABLE primitems drop ownerIDold; | ||
306 | ALTER TABLE primitems drop groupIDold; | ||
307 | ALTER TABLE primitems drop lastOwnerIDold; | ||
308 | ALTER TABLE primitems add constraint primary key(itemID); | ||
309 | ALTER TABLE primitems add index primitems_primid(primID); | ||
310 | |||
311 | COMMIT; | ||
312 | |||
313 | :VERSION 10 #--------------------- | ||
314 | |||
315 | # 1 "010_RegionStore.sql" | ||
316 | # 1 "<built-in>" | ||
317 | # 1 "<command line>" | ||
318 | # 1 "010_RegionStore.sql" | ||
319 | BEGIN; | ||
320 | |||
321 | DELETE FROM regionsettings; | ||
322 | |||
323 | COMMIT; | ||
324 | |||
325 | |||
326 | :VERSION 11 #--------------------- | ||
327 | |||
328 | BEGIN; | ||
329 | |||
330 | ALTER TABLE prims change SceneGroupID SceneGroupIDold varchar(255); | ||
331 | ALTER TABLE prims add SceneGroupID char(36); | ||
332 | UPDATE prims set SceneGroupID = SceneGroupIDold; | ||
333 | ALTER TABLE prims drop SceneGroupIDold; | ||
334 | ALTER TABLE prims add index prims_scenegroupid(SceneGroupID); | ||
335 | |||
336 | COMMIT; | ||
337 | |||
338 | :VERSION 12 #--------------------- | ||
339 | |||
340 | BEGIN; | ||
341 | |||
342 | ALTER TABLE prims add index prims_parentid(ParentID); | ||
343 | |||
344 | COMMIT; | ||
345 | |||
346 | :VERSION 13 #--------------------- | ||
347 | begin; | ||
348 | |||
349 | drop table regionsettings; | ||
350 | 222 | ||
351 | CREATE TABLE `regionsettings` ( | 223 | CREATE TABLE IF NOT EXISTS `regionsettings` ( |
352 | `regionUUID` char(36) NOT NULL, | 224 | `regionUUID` char(36) NOT NULL, |
353 | `block_terraform` int(11) NOT NULL, | 225 | `block_terraform` int(11) NOT NULL, |
354 | `block_fly` int(11) NOT NULL, | 226 | `block_fly` int(11) NOT NULL, |
@@ -358,7 +230,7 @@ CREATE TABLE `regionsettings` ( | |||
358 | `allow_land_join_divide` int(11) NOT NULL, | 230 | `allow_land_join_divide` int(11) NOT NULL, |
359 | `block_show_in_search` int(11) NOT NULL, | 231 | `block_show_in_search` int(11) NOT NULL, |
360 | `agent_limit` int(11) NOT NULL, | 232 | `agent_limit` int(11) NOT NULL, |
361 | `object_bonus` float NOT NULL, | 233 | `object_bonus` double NOT NULL, |
362 | `maturity` int(11) NOT NULL, | 234 | `maturity` int(11) NOT NULL, |
363 | `disable_scripts` int(11) NOT NULL, | 235 | `disable_scripts` int(11) NOT NULL, |
364 | `disable_collisions` int(11) NOT NULL, | 236 | `disable_collisions` int(11) NOT NULL, |
@@ -367,360 +239,35 @@ CREATE TABLE `regionsettings` ( | |||
367 | `terrain_texture_2` char(36) NOT NULL, | 239 | `terrain_texture_2` char(36) NOT NULL, |
368 | `terrain_texture_3` char(36) NOT NULL, | 240 | `terrain_texture_3` char(36) NOT NULL, |
369 | `terrain_texture_4` char(36) NOT NULL, | 241 | `terrain_texture_4` char(36) NOT NULL, |
370 | `elevation_1_nw` float NOT NULL, | 242 | `elevation_1_nw` double NOT NULL, |
371 | `elevation_2_nw` float NOT NULL, | 243 | `elevation_2_nw` double NOT NULL, |
372 | `elevation_1_ne` float NOT NULL, | 244 | `elevation_1_ne` double NOT NULL, |
373 | `elevation_2_ne` float NOT NULL, | 245 | `elevation_2_ne` double NOT NULL, |
374 | `elevation_1_se` float NOT NULL, | 246 | `elevation_1_se` double NOT NULL, |
375 | `elevation_2_se` float NOT NULL, | 247 | `elevation_2_se` double NOT NULL, |
376 | `elevation_1_sw` float NOT NULL, | 248 | `elevation_1_sw` double NOT NULL, |
377 | `elevation_2_sw` float NOT NULL, | 249 | `elevation_2_sw` double NOT NULL, |
378 | `water_height` float NOT NULL, | 250 | `water_height` double NOT NULL, |
379 | `terrain_raise_limit` float NOT NULL, | 251 | `terrain_raise_limit` double NOT NULL, |
380 | `terrain_lower_limit` float NOT NULL, | 252 | `terrain_lower_limit` double NOT NULL, |
381 | `use_estate_sun` int(11) NOT NULL, | 253 | `use_estate_sun` int(11) NOT NULL, |
382 | `fixed_sun` int(11) NOT NULL, | 254 | `fixed_sun` int(11) NOT NULL, |
383 | `sun_position` float NOT NULL, | 255 | `sun_position` double NOT NULL, |
384 | `covenant` char(36) default NULL, | 256 | `covenant` char(36) DEFAULT NULL, |
385 | `Sandbox` tinyint(4) NOT NULL, | 257 | `Sandbox` tinyint(4) NOT NULL, |
386 | PRIMARY KEY (`regionUUID`) | 258 | `sunvectorx` double NOT NULL DEFAULT '0', |
387 | ) ENGINE=MyISAM; | 259 | `sunvectory` double NOT NULL DEFAULT '0', |
388 | 260 | `sunvectorz` double NOT NULL DEFAULT '0', | |
389 | commit; | 261 | `loaded_creation_id` varchar(64) DEFAULT NULL, |
390 | 262 | `loaded_creation_datetime` int(10) unsigned NOT NULL DEFAULT '0', | |
391 | :VERSION 16 #--------------------- | 263 | `map_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
392 | 264 | `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | |
393 | BEGIN; | 265 | `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', |
394 | 266 | `covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0', | |
395 | ALTER TABLE prims ADD COLUMN PayPrice integer not null default 0; | 267 | PRIMARY KEY (`regionUUID`) |
396 | ALTER TABLE prims ADD COLUMN PayButton1 integer not null default 0; | 268 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
397 | ALTER TABLE prims ADD COLUMN PayButton2 integer not null default 0; | ||
398 | ALTER TABLE prims ADD COLUMN PayButton3 integer not null default 0; | ||
399 | ALTER TABLE prims ADD COLUMN PayButton4 integer not null default 0; | ||
400 | ALTER TABLE prims ADD COLUMN LoopedSound char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
401 | ALTER TABLE prims ADD COLUMN LoopedSoundGain float not null default 0.0; | ||
402 | ALTER TABLE prims ADD COLUMN TextureAnimation blob; | ||
403 | ALTER TABLE prims ADD COLUMN OmegaX float not null default 0.0; | ||
404 | ALTER TABLE prims ADD COLUMN OmegaY float not null default 0.0; | ||
405 | ALTER TABLE prims ADD COLUMN OmegaZ float not null default 0.0; | ||
406 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float not null default 0.0; | ||
407 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float not null default 0.0; | ||
408 | ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float not null default 0.0; | ||
409 | ALTER TABLE prims ADD COLUMN CameraAtOffsetX float not null default 0.0; | ||
410 | ALTER TABLE prims ADD COLUMN CameraAtOffsetY float not null default 0.0; | ||
411 | ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float not null default 0.0; | ||
412 | ALTER TABLE prims ADD COLUMN ForceMouselook tinyint not null default 0; | ||
413 | ALTER TABLE prims ADD COLUMN ScriptAccessPin integer not null default 0; | ||
414 | ALTER TABLE prims ADD COLUMN AllowedDrop tinyint not null default 0; | ||
415 | ALTER TABLE prims ADD COLUMN DieAtEdge tinyint not null default 0; | ||
416 | ALTER TABLE prims ADD COLUMN SalePrice integer not null default 10; | ||
417 | ALTER TABLE prims ADD COLUMN SaleType tinyint not null default 0; | ||
418 | |||
419 | COMMIT; | ||
420 | |||
421 | |||
422 | :VERSION 17 #--------------------- | ||
423 | |||
424 | BEGIN; | ||
425 | |||
426 | ALTER TABLE prims ADD COLUMN ColorR integer not null default 0; | ||
427 | ALTER TABLE prims ADD COLUMN ColorG integer not null default 0; | ||
428 | ALTER TABLE prims ADD COLUMN ColorB integer not null default 0; | ||
429 | ALTER TABLE prims ADD COLUMN ColorA integer not null default 0; | ||
430 | ALTER TABLE prims ADD COLUMN ParticleSystem blob; | ||
431 | |||
432 | COMMIT; | ||
433 | |||
434 | |||
435 | :VERSION 18 #--------------------- | ||
436 | |||
437 | begin; | ||
438 | |||
439 | ALTER TABLE prims ADD COLUMN ClickAction tinyint NOT NULL default 0; | ||
440 | |||
441 | commit; | ||
442 | |||
443 | :VERSION 19 #--------------------- | ||
444 | |||
445 | begin; | ||
446 | |||
447 | ALTER TABLE prims ADD COLUMN Material tinyint NOT NULL default 3; | ||
448 | |||
449 | commit; | ||
450 | |||
451 | |||
452 | :VERSION 20 #--------------------- | ||
453 | |||
454 | begin; | ||
455 | |||
456 | ALTER TABLE land ADD COLUMN OtherCleanTime integer NOT NULL default 0; | ||
457 | ALTER TABLE land ADD COLUMN Dwell integer NOT NULL default 0; | ||
458 | |||
459 | commit; | ||
460 | |||
461 | :VERSION 21 #--------------------- | ||
462 | |||
463 | begin; | ||
464 | |||
465 | ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0; | ||
466 | ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0; | ||
467 | ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0; | ||
468 | |||
469 | commit; | ||
470 | |||
471 | |||
472 | :VERSION 22 #--------------------- | ||
473 | |||
474 | BEGIN; | ||
475 | |||
476 | ALTER TABLE prims ADD COLUMN CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
477 | ALTER TABLE prims ADD COLUMN CollisionSoundVolume float not null default 0.0; | ||
478 | |||
479 | COMMIT; | ||
480 | |||
481 | :VERSION 23 #--------------------- | ||
482 | |||
483 | BEGIN; | ||
484 | |||
485 | ALTER TABLE prims ADD COLUMN LinkNumber integer not null default 0; | ||
486 | |||
487 | COMMIT; | ||
488 | |||
489 | :VERSION 24 #--------------------- | ||
490 | |||
491 | BEGIN; | ||
492 | |||
493 | alter table regionsettings change column `object_bonus` `object_bonus` double NOT NULL; | ||
494 | alter table regionsettings change column `elevation_1_nw` `elevation_1_nw` double NOT NULL; | ||
495 | alter table regionsettings change column `elevation_2_nw` `elevation_2_nw` double NOT NULL; | ||
496 | alter table regionsettings change column `elevation_1_ne` `elevation_1_ne` double NOT NULL; | ||
497 | alter table regionsettings change column `elevation_2_ne` `elevation_2_ne` double NOT NULL; | ||
498 | alter table regionsettings change column `elevation_1_se` `elevation_1_se` double NOT NULL; | ||
499 | alter table regionsettings change column `elevation_2_se` `elevation_2_se` double NOT NULL; | ||
500 | alter table regionsettings change column `elevation_1_sw` `elevation_1_sw` double NOT NULL; | ||
501 | alter table regionsettings change column `elevation_2_sw` `elevation_2_sw` double NOT NULL; | ||
502 | alter table regionsettings change column `water_height` `water_height` double NOT NULL; | ||
503 | alter table regionsettings change column `terrain_raise_limit` `terrain_raise_limit` double NOT NULL; | ||
504 | alter table regionsettings change column `terrain_lower_limit` `terrain_lower_limit` double NOT NULL; | ||
505 | alter table regionsettings change column `sun_position` `sun_position` double NOT NULL; | ||
506 | |||
507 | COMMIT; | ||
508 | |||
509 | |||
510 | :VERSION 25 #--------------------- | ||
511 | |||
512 | BEGIN; | ||
513 | |||
514 | alter table prims change column `PositionX` `PositionX` double default NULL; | ||
515 | alter table prims change column `PositionY` `PositionY` double default NULL; | ||
516 | alter table prims change column `PositionZ` `PositionZ` double default NULL; | ||
517 | alter table prims change column `GroupPositionX` `GroupPositionX` double default NULL; | ||
518 | alter table prims change column `GroupPositionY` `GroupPositionY` double default NULL; | ||
519 | alter table prims change column `GroupPositionZ` `GroupPositionZ` double default NULL; | ||
520 | alter table prims change column `VelocityX` `VelocityX` double default NULL; | ||
521 | alter table prims change column `VelocityY` `VelocityY` double default NULL; | ||
522 | alter table prims change column `VelocityZ` `VelocityZ` double default NULL; | ||
523 | alter table prims change column `AngularVelocityX` `AngularVelocityX` double default NULL; | ||
524 | alter table prims change column `AngularVelocityY` `AngularVelocityY` double default NULL; | ||
525 | alter table prims change column `AngularVelocityZ` `AngularVelocityZ` double default NULL; | ||
526 | alter table prims change column `AccelerationX` `AccelerationX` double default NULL; | ||
527 | alter table prims change column `AccelerationY` `AccelerationY` double default NULL; | ||
528 | alter table prims change column `AccelerationZ` `AccelerationZ` double default NULL; | ||
529 | alter table prims change column `RotationX` `RotationX` double default NULL; | ||
530 | alter table prims change column `RotationY` `RotationY` double default NULL; | ||
531 | alter table prims change column `RotationZ` `RotationZ` double default NULL; | ||
532 | alter table prims change column `RotationW` `RotationW` double default NULL; | ||
533 | alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` double default NULL; | ||
534 | alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` double default NULL; | ||
535 | alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` double default NULL; | ||
536 | alter table prims change column `SitTargetOrientW` `SitTargetOrientW` double default NULL; | ||
537 | alter table prims change column `SitTargetOrientX` `SitTargetOrientX` double default NULL; | ||
538 | alter table prims change column `SitTargetOrientY` `SitTargetOrientY` double default NULL; | ||
539 | alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` double default NULL; | ||
540 | alter table prims change column `LoopedSoundGain` `LoopedSoundGain` double NOT NULL default '0'; | ||
541 | alter table prims change column `OmegaX` `OmegaX` double NOT NULL default '0'; | ||
542 | alter table prims change column `OmegaY` `OmegaY` double NOT NULL default '0'; | ||
543 | alter table prims change column `OmegaZ` `OmegaZ` double NOT NULL default '0'; | ||
544 | alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` double NOT NULL default '0'; | ||
545 | alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` double NOT NULL default '0'; | ||
546 | alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` double NOT NULL default '0'; | ||
547 | alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` double NOT NULL default '0'; | ||
548 | alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` double NOT NULL default '0'; | ||
549 | alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` double NOT NULL default '0'; | ||
550 | alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` double NOT NULL default '0'; | ||
551 | |||
552 | alter table primshapes change column `ScaleX` `ScaleX` double NOT NULL default '0'; | ||
553 | alter table primshapes change column `ScaleY` `ScaleY` double NOT NULL default '0'; | ||
554 | alter table primshapes change column `ScaleZ` `ScaleZ` double NOT NULL default '0'; | ||
555 | |||
556 | COMMIT; | ||
557 | |||
558 | :VERSION 26 #--------------------- | ||
559 | |||
560 | begin; | ||
561 | |||
562 | alter table prims change column `PositionX` `PositionX` double default NULL; | ||
563 | alter table prims change column `PositionY` `PositionY` double default NULL; | ||
564 | alter table prims change column `PositionZ` `PositionZ` double default NULL; | ||
565 | alter table prims change column `GroupPositionX` `GroupPositionX` double default NULL; | ||
566 | alter table prims change column `GroupPositionY` `GroupPositionY` double default NULL; | ||
567 | alter table prims change column `GroupPositionZ` `GroupPositionZ` double default NULL; | ||
568 | alter table prims change column `VelocityX` `VelocityX` double default NULL; | ||
569 | alter table prims change column `VelocityY` `VelocityY` double default NULL; | ||
570 | alter table prims change column `VelocityZ` `VelocityZ` double default NULL; | ||
571 | alter table prims change column `AngularVelocityX` `AngularVelocityX` double default NULL; | ||
572 | alter table prims change column `AngularVelocityY` `AngularVelocityY` double default NULL; | ||
573 | alter table prims change column `AngularVelocityZ` `AngularVelocityZ` double default NULL; | ||
574 | alter table prims change column `AccelerationX` `AccelerationX` double default NULL; | ||
575 | alter table prims change column `AccelerationY` `AccelerationY` double default NULL; | ||
576 | alter table prims change column `AccelerationZ` `AccelerationZ` double default NULL; | ||
577 | alter table prims change column `RotationX` `RotationX` double default NULL; | ||
578 | alter table prims change column `RotationY` `RotationY` double default NULL; | ||
579 | alter table prims change column `RotationZ` `RotationZ` double default NULL; | ||
580 | alter table prims change column `RotationW` `RotationW` double default NULL; | ||
581 | alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` double default NULL; | ||
582 | alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` double default NULL; | ||
583 | alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` double default NULL; | ||
584 | alter table prims change column `SitTargetOrientW` `SitTargetOrientW` double default NULL; | ||
585 | alter table prims change column `SitTargetOrientX` `SitTargetOrientX` double default NULL; | ||
586 | alter table prims change column `SitTargetOrientY` `SitTargetOrientY` double default NULL; | ||
587 | alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` double default NULL; | ||
588 | alter table prims change column `LoopedSoundGain` `LoopedSoundGain` double NOT NULL default '0'; | ||
589 | alter table prims change column `OmegaX` `OmegaX` double NOT NULL default '0'; | ||
590 | alter table prims change column `OmegaY` `OmegaY` double NOT NULL default '0'; | ||
591 | alter table prims change column `OmegaZ` `OmegaZ` double NOT NULL default '0'; | ||
592 | alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` double NOT NULL default '0'; | ||
593 | alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` double NOT NULL default '0'; | ||
594 | alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` double NOT NULL default '0'; | ||
595 | alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` double NOT NULL default '0'; | ||
596 | alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` double NOT NULL default '0'; | ||
597 | alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` double NOT NULL default '0'; | ||
598 | alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` double NOT NULL default '0'; | ||
599 | |||
600 | commit; | ||
601 | |||
602 | :VERSION 27 #--------------------- | ||
603 | |||
604 | BEGIN; | ||
605 | |||
606 | ALTER TABLE prims DROP COLUMN ParentID; | ||
607 | |||
608 | COMMIT; | ||
609 | |||
610 | :VERSION 28 #--------------------- | ||
611 | |||
612 | BEGIN; | ||
613 | |||
614 | update terrain | ||
615 | set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12)) | ||
616 | where RegionUUID not like '%-%'; | ||
617 | |||
618 | |||
619 | update landaccesslist | ||
620 | set LandUUID = concat(substr(LandUUID, 1, 8), "-", substr(LandUUID, 9, 4), "-", substr(LandUUID, 13, 4), "-", substr(LandUUID, 17, 4), "-", substr(LandUUID, 21, 12)) | ||
621 | where LandUUID not like '%-%'; | ||
622 | |||
623 | update landaccesslist | ||
624 | set AccessUUID = concat(substr(AccessUUID, 1, 8), "-", substr(AccessUUID, 9, 4), "-", substr(AccessUUID, 13, 4), "-", substr(AccessUUID, 17, 4), "-", substr(AccessUUID, 21, 12)) | ||
625 | where AccessUUID not like '%-%'; | ||
626 | |||
627 | |||
628 | update prims | ||
629 | set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12)) | ||
630 | where UUID not like '%-%'; | ||
631 | |||
632 | update prims | ||
633 | set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12)) | ||
634 | where RegionUUID not like '%-%'; | ||
635 | |||
636 | update prims | ||
637 | set SceneGroupID = concat(substr(SceneGroupID, 1, 8), "-", substr(SceneGroupID, 9, 4), "-", substr(SceneGroupID, 13, 4), "-", substr(SceneGroupID, 17, 4), "-", substr(SceneGroupID, 21, 12)) | ||
638 | where SceneGroupID not like '%-%'; | ||
639 | |||
640 | update prims | ||
641 | set CreatorID = concat(substr(CreatorID, 1, 8), "-", substr(CreatorID, 9, 4), "-", substr(CreatorID, 13, 4), "-", substr(CreatorID, 17, 4), "-", substr(CreatorID, 21, 12)) | ||
642 | where CreatorID not like '%-%'; | ||
643 | |||
644 | update prims | ||
645 | set OwnerID = concat(substr(OwnerID, 1, 8), "-", substr(OwnerID, 9, 4), "-", substr(OwnerID, 13, 4), "-", substr(OwnerID, 17, 4), "-", substr(OwnerID, 21, 12)) | ||
646 | where OwnerID not like '%-%'; | ||
647 | |||
648 | update prims | ||
649 | set GroupID = concat(substr(GroupID, 1, 8), "-", substr(GroupID, 9, 4), "-", substr(GroupID, 13, 4), "-", substr(GroupID, 17, 4), "-", substr(GroupID, 21, 12)) | ||
650 | where GroupID not like '%-%'; | ||
651 | |||
652 | update prims | ||
653 | set LastOwnerID = concat(substr(LastOwnerID, 1, 8), "-", substr(LastOwnerID, 9, 4), "-", substr(LastOwnerID, 13, 4), "-", substr(LastOwnerID, 17, 4), "-", substr(LastOwnerID, 21, 12)) | ||
654 | where LastOwnerID not like '%-%'; | ||
655 | |||
656 | |||
657 | update primshapes | ||
658 | set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12)) | ||
659 | where UUID not like '%-%'; | ||
660 | |||
661 | |||
662 | update land | ||
663 | set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12)) | ||
664 | where UUID not like '%-%'; | ||
665 | |||
666 | update land | ||
667 | set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12)) | ||
668 | where RegionUUID not like '%-%'; | ||
669 | |||
670 | update land | ||
671 | set OwnerUUID = concat(substr(OwnerUUID, 1, 8), "-", substr(OwnerUUID, 9, 4), "-", substr(OwnerUUID, 13, 4), "-", substr(OwnerUUID, 17, 4), "-", substr(OwnerUUID, 21, 12)) | ||
672 | where OwnerUUID not like '%-%'; | ||
673 | |||
674 | update land | ||
675 | set GroupUUID = concat(substr(GroupUUID, 1, 8), "-", substr(GroupUUID, 9, 4), "-", substr(GroupUUID, 13, 4), "-", substr(GroupUUID, 17, 4), "-", substr(GroupUUID, 21, 12)) | ||
676 | where GroupUUID not like '%-%'; | ||
677 | |||
678 | update land | ||
679 | set MediaTextureUUID = concat(substr(MediaTextureUUID, 1, 8), "-", substr(MediaTextureUUID, 9, 4), "-", substr(MediaTextureUUID, 13, 4), "-", substr(MediaTextureUUID, 17, 4), "-", substr(MediaTextureUUID, 21, 12)) | ||
680 | where MediaTextureUUID not like '%-%'; | ||
681 | |||
682 | update land | ||
683 | set SnapshotUUID = concat(substr(SnapshotUUID, 1, 8), "-", substr(SnapshotUUID, 9, 4), "-", substr(SnapshotUUID, 13, 4), "-", substr(SnapshotUUID, 17, 4), "-", substr(SnapshotUUID, 21, 12)) | ||
684 | where SnapshotUUID not like '%-%'; | ||
685 | |||
686 | update land | ||
687 | set AuthbuyerID = concat(substr(AuthbuyerID, 1, 8), "-", substr(AuthbuyerID, 9, 4), "-", substr(AuthbuyerID, 13, 4), "-", substr(AuthbuyerID, 17, 4), "-", substr(AuthbuyerID, 21, 12)) | ||
688 | where AuthbuyerID not like '%-%'; | ||
689 | |||
690 | COMMIT; | ||
691 | |||
692 | :VERSION 29 #--------------------- | ||
693 | |||
694 | BEGIN; | ||
695 | |||
696 | ALTER TABLE prims ADD COLUMN PassTouches tinyint not null default 0; | ||
697 | |||
698 | COMMIT; | ||
699 | |||
700 | :VERSION 30 #--------------------- | ||
701 | |||
702 | BEGIN; | ||
703 | |||
704 | ALTER TABLE regionsettings ADD COLUMN loaded_creation_date varchar(20) default NULL; | ||
705 | ALTER TABLE regionsettings ADD COLUMN loaded_creation_time varchar(20) default NULL; | ||
706 | ALTER TABLE regionsettings ADD COLUMN loaded_creation_id varchar(64) default NULL; | ||
707 | |||
708 | COMMIT; | ||
709 | |||
710 | :VERSION 31 #--------------------- | ||
711 | |||
712 | BEGIN; | ||
713 | |||
714 | ALTER TABLE regionsettings DROP COLUMN loaded_creation_date; | ||
715 | ALTER TABLE regionsettings DROP COLUMN loaded_creation_time; | ||
716 | ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT NULL default 0; | ||
717 | |||
718 | COMMIT; | ||
719 | |||
720 | :VERSION 32 | ||
721 | 269 | ||
722 | BEGIN; | 270 | CREATE TABLE IF NOT EXISTS `regionwindlight` ( |
723 | CREATE TABLE `regionwindlight` ( | ||
724 | `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', | 271 | `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', |
725 | `water_color_r` float(9,6) unsigned NOT NULL DEFAULT '4.000000', | 272 | `water_color_r` float(9,6) unsigned NOT NULL DEFAULT '4.000000', |
726 | `water_color_g` float(9,6) unsigned NOT NULL DEFAULT '38.000000', | 273 | `water_color_g` float(9,6) unsigned NOT NULL DEFAULT '38.000000', |
@@ -779,172 +326,144 @@ CREATE TABLE `regionwindlight` ( | |||
779 | `cloud_detail_x` float(3,2) unsigned NOT NULL DEFAULT '1.00', | 326 | `cloud_detail_x` float(3,2) unsigned NOT NULL DEFAULT '1.00', |
780 | `cloud_detail_y` float(3,2) unsigned NOT NULL DEFAULT '0.53', | 327 | `cloud_detail_y` float(3,2) unsigned NOT NULL DEFAULT '0.53', |
781 | `cloud_detail_density` float(3,2) unsigned NOT NULL DEFAULT '0.12', | 328 | `cloud_detail_density` float(3,2) unsigned NOT NULL DEFAULT '0.12', |
782 | `cloud_scroll_x` float(3,2) unsigned NOT NULL DEFAULT '0.20', | 329 | `cloud_scroll_x` float(4,2) NOT NULL DEFAULT '0.20', |
783 | `cloud_scroll_x_lock` tinyint(1) unsigned NOT NULL DEFAULT '0', | 330 | `cloud_scroll_x_lock` tinyint(1) unsigned NOT NULL DEFAULT '0', |
784 | `cloud_scroll_y` float(3,2) unsigned NOT NULL DEFAULT '0.01', | 331 | `cloud_scroll_y` float(4,2) NOT NULL DEFAULT '0.01', |
785 | `cloud_scroll_y_lock` tinyint(1) unsigned NOT NULL DEFAULT '0', | 332 | `cloud_scroll_y_lock` tinyint(1) unsigned NOT NULL DEFAULT '0', |
786 | `draw_classic_clouds` tinyint(1) unsigned NOT NULL DEFAULT '1', | 333 | `draw_classic_clouds` tinyint(1) unsigned NOT NULL DEFAULT '1', |
787 | PRIMARY KEY (`region_id`) | 334 | PRIMARY KEY (`region_id`) |
788 | ); | 335 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
789 | |||
790 | |||
791 | :VERSION 33 #--------------------- | ||
792 | |||
793 | BEGIN; | ||
794 | ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
795 | COMMIT; | ||
796 | |||
797 | :VERSION 34 #--------------------- | ||
798 | |||
799 | BEGIN; | ||
800 | ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` FLOAT(4,2) NOT NULL DEFAULT '0.20' AFTER `cloud_detail_density`, CHANGE COLUMN `cloud_scroll_y` `cloud_scroll_y` FLOAT(4,2) NOT NULL DEFAULT '0.01' AFTER `cloud_scroll_x_lock`; | ||
801 | COMMIT; | ||
802 | |||
803 | :VERSION 35 #--------------------- | ||
804 | |||
805 | BEGIN; | ||
806 | ALTER TABLE prims ADD COLUMN MediaURL varchar(255); | ||
807 | ALTER TABLE primshapes ADD COLUMN Media TEXT; | ||
808 | COMMIT; | ||
809 | |||
810 | :VERSION 36 #--------------------- | ||
811 | |||
812 | BEGIN; | ||
813 | ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ; | ||
814 | ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT ''; | ||
815 | ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; | ||
816 | ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE; | ||
817 | ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; | ||
818 | ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; | ||
819 | COMMIT; | ||
820 | |||
821 | :VERSION 37 #--------------------- | ||
822 | |||
823 | BEGIN; | ||
824 | |||
825 | ALTER TABLE `prims` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT ''; | ||
826 | ALTER TABLE `primitems` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT ''; | ||
827 | |||
828 | COMMIT; | ||
829 | |||
830 | :VERSION 38 #--------------------- | ||
831 | |||
832 | BEGIN; | ||
833 | |||
834 | alter table land ENGINE = MyISAM; | ||
835 | alter table landaccesslist ENGINE = MyISAM; | ||
836 | alter table migrations ENGINE = MyISAM; | ||
837 | alter table primitems ENGINE = MyISAM; | ||
838 | alter table prims ENGINE = MyISAM; | ||
839 | alter table primshapes ENGINE = MyISAM; | ||
840 | alter table regionban ENGINE = MyISAM; | ||
841 | alter table regionsettings ENGINE = MyISAM; | ||
842 | alter table terrain ENGINE = MyISAM; | ||
843 | |||
844 | COMMIT; | ||
845 | |||
846 | :VERSION 39 #--------------- Telehub support | ||
847 | 336 | ||
848 | BEGIN; | ||
849 | CREATE TABLE IF NOT EXISTS `spawn_points` ( | 337 | CREATE TABLE IF NOT EXISTS `spawn_points` ( |
850 | `RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL, | 338 | `RegionID` varchar(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, |
851 | `Yaw` float NOT NULL, | 339 | `Yaw` float NOT NULL, |
852 | `Pitch` float NOT NULL, | 340 | `Pitch` float NOT NULL, |
853 | `Distance` float NOT NULL, | 341 | `Distance` float NOT NULL, |
854 | KEY `RegionID` (`RegionID`) | 342 | KEY `RegionID` (`RegionID`) |
855 | ) ENGINE=MyISAM; | 343 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
856 | 344 | ||
857 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL; | 345 | CREATE TABLE IF NOT EXISTS `regionenvironment` ( |
858 | COMMIT; | 346 | `region_id` varchar(36) NOT NULL, |
347 | `llsd_settings` text NOT NULL, | ||
348 | PRIMARY KEY (`region_id`) | ||
349 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
859 | 350 | ||
860 | :VERSION 40 #---------------- Parcels for sale | 351 | CREATE TABLE IF NOT EXISTS `regionextra` ( |
352 | `RegionID` char(36) NOT NULL, | ||
353 | `Name` varchar(32) NOT NULL, | ||
354 | `value` text, | ||
355 | PRIMARY KEY (`RegionID`,`Name`) | ||
356 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
861 | 357 | ||
862 | BEGIN; | ||
863 | ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
864 | COMMIT; | 358 | COMMIT; |
865 | 359 | ||
866 | :VERSION 41 #---------------- Timed bans/access | 360 | :VERSION 52 #---- avination fields |
867 | 361 | ||
868 | BEGIN; | 362 | BEGIN; |
869 | ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0; | ||
870 | COMMIT; | ||
871 | 363 | ||
872 | :VERSION 42 #--------------------- Region Covenant changed time | 364 | ALTER TABLE `prims` ADD COLUMN `PassCollisions` tinyint(4) NOT NULL default '0'; |
365 | ALTER TABLE `prims` ADD COLUMN `Vehicle` TEXT default NULL; | ||
366 | ALTER TABLE `regionsettings` ADD COLUMN `block_search` tinyint(4) NOT NULL default '0'; | ||
367 | ALTER TABLE `regionsettings` ADD COLUMN `casino` tinyint(4) NOT NULL default '0'; | ||
368 | ALTER TABLE `land` ADD COLUMN `SeeAVs` tinyint(4) NOT NULL default '1'; | ||
369 | ALTER TABLE `land` ADD COLUMN `AnyAVSounds` tinyint(4) NOT NULL default '1'; | ||
370 | ALTER TABLE `land` ADD COLUMN `GroupAVSounds` tinyint(4) NOT NULL default '1'; | ||
873 | 371 | ||
874 | BEGIN; | ||
875 | ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0'; | ||
876 | COMMIT; | 372 | COMMIT; |
877 | 373 | ||
878 | :VERSION 43 #--------------------- | 374 | :VERSION 53 #---- STATUS ROTATION axis locks |
879 | 375 | ||
880 | BEGIN; | 376 | BEGIN; |
881 | 377 | ||
882 | ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | 378 | ALTER TABLE `prims` ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0'; |
883 | 379 | ||
884 | COMMIT; | 380 | COMMIT; |
885 | 381 | ||
886 | :VERSION 44 #--------------------- Environment Settings | 382 | :VERSION 54 #----- add baked terrain store |
887 | 383 | ||
888 | BEGIN; | 384 | BEGIN; |
889 | 385 | ||
890 | CREATE TABLE `regionenvironment` ( | 386 | CREATE TABLE IF NOT EXISTS `bakedterrain` ( |
891 | `region_id` varchar(36) NOT NULL, | 387 | `RegionUUID` varchar(255) DEFAULT NULL, |
892 | `llsd_settings` TEXT NOT NULL, | 388 | `Revision` int(11) DEFAULT NULL, |
893 | PRIMARY KEY (`region_id`) | 389 | `Heightfield` longblob |
894 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 390 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
895 | 391 | ||
896 | COMMIT; | 392 | COMMIT; |
897 | 393 | ||
898 | :VERSION 45 | 394 | :VERSION 55 #----- Increase float precision for windlight needed by scripts |
899 | |||
900 | BEGIN; | ||
901 | |||
902 | CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`)); | ||
903 | |||
904 | COMMIT; | ||
905 | |||
906 | :VERSION 46 #---------------- Dynamic attributes | ||
907 | 395 | ||
908 | BEGIN; | 396 | BEGIN; |
909 | 397 | ||
910 | ALTER TABLE prims ADD COLUMN DynAttrs TEXT; | 398 | ALTER TABLE `regionwindlight` |
911 | |||
912 | COMMIT; | ||
913 | |||
914 | :VERSION 47 #---------------- Extra physics params | ||
915 | |||
916 | BEGIN; | ||
917 | 399 | ||
918 | ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0'; | 400 | MODIFY `water_fog_density_exponent` float(9,7) unsigned NOT NULL DEFAULT '4.0', |
919 | ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000'; | 401 | MODIFY `underwater_fog_modifier` float(9,8) unsigned NOT NULL DEFAULT '0.25', |
920 | ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1'; | 402 | MODIFY `reflection_wavelet_scale_1` float(9,7) unsigned NOT NULL DEFAULT '2.0', |
921 | ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | 403 | MODIFY `reflection_wavelet_scale_2` float(9,7) unsigned NOT NULL DEFAULT '2.0', |
922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | 404 | MODIFY `reflection_wavelet_scale_3` float(9,7) unsigned NOT NULL DEFAULT '2.0', |
405 | MODIFY `fresnel_scale` float(9,8) unsigned NOT NULL DEFAULT '0.40', | ||
406 | MODIFY `fresnel_offset` float(9,8) unsigned NOT NULL DEFAULT '0.50', | ||
407 | MODIFY `refract_scale_above` float(9,8) unsigned NOT NULL DEFAULT '0.03', | ||
408 | MODIFY `refract_scale_below` float(9,8) unsigned NOT NULL DEFAULT '0.20', | ||
409 | MODIFY `blur_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.040', | ||
410 | MODIFY `big_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.05', | ||
411 | MODIFY `big_wave_direction_y` float(9,8) NOT NULL DEFAULT '-0.42', | ||
412 | MODIFY `little_wave_direction_x` float(9,8) NOT NULL DEFAULT '1.11', | ||
413 | MODIFY `little_wave_direction_y` float(9,8) NOT NULL DEFAULT '-1.16', | ||
414 | MODIFY `horizon_r` float(9,8) unsigned NOT NULL DEFAULT '0.25', | ||
415 | MODIFY `horizon_g` float(9,8) unsigned NOT NULL DEFAULT '0.25', | ||
416 | MODIFY `horizon_b` float(9,8) unsigned NOT NULL DEFAULT '0.32', | ||
417 | MODIFY `horizon_i` float(9,8) unsigned NOT NULL DEFAULT '0.32', | ||
418 | MODIFY `haze_horizon` float(9,8) unsigned NOT NULL DEFAULT '0.19', | ||
419 | MODIFY `blue_density_r` float(9,8) unsigned NOT NULL DEFAULT '0.12', | ||
420 | MODIFY `blue_density_g` float(9,8) unsigned NOT NULL DEFAULT '0.22', | ||
421 | MODIFY `blue_density_b` float(9,8) unsigned NOT NULL DEFAULT '0.38', | ||
422 | MODIFY `blue_density_i` float(9,8) unsigned NOT NULL DEFAULT '0.38', | ||
423 | MODIFY `haze_density` float(9,8) unsigned NOT NULL DEFAULT '0.70', | ||
424 | MODIFY `density_multiplier` float(9,8) unsigned NOT NULL DEFAULT '0.18', | ||
425 | MODIFY `distance_multiplier` float(9,6) unsigned NOT NULL DEFAULT '0.8', | ||
426 | MODIFY `sun_moon_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.24', | ||
427 | MODIFY `sun_moon_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.26', | ||
428 | MODIFY `sun_moon_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.30', | ||
429 | MODIFY `sun_moon_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.30', | ||
430 | MODIFY `sun_moon_position` float(9,8) unsigned NOT NULL DEFAULT '0.317', | ||
431 | MODIFY `ambient_r` float(9,8) unsigned NOT NULL DEFAULT '0.35', | ||
432 | MODIFY `ambient_g` float(9,8) unsigned NOT NULL DEFAULT '0.35', | ||
433 | MODIFY `ambient_b` float(9,8) unsigned NOT NULL DEFAULT '0.35', | ||
434 | MODIFY `ambient_i` float(9,8) unsigned NOT NULL DEFAULT '0.35', | ||
435 | MODIFY `east_angle` float(9,8) unsigned NOT NULL DEFAULT '0.00', | ||
436 | MODIFY `sun_glow_focus` float(9,8) unsigned NOT NULL DEFAULT '0.10', | ||
437 | MODIFY `sun_glow_size` float(9,8) unsigned NOT NULL DEFAULT '1.75', | ||
438 | MODIFY `scene_gamma` float(9,7) unsigned NOT NULL DEFAULT '1.00', | ||
439 | MODIFY `star_brightness` float(9,8) unsigned NOT NULL DEFAULT '0.00', | ||
440 | MODIFY `cloud_color_r` float(9,8) unsigned NOT NULL DEFAULT '0.41', | ||
441 | MODIFY `cloud_color_g` float(9,8) unsigned NOT NULL DEFAULT '0.41', | ||
442 | MODIFY `cloud_color_b` float(9,8) unsigned NOT NULL DEFAULT '0.41', | ||
443 | MODIFY `cloud_color_i` float(9,8) unsigned NOT NULL DEFAULT '0.41', | ||
444 | MODIFY `cloud_x` float(9,8) unsigned NOT NULL DEFAULT '1.00', | ||
445 | MODIFY `cloud_y` float(9,8) unsigned NOT NULL DEFAULT '0.53', | ||
446 | MODIFY `cloud_density` float(9,8) unsigned NOT NULL DEFAULT '1.00', | ||
447 | MODIFY `cloud_coverage` float(9,8) unsigned NOT NULL DEFAULT '0.27', | ||
448 | MODIFY `cloud_scale` float(9,8) unsigned NOT NULL DEFAULT '0.42', | ||
449 | MODIFY `cloud_detail_x` float(9,8) unsigned NOT NULL DEFAULT '1.00', | ||
450 | MODIFY `cloud_detail_y` float(9,8) unsigned NOT NULL DEFAULT '0.53', | ||
451 | MODIFY `cloud_detail_density` float(9,8) unsigned NOT NULL DEFAULT '0.12', | ||
452 | MODIFY `cloud_scroll_x` float(9,7) NOT NULL DEFAULT '0.20', | ||
453 | MODIFY `cloud_scroll_y` float(9,7) NOT NULL DEFAULT '0.01'; | ||
923 | 454 | ||
924 | COMMIT; | 455 | COMMIT; |
925 | 456 | ||
926 | :VERSION 48 #---------------- Keyframes | 457 | :VERSION 56 #----- Add RezzerID field in table prims |
927 | 458 | ||
928 | BEGIN; | 459 | BEGIN; |
929 | 460 | ||
930 | ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob; | 461 | ALTER TABLE `prims` ADD COLUMN `RezzerID` char(36) DEFAULT NULL; |
931 | 462 | ||
932 | COMMIT; | 463 | COMMIT; |
933 | 464 | ||
934 | :VERSION 49 #--------------------- Save attachment info | 465 | :VERSION 57 #----- Add physics inertia data |
935 | 466 | ||
936 | BEGIN; | 467 | BEGIN; |
937 | ALTER TABLE prims ADD COLUMN AttachedPosX double default 0; | 468 | ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL; |
938 | ALTER TABLE prims ADD COLUMN AttachedPosY double default 0; | ||
939 | ALTER TABLE prims ADD COLUMN AttachedPosZ double default 0; | ||
940 | ALTER TABLE primshapes ADD COLUMN LastAttachPoint int(4) not null default '0'; | ||
941 | COMMIT; | 469 | COMMIT; |
942 | |||
943 | :VERSION 50 #---- Change LandFlags to unsigned | ||
944 | |||
945 | BEGIN; | ||
946 | |||
947 | ALTER TABLE land CHANGE COLUMN LandFlags LandFlags int unsigned default null; | ||
948 | |||
949 | COMMIT; | ||
950 | |||
diff --git a/OpenSim/Data/MySQL/Resources/UserAccount.migrations b/OpenSim/Data/MySQL/Resources/UserAccount.migrations index 97e5e4f..dcb375e 100644 --- a/OpenSim/Data/MySQL/Resources/UserAccount.migrations +++ b/OpenSim/Data/MySQL/Resources/UserAccount.migrations | |||
@@ -1,47 +1,31 @@ | |||
1 | :VERSION 1 # ------------------------- | 1 | :VERSION 5 # ------------------------- |
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `UserAccounts` ( | 5 | CREATE TABLE IF NOT EXISTS `UserAccounts` ( |
6 | `PrincipalID` CHAR(36) NOT NULL, | 6 | `PrincipalID` char(36) NOT NULL, |
7 | `ScopeID` CHAR(36) NOT NULL, | 7 | `ScopeID` char(36) NOT NULL, |
8 | `FirstName` VARCHAR(64) NOT NULL, | 8 | `FirstName` varchar(64) NOT NULL, |
9 | `LastName` VARCHAR(64) NOT NULL, | 9 | `LastName` varchar(64) NOT NULL, |
10 | `Email` VARCHAR(64), | 10 | `Email` varchar(64) DEFAULT NULL, |
11 | `ServiceURLs` TEXT, | 11 | `ServiceURLs` text, |
12 | `Created` INT(11) | 12 | `Created` int(11) DEFAULT NULL, |
13 | `UserLevel` int(11) NOT NULL DEFAULT '0', | ||
14 | `UserFlags` int(11) NOT NULL DEFAULT '0', | ||
15 | `UserTitle` varchar(64) NOT NULL DEFAULT '', | ||
16 | UNIQUE KEY `PrincipalID` (`PrincipalID`), | ||
17 | KEY `Email` (`Email`), | ||
18 | KEY `FirstName` (`FirstName`), | ||
19 | KEY `LastName` (`LastName`), | ||
20 | KEY `Name` (`FirstName`,`LastName`) | ||
13 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | 21 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
14 | 22 | ||
15 | COMMIT; | 23 | COMMIT; |
16 | 24 | ||
17 | :VERSION 2 # ------------------------- | 25 | :VERSION 6 # ------------------------- |
18 | 26 | ||
19 | BEGIN; | 27 | BEGIN; |
20 | 28 | ||
21 | INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, lastname AS LastName, email as Email, CONCAT('AssetServerURI=', userAssetURI, ' InventoryServerURI=', userInventoryURI, ' GatewayURI= HomeURI=') AS ServiceURLs, created as Created FROM users; | 29 | ALTER TABLE `UserAccounts` ADD `active` INT NOT NULL DEFAULT '1'; |
22 | 30 | ||
23 | COMMIT; | 31 | COMMIT; |
24 | |||
25 | :VERSION 3 # ------------------------- | ||
26 | |||
27 | BEGIN; | ||
28 | |||
29 | CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID); | ||
30 | CREATE INDEX Email ON UserAccounts(Email); | ||
31 | CREATE INDEX FirstName ON UserAccounts(FirstName); | ||
32 | CREATE INDEX LastName ON UserAccounts(LastName); | ||
33 | CREATE INDEX Name ON UserAccounts(FirstName,LastName); | ||
34 | |||
35 | COMMIT; | ||
36 | |||
37 | :VERSION 4 # ------------------------- | ||
38 | |||
39 | BEGIN; | ||
40 | |||
41 | ALTER TABLE UserAccounts ADD COLUMN UserLevel integer NOT NULL DEFAULT 0; | ||
42 | ALTER TABLE UserAccounts ADD COLUMN UserFlags integer NOT NULL DEFAULT 0; | ||
43 | ALTER TABLE UserAccounts ADD COLUMN UserTitle varchar(64) NOT NULL DEFAULT ''; | ||
44 | |||
45 | COMMIT; | ||
46 | |||
47 | |||
diff --git a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations index 0759b26..512b6ed 100644 --- a/OpenSim/Data/MySQL/Resources/UserProfiles.migrations +++ b/OpenSim/Data/MySQL/Resources/UserProfiles.migrations | |||
@@ -1,4 +1,4 @@ | |||
1 | :VERSION 1 # ------------------------------- | 1 | :VERSION 5 # ------------------------------- |
2 | 2 | ||
3 | begin; | 3 | begin; |
4 | 4 | ||
@@ -44,6 +44,7 @@ CREATE TABLE IF NOT EXISTS `userpicks` ( | |||
44 | `posglobal` varchar(255) NOT NULL, | 44 | `posglobal` varchar(255) NOT NULL, |
45 | `sortorder` int(2) NOT NULL, | 45 | `sortorder` int(2) NOT NULL, |
46 | `enabled` enum('true','false') NOT NULL, | 46 | `enabled` enum('true','false') NOT NULL, |
47 | `gatekeeper` varchar(255), | ||
47 | PRIMARY KEY (`pickuuid`) | 48 | PRIMARY KEY (`pickuuid`) |
48 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 49 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
49 | 50 | ||
@@ -66,11 +67,6 @@ CREATE TABLE IF NOT EXISTS `userprofile` ( | |||
66 | PRIMARY KEY (`useruuid`) | 67 | PRIMARY KEY (`useruuid`) |
67 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 68 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
68 | 69 | ||
69 | commit; | ||
70 | |||
71 | :VERSION 2 # ------------------------------- | ||
72 | |||
73 | begin; | ||
74 | CREATE TABLE IF NOT EXISTS `userdata` ( | 70 | CREATE TABLE IF NOT EXISTS `userdata` ( |
75 | `UserId` char(36) NOT NULL, | 71 | `UserId` char(36) NOT NULL, |
76 | `TagId` varchar(64) NOT NULL, | 72 | `TagId` varchar(64) NOT NULL, |
@@ -79,10 +75,6 @@ CREATE TABLE IF NOT EXISTS `userdata` ( | |||
79 | PRIMARY KEY (`UserId`,`TagId`) | 75 | PRIMARY KEY (`UserId`,`TagId`) |
80 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 76 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
81 | 77 | ||
82 | commit; | ||
83 | |||
84 | :VERSION 3 # ------------------------------- | ||
85 | begin; | ||
86 | CREATE TABLE IF NOT EXISTS `usersettings` ( | 78 | CREATE TABLE IF NOT EXISTS `usersettings` ( |
87 | `useruuid` varchar(36) NOT NULL, | 79 | `useruuid` varchar(36) NOT NULL, |
88 | `imviaemail` enum('true','false') NOT NULL, | 80 | `imviaemail` enum('true','false') NOT NULL, |
@@ -90,9 +82,5 @@ CREATE TABLE IF NOT EXISTS `usersettings` ( | |||
90 | `email` varchar(254) NOT NULL, | 82 | `email` varchar(254) NOT NULL, |
91 | PRIMARY KEY (`useruuid`) | 83 | PRIMARY KEY (`useruuid`) |
92 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | 84 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
93 | commit; | ||
94 | 85 | ||
95 | :VERSION 4 # ------------------------------- | ||
96 | begin; | ||
97 | ALTER TABLE userpicks ADD COLUMN gatekeeper varchar(255); | ||
98 | commit; | 86 | commit; |
diff --git a/OpenSim/Data/MySQL/Resources/UserStore.migrations b/OpenSim/Data/MySQL/Resources/UserStore.migrations deleted file mode 100644 index 9129075..0000000 --- a/OpenSim/Data/MySQL/Resources/UserStore.migrations +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | :VERSION 1 # ----------------------------- | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | SET FOREIGN_KEY_CHECKS=0; | ||
6 | -- ---------------------------- | ||
7 | -- Table structure for agents | ||
8 | -- ---------------------------- | ||
9 | CREATE TABLE `agents` ( | ||
10 | `UUID` varchar(36) NOT NULL, | ||
11 | `sessionID` varchar(36) NOT NULL, | ||
12 | `secureSessionID` varchar(36) NOT NULL, | ||
13 | `agentIP` varchar(16) NOT NULL, | ||
14 | `agentPort` int(11) NOT NULL, | ||
15 | `agentOnline` tinyint(4) NOT NULL, | ||
16 | `loginTime` int(11) NOT NULL, | ||
17 | `logoutTime` int(11) NOT NULL, | ||
18 | `currentRegion` varchar(36) NOT NULL, | ||
19 | `currentHandle` bigint(20) unsigned NOT NULL, | ||
20 | `currentPos` varchar(64) NOT NULL, | ||
21 | PRIMARY KEY (`UUID`), | ||
22 | UNIQUE KEY `session` (`sessionID`), | ||
23 | UNIQUE KEY `ssession` (`secureSessionID`) | ||
24 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
25 | |||
26 | -- Create schema avatar_appearance | ||
27 | -- | ||
28 | |||
29 | CREATE TABLE `avatarappearance` ( | ||
30 | Owner char(36) NOT NULL, | ||
31 | Serial int(10) unsigned NOT NULL, | ||
32 | Visual_Params blob NOT NULL, | ||
33 | Texture blob NOT NULL, | ||
34 | Avatar_Height float NOT NULL, | ||
35 | Body_Item char(36) NOT NULL, | ||
36 | Body_Asset char(36) NOT NULL, | ||
37 | Skin_Item char(36) NOT NULL, | ||
38 | Skin_Asset char(36) NOT NULL, | ||
39 | Hair_Item char(36) NOT NULL, | ||
40 | Hair_Asset char(36) NOT NULL, | ||
41 | Eyes_Item char(36) NOT NULL, | ||
42 | Eyes_Asset char(36) NOT NULL, | ||
43 | Shirt_Item char(36) NOT NULL, | ||
44 | Shirt_Asset char(36) NOT NULL, | ||
45 | Pants_Item char(36) NOT NULL, | ||
46 | Pants_Asset char(36) NOT NULL, | ||
47 | Shoes_Item char(36) NOT NULL, | ||
48 | Shoes_Asset char(36) NOT NULL, | ||
49 | Socks_Item char(36) NOT NULL, | ||
50 | Socks_Asset char(36) NOT NULL, | ||
51 | Jacket_Item char(36) NOT NULL, | ||
52 | Jacket_Asset char(36) NOT NULL, | ||
53 | Gloves_Item char(36) NOT NULL, | ||
54 | Gloves_Asset char(36) NOT NULL, | ||
55 | Undershirt_Item char(36) NOT NULL, | ||
56 | Undershirt_Asset char(36) NOT NULL, | ||
57 | Underpants_Item char(36) NOT NULL, | ||
58 | Underpants_Asset char(36) NOT NULL, | ||
59 | Skirt_Item char(36) NOT NULL, | ||
60 | Skirt_Asset char(36) NOT NULL, | ||
61 | PRIMARY KEY (`Owner`) | ||
62 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
63 | |||
64 | SET FOREIGN_KEY_CHECKS=0; | ||
65 | -- ---------------------------- | ||
66 | -- Table structure for users | ||
67 | -- ---------------------------- | ||
68 | CREATE TABLE `userfriends` ( | ||
69 | `ownerID` VARCHAR(37) NOT NULL, | ||
70 | `friendID` VARCHAR(37) NOT NULL, | ||
71 | `friendPerms` INT NOT NULL, | ||
72 | `datetimestamp` INT NOT NULL, | ||
73 | UNIQUE KEY (`ownerID`, `friendID`) | ||
74 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
75 | -- ---------------------------- | ||
76 | -- Table structure for users | ||
77 | -- ---------------------------- | ||
78 | CREATE TABLE `users` ( | ||
79 | `UUID` varchar(36) NOT NULL default '', | ||
80 | `username` varchar(32) NOT NULL, | ||
81 | `lastname` varchar(32) NOT NULL, | ||
82 | `passwordHash` varchar(32) NOT NULL, | ||
83 | `passwordSalt` varchar(32) NOT NULL, | ||
84 | `homeRegion` bigint(20) unsigned default NULL, | ||
85 | `homeLocationX` float default NULL, | ||
86 | `homeLocationY` float default NULL, | ||
87 | `homeLocationZ` float default NULL, | ||
88 | `homeLookAtX` float default NULL, | ||
89 | `homeLookAtY` float default NULL, | ||
90 | `homeLookAtZ` float default NULL, | ||
91 | `created` int(11) NOT NULL, | ||
92 | `lastLogin` int(11) NOT NULL, | ||
93 | `userInventoryURI` varchar(255) default NULL, | ||
94 | `userAssetURI` varchar(255) default NULL, | ||
95 | `profileCanDoMask` int(10) unsigned default NULL, | ||
96 | `profileWantDoMask` int(10) unsigned default NULL, | ||
97 | `profileAboutText` text, | ||
98 | `profileFirstText` text, | ||
99 | `profileImage` varchar(36) default NULL, | ||
100 | `profileFirstImage` varchar(36) default NULL, | ||
101 | `webLoginKey` varchar(36) default NULL, | ||
102 | PRIMARY KEY (`UUID`), | ||
103 | UNIQUE KEY `usernames` (`username`,`lastname`) | ||
104 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
105 | |||
106 | -- ---------------------------- | ||
107 | -- Records | ||
108 | -- ---------------------------- | ||
109 | COMMIT; | ||
110 | |||
111 | :VERSION 2 # ----------------------------- | ||
112 | |||
113 | BEGIN; | ||
114 | |||
115 | ALTER TABLE users add homeRegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; | ||
116 | |||
117 | COMMIT; | ||
118 | |||
119 | :VERSION 3 # ----------------------------- | ||
120 | |||
121 | BEGIN; | ||
122 | |||
123 | ALTER TABLE users add userFlags integer NOT NULL default 0; | ||
124 | ALTER TABLE users add godLevel integer NOT NULL default 0; | ||
125 | |||
126 | COMMIT; | ||
127 | |||
128 | :VERSION 4 # ----------------------------- | ||
129 | |||
130 | BEGIN; | ||
131 | |||
132 | ALTER TABLE users add customType varchar(32) not null default ''; | ||
133 | ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
134 | |||
135 | COMMIT; | ||
136 | |||
137 | :VERSION 5 # ----------------------------- | ||
138 | |||
139 | BEGIN; | ||
140 | |||
141 | CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL, `attachpoint` int(11) NOT NULL, `item` char(36) NOT NULL, `asset` char(36) NOT NULL) ENGINE=MyISAM; | ||
142 | |||
143 | COMMIT; | ||
144 | |||
145 | :VERSION 6 # ----------------------------- | ||
146 | |||
147 | BEGIN; | ||
148 | |||
149 | ALTER TABLE agents add currentLookAt varchar(36) not null default ''; | ||
150 | |||
151 | COMMIT; | ||
152 | |||
153 | :VERSION 7 # ----------------------------- | ||
154 | |||
155 | BEGIN; | ||
156 | |||
157 | ALTER TABLE users add email varchar(250); | ||
158 | |||
159 | COMMIT; | ||
160 | |||
161 | :VERSION 8 # ----------------------------- | ||
162 | |||
163 | BEGIN; | ||
164 | |||
165 | ALTER TABLE users add scopeID char(36) not null default '00000000-0000-0000-0000-000000000000'; | ||
166 | |||
167 | COMMIT; | ||
168 | |||
diff --git a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations index 78d6e51..7641a97 100644 --- a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations +++ b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | BEGIN; | 4 | BEGIN; |
5 | 5 | ||
6 | CREATE TABLE `XAssetsMeta` ( | 6 | CREATE TABLE IF NOT EXISTS `XAssetsMeta` ( |
7 | `ID` char(36) NOT NULL, | 7 | `ID` char(36) NOT NULL, |
8 | `Hash` binary(32) NOT NULL, | 8 | `Hash` binary(32) NOT NULL, |
9 | `Name` varchar(64) NOT NULL, | 9 | `Name` varchar(64) NOT NULL, |
@@ -18,7 +18,7 @@ CREATE TABLE `XAssetsMeta` ( | |||
18 | PRIMARY KEY (`id`) | 18 | PRIMARY KEY (`id`) |
19 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Version 1'; | 19 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Version 1'; |
20 | 20 | ||
21 | CREATE TABLE `XAssetsData` ( | 21 | CREATE TABLE IF NOT EXISTS `XAssetsData` ( |
22 | `Hash` binary(32) NOT NULL, | 22 | `Hash` binary(32) NOT NULL, |
23 | `Data` longblob NOT NULL, | 23 | `Data` longblob NOT NULL, |
24 | PRIMARY KEY (`hash`) | 24 | PRIMARY KEY (`hash`) |
diff --git a/OpenSim/Data/MySQL/Resources/XMute.migrations b/OpenSim/Data/MySQL/Resources/XMute.migrations new file mode 100644 index 0000000..084c67b --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/XMute.migrations | |||
@@ -0,0 +1,16 @@ | |||
1 | :VERSION 1 | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | CREATE TABLE IF NOT EXISTS `XMute` ( | ||
6 | `AgentID` char(36) NOT NULL, | ||
7 | `MuteID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', | ||
8 | `MuteName` varchar(64) NOT NULL DEFAULT '', | ||
9 | `MuteType` int(11) NOT NULL DEFAULT '1', | ||
10 | `MuteFlags` int(11) NOT NULL DEFAULT '0', | ||
11 | `Stamp` int(11) NOT NULL, | ||
12 | UNIQUE KEY `AgentID_2` (`AgentID`,`MuteID`,`MuteName`), | ||
13 | KEY `AgentID` (`AgentID`) | ||
14 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; | ||
15 | |||
16 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations index 9e6f1c1..0b605ab 100644 --- a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations +++ b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | BEGIN; | 3 | BEGIN; |
4 | 4 | ||
5 | CREATE TABLE `os_groups_groups` ( | 5 | CREATE TABLE IF NOT EXISTS `os_groups_groups` ( |
6 | `GroupID` char(36) NOT NULL default '', | 6 | `GroupID` char(36) NOT NULL default '', |
7 | `Location` varchar(255) NOT NULL default '', | 7 | `Location` varchar(255) NOT NULL default '', |
8 | `Name` varchar(255) NOT NULL default '', | 8 | `Name` varchar(255) NOT NULL default '', |
@@ -18,10 +18,10 @@ 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=MyISAM; | 21 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
22 | 22 | ||
23 | 23 | ||
24 | CREATE TABLE `os_groups_membership` ( | 24 | CREATE TABLE IF NOT EXISTS `os_groups_membership` ( |
25 | `GroupID`char(36) NOT NULL default '', | 25 | `GroupID`char(36) NOT NULL default '', |
26 | `PrincipalID` VARCHAR(255) NOT NULL default '', | 26 | `PrincipalID` VARCHAR(255) NOT NULL default '', |
27 | `SelectedRoleID` char(36) NOT NULL default '', | 27 | `SelectedRoleID` char(36) NOT NULL default '', |
@@ -31,10 +31,10 @@ CREATE TABLE `os_groups_membership` ( | |||
31 | `AccessToken` char(36) NOT NULL default '', | 31 | `AccessToken` char(36) NOT NULL default '', |
32 | PRIMARY KEY (`GroupID`,`PrincipalID`), | 32 | PRIMARY KEY (`GroupID`,`PrincipalID`), |
33 | KEY `PrincipalID` (`PrincipalID`) | 33 | KEY `PrincipalID` (`PrincipalID`) |
34 | ) ENGINE=MyISAM; | 34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
35 | 35 | ||
36 | 36 | ||
37 | CREATE TABLE `os_groups_roles` ( | 37 | CREATE TABLE IF NOT EXISTS `os_groups_roles` ( |
38 | `GroupID` char(36) NOT NULL default '', | 38 | `GroupID` char(36) NOT NULL default '', |
39 | `RoleID` char(36) NOT NULL default '', | 39 | `RoleID` char(36) NOT NULL default '', |
40 | `Name` varchar(255) NOT NULL default '', | 40 | `Name` varchar(255) NOT NULL default '', |
@@ -43,19 +43,19 @@ CREATE TABLE `os_groups_roles` ( | |||
43 | `Powers` bigint(20) unsigned NOT NULL default '0', | 43 | `Powers` bigint(20) unsigned NOT NULL default '0', |
44 | PRIMARY KEY (`GroupID`,`RoleID`), | 44 | PRIMARY KEY (`GroupID`,`RoleID`), |
45 | KEY `GroupID` (`GroupID`) | 45 | KEY `GroupID` (`GroupID`) |
46 | ) ENGINE=MyISAM; | 46 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
47 | 47 | ||
48 | 48 | ||
49 | CREATE TABLE `os_groups_rolemembership` ( | 49 | CREATE TABLE IF NOT EXISTS `os_groups_rolemembership` ( |
50 | `GroupID` char(36) NOT NULL default '', | 50 | `GroupID` char(36) NOT NULL default '', |
51 | `RoleID` char(36) NOT NULL default '', | 51 | `RoleID` char(36) NOT NULL default '', |
52 | `PrincipalID` VARCHAR(255) NOT NULL default '', | 52 | `PrincipalID` VARCHAR(255) NOT NULL default '', |
53 | PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`), | 53 | PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`), |
54 | KEY `PrincipalID` (`PrincipalID`) | 54 | KEY `PrincipalID` (`PrincipalID`) |
55 | ) ENGINE=MyISAM; | 55 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
56 | 56 | ||
57 | 57 | ||
58 | CREATE TABLE `os_groups_invites` ( | 58 | CREATE TABLE IF NOT EXISTS `os_groups_invites` ( |
59 | `InviteID` char(36) NOT NULL default '', | 59 | `InviteID` char(36) NOT NULL default '', |
60 | `GroupID` char(36) NOT NULL default '', | 60 | `GroupID` char(36) NOT NULL default '', |
61 | `RoleID` char(36) NOT NULL default '', | 61 | `RoleID` char(36) NOT NULL default '', |
@@ -63,10 +63,10 @@ CREATE TABLE `os_groups_invites` ( | |||
63 | `TMStamp` timestamp NOT NULL, | 63 | `TMStamp` timestamp NOT NULL, |
64 | PRIMARY KEY (`InviteID`), | 64 | PRIMARY KEY (`InviteID`), |
65 | UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`) | 65 | UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`) |
66 | ) ENGINE=MyISAM; | 66 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
67 | 67 | ||
68 | 68 | ||
69 | CREATE TABLE `os_groups_notices` ( | 69 | CREATE TABLE IF NOT EXISTS `os_groups_notices` ( |
70 | `GroupID` char(36) NOT NULL default '', | 70 | `GroupID` char(36) NOT NULL default '', |
71 | `NoticeID` char(36) NOT NULL default '', | 71 | `NoticeID` char(36) NOT NULL default '', |
72 | `TMStamp` int(10) unsigned NOT NULL default '0', | 72 | `TMStamp` int(10) unsigned NOT NULL default '0', |
@@ -81,13 +81,13 @@ CREATE TABLE `os_groups_notices` ( | |||
81 | PRIMARY KEY (`NoticeID`), | 81 | PRIMARY KEY (`NoticeID`), |
82 | KEY `GroupID` (`GroupID`), | 82 | KEY `GroupID` (`GroupID`), |
83 | KEY `TMStamp` (`TMStamp`) | 83 | KEY `TMStamp` (`TMStamp`) |
84 | ) ENGINE=MyISAM; | 84 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
85 | 85 | ||
86 | CREATE TABLE `os_groups_principals` ( | 86 | CREATE TABLE IF NOT EXISTS `os_groups_principals` ( |
87 | `PrincipalID` VARCHAR(255) NOT NULL default '', | 87 | `PrincipalID` VARCHAR(255) NOT NULL default '', |
88 | `ActiveGroupID` char(36) NOT NULL default '', | 88 | `ActiveGroupID` char(36) NOT NULL default '', |
89 | PRIMARY KEY (`PrincipalID`) | 89 | PRIMARY KEY (`PrincipalID`) |
90 | ) ENGINE=MyISAM; | 90 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
91 | 91 | ||
92 | COMMIT; | 92 | COMMIT; |
93 | 93 | ||
@@ -112,4 +112,4 @@ DROP TABLE `diva_groups_principals`; | |||
112 | 112 | ||
113 | DELETE FROM `migrations` WHERE name='diva_im_Store'; | 113 | DELETE FROM `migrations` WHERE name='diva_im_Store'; |
114 | 114 | ||
115 | COMMIT; \ No newline at end of file | 115 | COMMIT; |