aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-05-07 14:20:32 +0000
committerJustin Clarke Casey2009-05-07 14:20:32 +0000
commit2284c8509f29b8766794f6482839cd9bc5e9f300 (patch)
treedb47fdd97f8b67d969f70aafd8429ab5fe9e0577 /OpenSim/Data
parentminor: Inconsquential change to provoke another build (diff)
downloadopensim-SC-2284c8509f29b8766794f6482839cd9bc5e9f300.zip
opensim-SC-2284c8509f29b8766794f6482839cd9bc5e9f300.tar.gz
opensim-SC-2284c8509f29b8766794f6482839cd9bc5e9f300.tar.bz2
opensim-SC-2284c8509f29b8766794f6482839cd9bc5e9f300.tar.xz
* Consistently used dashed uuid format for mysql region data, as is done for all other tables
* This revision contains a mysql data migration. Please backup your mysql region database as a precaution before using this code. * I also advise that you do a runprebuild[.sh|.bat] and a clean build ("nant clean build" if you're using the command line). * This change is needed for future id schemes
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs55
-rw-r--r--OpenSim/Data/MySQL/Resources/028_RegionStore.sql79
2 files changed, 105 insertions, 29 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index e39b185..b13813f 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -282,7 +282,7 @@ namespace OpenSim.Data.MySQL
282 cmd.CommandText = "select UUID from prims where "+ 282 cmd.CommandText = "select UUID from prims where "+
283 "SceneGroupID= ?UUID"; 283 "SceneGroupID= ?UUID";
284 284
285 cmd.Parameters.AddWithValue("UUID", Util.ToRawUuidString(obj)); 285 cmd.Parameters.AddWithValue("UUID", obj.ToString());
286 286
287 List<UUID> uuids = new List<UUID>(); 287 List<UUID> uuids = new List<UUID>();
288 288
@@ -365,7 +365,7 @@ namespace OpenSim.Data.MySQL
365 365
366 for (int i = 0; i < uuids.Count; i++) 366 for (int i = 0; i < uuids.Count; i++)
367 { 367 {
368 cmd.Parameters.AddWithValue("UUID" + i, Util.ToRawUuidString(uuids[i])); 368 cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString());
369 } 369 }
370 370
371 ExecuteNonQuery(cmd); 371 ExecuteNonQuery(cmd);
@@ -426,8 +426,7 @@ namespace OpenSim.Data.MySQL
426 "where RegionUUID = ?RegionUUID " + 426 "where RegionUUID = ?RegionUUID " +
427 "order by SceneGroupID asc, sort asc, LinkNumber asc"; 427 "order by SceneGroupID asc, sort asc, LinkNumber asc";
428 428
429 cmd.Parameters.AddWithValue("RegionUUID", 429 cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
430 Util.ToRawUuidString(regionUUID));
431 430
432 IDataReader reader = ExecuteReader(cmd); 431 IDataReader reader = ExecuteReader(cmd);
433 432
@@ -549,8 +548,7 @@ namespace OpenSim.Data.MySQL
549 548
550 cmd.CommandText = "delete from terrain where " + 549 cmd.CommandText = "delete from terrain where " +
551 "RegionUUID = ?RegionUUID"; 550 "RegionUUID = ?RegionUUID";
552 cmd.Parameters.AddWithValue("RegionUUID", 551 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
553 Util.ToRawUuidString(regionID));
554 552
555 ExecuteNonQuery(cmd); 553 ExecuteNonQuery(cmd);
556 554
@@ -576,7 +574,7 @@ namespace OpenSim.Data.MySQL
576 cmd.CommandText = "select RegionUUID, Revision, Heightfield " + 574 cmd.CommandText = "select RegionUUID, Revision, Heightfield " +
577 "from terrain where RegionUUID = ?RegionUUID "+ 575 "from terrain where RegionUUID = ?RegionUUID "+
578 "order by Revision desc limit 1"; 576 "order by Revision desc limit 1";
579 cmd.Parameters.AddWithValue("RegionUUID", Util.ToRawUuidString(regionID)); 577 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
580 578
581 IDataReader reader = ExecuteReader(cmd); 579 IDataReader reader = ExecuteReader(cmd);
582 580
@@ -621,7 +619,7 @@ namespace OpenSim.Data.MySQL
621 619
622 cmd.CommandText = "delete from land where UUID = ?UUID"; 620 cmd.CommandText = "delete from land where UUID = ?UUID";
623 621
624 cmd.Parameters.AddWithValue("UUID", Util.ToRawUuidString(globalID)); 622 cmd.Parameters.AddWithValue("UUID", globalID.ToString());
625 623
626 ExecuteNonQuery(cmd); 624 ExecuteNonQuery(cmd);
627 cmd.Dispose(); 625 cmd.Dispose();
@@ -775,8 +773,7 @@ namespace OpenSim.Data.MySQL
775 cmd.CommandText = "select * from land where " + 773 cmd.CommandText = "select * from land where " +
776 "RegionUUID = ?RegionUUID"; 774 "RegionUUID = ?RegionUUID";
777 775
778 cmd.Parameters.AddWithValue("RegionUUID", 776 cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
779 Util.ToRawUuidString(regionUUID));
780 777
781 IDataReader reader = ExecuteReader(cmd); 778 IDataReader reader = ExecuteReader(cmd);
782 779
@@ -800,8 +797,7 @@ namespace OpenSim.Data.MySQL
800 cmd.CommandText = "select * from landaccesslist " + 797 cmd.CommandText = "select * from landaccesslist " +
801 "where LandUUID = ?LandUUID"; 798 "where LandUUID = ?LandUUID";
802 799
803 cmd.Parameters.AddWithValue("LandUUID", 800 cmd.Parameters.AddWithValue("LandUUID", land.GlobalID.ToString());
804 Util.ToRawUuidString(land.GlobalID));
805 801
806 reader = ExecuteReader(cmd); 802 reader = ExecuteReader(cmd);
807 803
@@ -1157,11 +1153,11 @@ namespace OpenSim.Data.MySQL
1157 /// <param name="regionUUID"></param> 1153 /// <param name="regionUUID"></param>
1158 private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) 1154 private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
1159 { 1155 {
1160 cmd.Parameters.AddWithValue("UUID", Util.ToRawUuidString(prim.UUID)); 1156 cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
1161 cmd.Parameters.AddWithValue("RegionUUID", Util.ToRawUuidString(regionUUID)); 1157 cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
1162 cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate); 1158 cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate);
1163 cmd.Parameters.AddWithValue("Name", prim.Name); 1159 cmd.Parameters.AddWithValue("Name", prim.Name);
1164 cmd.Parameters.AddWithValue("SceneGroupID", Util.ToRawUuidString(sceneGroupID)); 1160 cmd.Parameters.AddWithValue("SceneGroupID", sceneGroupID.ToString());
1165 // the UUID of the root part for this SceneObjectGroup 1161 // the UUID of the root part for this SceneObjectGroup
1166 // various text fields 1162 // various text fields
1167 cmd.Parameters.AddWithValue("Text", prim.Text); 1163 cmd.Parameters.AddWithValue("Text", prim.Text);
@@ -1174,10 +1170,10 @@ namespace OpenSim.Data.MySQL
1174 cmd.Parameters.AddWithValue("TouchName", prim.TouchName); 1170 cmd.Parameters.AddWithValue("TouchName", prim.TouchName);
1175 // permissions 1171 // permissions
1176 cmd.Parameters.AddWithValue("ObjectFlags", prim.ObjectFlags); 1172 cmd.Parameters.AddWithValue("ObjectFlags", prim.ObjectFlags);
1177 cmd.Parameters.AddWithValue("CreatorID", Util.ToRawUuidString(prim.CreatorID)); 1173 cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString());
1178 cmd.Parameters.AddWithValue("OwnerID", Util.ToRawUuidString(prim.OwnerID)); 1174 cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
1179 cmd.Parameters.AddWithValue("GroupID", Util.ToRawUuidString(prim.GroupID)); 1175 cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
1180 cmd.Parameters.AddWithValue("LastOwnerID", Util.ToRawUuidString(prim.LastOwnerID)); 1176 cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString());
1181 cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); 1177 cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask);
1182 cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); 1178 cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask);
1183 cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); 1179 cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask);
@@ -1361,8 +1357,8 @@ namespace OpenSim.Data.MySQL
1361 /// <param name="regionUUID"></param> 1357 /// <param name="regionUUID"></param>
1362 private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID) 1358 private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID)
1363 { 1359 {
1364 cmd.Parameters.AddWithValue("UUID", Util.ToRawUuidString(land.GlobalID)); 1360 cmd.Parameters.AddWithValue("UUID", land.GlobalID.ToString());
1365 cmd.Parameters.AddWithValue("RegionUUID", Util.ToRawUuidString(regionUUID)); 1361 cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString());
1366 cmd.Parameters.AddWithValue("LocalLandID", land.LocalID); 1362 cmd.Parameters.AddWithValue("LocalLandID", land.LocalID);
1367 1363
1368 // Bitmap is a byte[512] 1364 // Bitmap is a byte[512]
@@ -1370,25 +1366,25 @@ namespace OpenSim.Data.MySQL
1370 1366
1371 cmd.Parameters.AddWithValue("Name", land.Name); 1367 cmd.Parameters.AddWithValue("Name", land.Name);
1372 cmd.Parameters.AddWithValue("Description", land.Description); 1368 cmd.Parameters.AddWithValue("Description", land.Description);
1373 cmd.Parameters.AddWithValue("OwnerUUID", Util.ToRawUuidString(land.OwnerID)); 1369 cmd.Parameters.AddWithValue("OwnerUUID", land.OwnerID.ToString());
1374 cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned); 1370 cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned);
1375 cmd.Parameters.AddWithValue("Area", land.Area); 1371 cmd.Parameters.AddWithValue("Area", land.Area);
1376 cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented 1372 cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented
1377 cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory 1373 cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory
1378 cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate); 1374 cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate);
1379 cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice); 1375 cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice);
1380 cmd.Parameters.AddWithValue("GroupUUID", Util.ToRawUuidString(land.GroupID)); 1376 cmd.Parameters.AddWithValue("GroupUUID", land.GroupID.ToString());
1381 cmd.Parameters.AddWithValue("SalePrice", land.SalePrice); 1377 cmd.Parameters.AddWithValue("SalePrice", land.SalePrice);
1382 cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus 1378 cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus
1383 cmd.Parameters.AddWithValue("LandFlags", land.Flags); 1379 cmd.Parameters.AddWithValue("LandFlags", land.Flags);
1384 cmd.Parameters.AddWithValue("LandingType", land.LandingType); 1380 cmd.Parameters.AddWithValue("LandingType", land.LandingType);
1385 cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale); 1381 cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale);
1386 cmd.Parameters.AddWithValue("MediaTextureUUID", Util.ToRawUuidString(land.MediaID)); 1382 cmd.Parameters.AddWithValue("MediaTextureUUID", land.MediaID.ToString());
1387 cmd.Parameters.AddWithValue("MediaURL", land.MediaURL); 1383 cmd.Parameters.AddWithValue("MediaURL", land.MediaURL);
1388 cmd.Parameters.AddWithValue("MusicURL", land.MusicURL); 1384 cmd.Parameters.AddWithValue("MusicURL", land.MusicURL);
1389 cmd.Parameters.AddWithValue("PassHours", land.PassHours); 1385 cmd.Parameters.AddWithValue("PassHours", land.PassHours);
1390 cmd.Parameters.AddWithValue("PassPrice", land.PassPrice); 1386 cmd.Parameters.AddWithValue("PassPrice", land.PassPrice);
1391 cmd.Parameters.AddWithValue("SnapshotUUID", Util.ToRawUuidString(land.SnapshotID)); 1387 cmd.Parameters.AddWithValue("SnapshotUUID", land.SnapshotID.ToString());
1392 cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X); 1388 cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X);
1393 cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y); 1389 cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y);
1394 cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z); 1390 cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z);
@@ -1408,8 +1404,8 @@ namespace OpenSim.Data.MySQL
1408 /// <param name="parcelID"></param> 1404 /// <param name="parcelID"></param>
1409 private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID) 1405 private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID)
1410 { 1406 {
1411 cmd.Parameters.AddWithValue("LandUUID", Util.ToRawUuidString(parcelID)); 1407 cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString());
1412 cmd.Parameters.AddWithValue("AccessUUID", Util.ToRawUuidString(entry.AgentID)); 1408 cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString());
1413 cmd.Parameters.AddWithValue("Flags", entry.Flags); 1409 cmd.Parameters.AddWithValue("Flags", entry.Flags);
1414 } 1410 }
1415 1411
@@ -1465,7 +1461,7 @@ namespace OpenSim.Data.MySQL
1465 private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim) 1461 private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim)
1466 { 1462 {
1467 PrimitiveBaseShape s = prim.Shape; 1463 PrimitiveBaseShape s = prim.Shape;
1468 cmd.Parameters.AddWithValue("UUID", Util.ToRawUuidString(prim.UUID)); 1464 cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString());
1469 // shape is an enum 1465 // shape is an enum
1470 cmd.Parameters.AddWithValue("Shape", 0); 1466 cmd.Parameters.AddWithValue("Shape", 0);
1471 // vectors 1467 // vectors
@@ -1533,8 +1529,9 @@ namespace OpenSim.Data.MySQL
1533 1529
1534 ExecuteNonQuery(cmd); 1530 ExecuteNonQuery(cmd);
1535 } 1531 }
1532
1536 cmd.Dispose(); 1533 cmd.Dispose();
1537 } 1534 }
1538 } 1535 }
1539 } 1536 }
1540} 1537} \ No newline at end of file
diff --git a/OpenSim/Data/MySQL/Resources/028_RegionStore.sql b/OpenSim/Data/MySQL/Resources/028_RegionStore.sql
new file mode 100644
index 0000000..078394f
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/028_RegionStore.sql
@@ -0,0 +1,79 @@
1BEGIN;
2
3update terrain
4 set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
5 where RegionUUID not like '%-%';
6
7
8update landaccesslist
9 set LandUUID = concat(substr(LandUUID, 1, 8), "-", substr(LandUUID, 9, 4), "-", substr(LandUUID, 13, 4), "-", substr(LandUUID, 17, 4), "-", substr(LandUUID, 21, 12))
10 where LandUUID not like '%-%';
11
12update landaccesslist
13 set AccessUUID = concat(substr(AccessUUID, 1, 8), "-", substr(AccessUUID, 9, 4), "-", substr(AccessUUID, 13, 4), "-", substr(AccessUUID, 17, 4), "-", substr(AccessUUID, 21, 12))
14 where AccessUUID not like '%-%';
15
16
17update prims
18 set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
19 where UUID not like '%-%';
20
21update prims
22 set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
23 where RegionUUID not like '%-%';
24
25update prims
26 set SceneGroupID = concat(substr(SceneGroupID, 1, 8), "-", substr(SceneGroupID, 9, 4), "-", substr(SceneGroupID, 13, 4), "-", substr(SceneGroupID, 17, 4), "-", substr(SceneGroupID, 21, 12))
27 where SceneGroupID not like '%-%';
28
29update prims
30 set CreatorID = concat(substr(CreatorID, 1, 8), "-", substr(CreatorID, 9, 4), "-", substr(CreatorID, 13, 4), "-", substr(CreatorID, 17, 4), "-", substr(CreatorID, 21, 12))
31 where CreatorID not like '%-%';
32
33update prims
34 set OwnerID = concat(substr(OwnerID, 1, 8), "-", substr(OwnerID, 9, 4), "-", substr(OwnerID, 13, 4), "-", substr(OwnerID, 17, 4), "-", substr(OwnerID, 21, 12))
35 where OwnerID not like '%-%';
36
37update prims
38 set GroupID = concat(substr(GroupID, 1, 8), "-", substr(GroupID, 9, 4), "-", substr(GroupID, 13, 4), "-", substr(GroupID, 17, 4), "-", substr(GroupID, 21, 12))
39 where GroupID not like '%-%';
40
41update prims
42 set LastOwnerID = concat(substr(LastOwnerID, 1, 8), "-", substr(LastOwnerID, 9, 4), "-", substr(LastOwnerID, 13, 4), "-", substr(LastOwnerID, 17, 4), "-", substr(LastOwnerID, 21, 12))
43 where LastOwnerID not like '%-%';
44
45
46update primshapes
47 set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
48 where UUID not like '%-%';
49
50
51update land
52 set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
53 where UUID not like '%-%';
54
55update land
56 set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
57 where RegionUUID not like '%-%';
58
59update land
60 set OwnerUUID = concat(substr(OwnerUUID, 1, 8), "-", substr(OwnerUUID, 9, 4), "-", substr(OwnerUUID, 13, 4), "-", substr(OwnerUUID, 17, 4), "-", substr(OwnerUUID, 21, 12))
61 where OwnerUUID not like '%-%';
62
63update land
64 set GroupUUID = concat(substr(GroupUUID, 1, 8), "-", substr(GroupUUID, 9, 4), "-", substr(GroupUUID, 13, 4), "-", substr(GroupUUID, 17, 4), "-", substr(GroupUUID, 21, 12))
65 where GroupUUID not like '%-%';
66
67update land
68 set MediaTextureUUID = concat(substr(MediaTextureUUID, 1, 8), "-", substr(MediaTextureUUID, 9, 4), "-", substr(MediaTextureUUID, 13, 4), "-", substr(MediaTextureUUID, 17, 4), "-", substr(MediaTextureUUID, 21, 12))
69 where MediaTextureUUID not like '%-%';
70
71update land
72 set SnapshotUUID = concat(substr(SnapshotUUID, 1, 8), "-", substr(SnapshotUUID, 9, 4), "-", substr(SnapshotUUID, 13, 4), "-", substr(SnapshotUUID, 17, 4), "-", substr(SnapshotUUID, 21, 12))
73 where SnapshotUUID not like '%-%';
74
75update land
76 set AuthbuyerID = concat(substr(AuthbuyerID, 1, 8), "-", substr(AuthbuyerID, 9, 4), "-", substr(AuthbuyerID, 13, 4), "-", substr(AuthbuyerID, 17, 4), "-", substr(AuthbuyerID, 21, 12))
77 where AuthbuyerID not like '%-%';
78
79COMMIT; \ No newline at end of file