aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs306
1 files changed, 233 insertions, 73 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index bb0ab75..81b5ec4 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -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
@@ -123,7 +123,7 @@ namespace OpenSim.Data.MySQL
123 123
124 public void Dispose() {} 124 public void Dispose() {}
125 125
126 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 126 public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
127 { 127 {
128 uint flags = obj.RootPart.GetEffectiveObjectFlags(); 128 uint flags = obj.RootPart.GetEffectiveObjectFlags();
129 129
@@ -183,10 +183,11 @@ namespace OpenSim.Data.MySQL
183 "ParticleSystem, ClickAction, Material, " + 183 "ParticleSystem, ClickAction, Material, " +
184 "CollisionSound, CollisionSoundVolume, " + 184 "CollisionSound, CollisionSoundVolume, " +
185 "PassTouches, " + 185 "PassTouches, " +
186 "LinkNumber, MediaURL, AttachedPosX, " + 186 "PassCollisions, " +
187 "AttachedPosY, AttachedPosZ, KeyframeMotion, " + 187 "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " +
188 "AttachedPosY, AttachedPosZ, " +
188 "PhysicsShapeType, Density, GravityModifier, " + 189 "PhysicsShapeType, Density, GravityModifier, " +
189 "Friction, Restitution, DynAttrs " + 190 "Friction, Restitution, Vehicle, DynAttrs " +
190 ") values (" + "?UUID, " + 191 ") values (" + "?UUID, " +
191 "?CreationDate, ?Name, ?Text, " + 192 "?CreationDate, ?Name, ?Text, " +
192 "?Description, ?SitName, ?TouchName, " + 193 "?Description, ?SitName, ?TouchName, " +
@@ -218,11 +219,11 @@ namespace OpenSim.Data.MySQL
218 "?SaleType, ?ColorR, ?ColorG, " + 219 "?SaleType, ?ColorR, ?ColorG, " +
219 "?ColorB, ?ColorA, ?ParticleSystem, " + 220 "?ColorB, ?ColorA, ?ParticleSystem, " +
220 "?ClickAction, ?Material, ?CollisionSound, " + 221 "?ClickAction, ?Material, ?CollisionSound, " +
221 "?CollisionSoundVolume, ?PassTouches, " + 222 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
222 "?LinkNumber, ?MediaURL, ?AttachedPosX, " + 223 "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " +
223 "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + 224 "?AttachedPosY, ?AttachedPosZ, " +
224 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 225 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
225 "?Friction, ?Restitution, ?DynAttrs)"; 226 "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)";
226 227
227 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 228 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
228 229
@@ -262,7 +263,7 @@ namespace OpenSim.Data.MySQL
262 } 263 }
263 } 264 }
264 265
265 public void RemoveObject(UUID obj, UUID regionUUID) 266 public virtual void RemoveObject(UUID obj, UUID regionUUID)
266 { 267 {
267// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); 268// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
268 269
@@ -317,7 +318,8 @@ namespace OpenSim.Data.MySQL
317 /// <param name="uuid">the Item UUID</param> 318 /// <param name="uuid">the Item UUID</param>
318 private void RemoveItems(UUID uuid) 319 private void RemoveItems(UUID uuid)
319 { 320 {
320 lock (m_dbLock) 321 // locked by caller
322// lock (m_dbLock)
321 { 323 {
322 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 324 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
323 { 325 {
@@ -411,7 +413,7 @@ namespace OpenSim.Data.MySQL
411 } 413 }
412 } 414 }
413 415
414 public List<SceneObjectGroup> LoadObjects(UUID regionID) 416 public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
415 { 417 {
416 const int ROWS_PER_QUERY = 5000; 418 const int ROWS_PER_QUERY = 5000;
417 419
@@ -590,40 +592,53 @@ namespace OpenSim.Data.MySQL
590 592
591 public void StoreTerrain(TerrainData terrData, UUID regionID) 593 public void StoreTerrain(TerrainData terrData, UUID regionID)
592 { 594 {
593 lock (m_dbLock) 595 Util.FireAndForget(delegate(object x)
594 { 596 {
595 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 597 m_log.Info("[REGION DB]: Storing terrain");
596 {
597 dbcon.Open();
598 598
599 using (MySqlCommand cmd = dbcon.CreateCommand()) 599 lock (m_dbLock)
600 {
601 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
600 { 602 {
601 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 603 dbcon.Open();
602 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
603
604 ExecuteNonQuery(cmd);
605 604
606 int terrainDBRevision; 605 using (MySqlCommand cmd = dbcon.CreateCommand())
607 Array terrainDBblob; 606 {
608 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); 607 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
608 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
609 609
610 m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", 610 using (MySqlCommand cmd2 = dbcon.CreateCommand())
611 LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); 611 {
612 try
613 {
614 cmd2.CommandText = "insert into terrain (RegionUUID, " +
615 "Revision, Heightfield) values (?RegionUUID, " +
616 "?Revision, ?Heightfield)";
612 617
613 cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" 618 int terrainDBRevision;
614 + "values (?RegionUUID, ?Revision, ?Heightfield)"; 619 Array terrainDBblob;
620 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
615 621
616 cmd.Parameters.AddWithValue("Revision", terrainDBRevision); 622 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
617 cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); 623 cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
624 cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
618 625
619 ExecuteNonQuery(cmd); 626 ExecuteNonQuery(cmd);
627 ExecuteNonQuery(cmd2);
628 }
629 catch (Exception e)
630 {
631 m_log.ErrorFormat(e.ToString());
632 }
633 }
634 }
620 } 635 }
621 } 636 }
622 } 637 });
623 } 638 }
624 639
625 // Legacy region loading 640 // Legacy region loading
626 public double[,] LoadTerrain(UUID regionID) 641 public virtual double[,] LoadTerrain(UUID regionID)
627 { 642 {
628 double[,] ret = null; 643 double[,] ret = null;
629 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); 644 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
@@ -655,8 +670,11 @@ namespace OpenSim.Data.MySQL
655 while (reader.Read()) 670 while (reader.Read())
656 { 671 {
657 int rev = Convert.ToInt32(reader["Revision"]); 672 int rev = Convert.ToInt32(reader["Revision"]);
658 byte[] blob = (byte[])reader["Heightfield"]; 673 if ((reader["Heightfield"] != DBNull.Value))
659 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); 674 {
675 byte[] blob = (byte[])reader["Heightfield"];
676 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
677 }
660 } 678 }
661 } 679 }
662 } 680 }
@@ -666,7 +684,7 @@ namespace OpenSim.Data.MySQL
666 return terrData; 684 return terrData;
667 } 685 }
668 686
669 public void RemoveLandObject(UUID globalID) 687 public virtual void RemoveLandObject(UUID globalID)
670 { 688 {
671 lock (m_dbLock) 689 lock (m_dbLock)
672 { 690 {
@@ -685,7 +703,7 @@ namespace OpenSim.Data.MySQL
685 } 703 }
686 } 704 }
687 705
688 public void StoreLandObject(ILandObject parcel) 706 public virtual void StoreLandObject(ILandObject parcel)
689 { 707 {
690 lock (m_dbLock) 708 lock (m_dbLock)
691 { 709 {
@@ -705,7 +723,8 @@ namespace OpenSim.Data.MySQL
705 "UserLocationX, UserLocationY, UserLocationZ, " + 723 "UserLocationX, UserLocationY, UserLocationZ, " +
706 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 724 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
707 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + 725 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
708 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 726 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
727 "SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
709 "?UUID, ?RegionUUID, " + 728 "?UUID, ?RegionUUID, " +
710 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 729 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
711 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + 730 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -716,7 +735,8 @@ namespace OpenSim.Data.MySQL
716 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 735 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
717 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 736 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
718 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ 737 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
719 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 738 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
739 "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
720 740
721 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 741 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
722 742
@@ -742,7 +762,7 @@ namespace OpenSim.Data.MySQL
742 } 762 }
743 } 763 }
744 764
745 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 765 public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
746 { 766 {
747 RegionLightShareData nWP = new RegionLightShareData(); 767 RegionLightShareData nWP = new RegionLightShareData();
748 nWP.OnSave += StoreRegionWindlightSettings; 768 nWP.OnSave += StoreRegionWindlightSettings;
@@ -840,7 +860,7 @@ namespace OpenSim.Data.MySQL
840 return nWP; 860 return nWP;
841 } 861 }
842 862
843 public RegionSettings LoadRegionSettings(UUID regionUUID) 863 public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
844 { 864 {
845 RegionSettings rs = null; 865 RegionSettings rs = null;
846 866
@@ -880,7 +900,7 @@ namespace OpenSim.Data.MySQL
880 return rs; 900 return rs;
881 } 901 }
882 902
883 public void StoreRegionWindlightSettings(RegionLightShareData wl) 903 public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
884 { 904 {
885 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 905 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
886 { 906 {
@@ -983,7 +1003,7 @@ namespace OpenSim.Data.MySQL
983 } 1003 }
984 } 1004 }
985 1005
986 public void RemoveRegionWindlightSettings(UUID regionID) 1006 public virtual void RemoveRegionWindlightSettings(UUID regionID)
987 { 1007 {
988 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1008 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
989 { 1009 {
@@ -1060,7 +1080,7 @@ namespace OpenSim.Data.MySQL
1060 } 1080 }
1061 #endregion 1081 #endregion
1062 1082
1063 public void StoreRegionSettings(RegionSettings rs) 1083 public virtual void StoreRegionSettings(RegionSettings rs)
1064 { 1084 {
1065 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1085 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1066 { 1086 {
@@ -1105,7 +1125,44 @@ namespace OpenSim.Data.MySQL
1105 "?TerrainImageID, " + 1125 "?TerrainImageID, " +
1106 "?TelehubObject, ?ParcelImageID)"; 1126 "?TelehubObject, ?ParcelImageID)";
1107 1127
1108 FillRegionSettingsCommand(cmd, rs); 1128 using (MySqlCommand cmd = dbcon.CreateCommand())
1129 {
1130 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1131 "block_terraform, block_fly, allow_damage, " +
1132 "restrict_pushing, allow_land_resell, " +
1133 "allow_land_join_divide, block_show_in_search, " +
1134 "agent_limit, object_bonus, maturity, " +
1135 "disable_scripts, disable_collisions, " +
1136 "disable_physics, terrain_texture_1, " +
1137 "terrain_texture_2, terrain_texture_3, " +
1138 "terrain_texture_4, elevation_1_nw, " +
1139 "elevation_2_nw, elevation_1_ne, " +
1140 "elevation_2_ne, elevation_1_se, " +
1141 "elevation_2_se, elevation_1_sw, " +
1142 "elevation_2_sw, water_height, " +
1143 "terrain_raise_limit, terrain_lower_limit, " +
1144 "use_estate_sun, fixed_sun, sun_position, " +
1145 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1146 "sunvectorz, loaded_creation_datetime, " +
1147 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1148 "TelehubObject, parcel_tile_ID) " +
1149 "values (?RegionUUID, ?BlockTerraform, " +
1150 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1151 "?AllowLandResell, ?AllowLandJoinDivide, " +
1152 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1153 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1154 "?DisablePhysics, ?TerrainTexture1, " +
1155 "?TerrainTexture2, ?TerrainTexture3, " +
1156 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1157 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1158 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1159 "?WaterHeight, ?TerrainRaiseLimit, " +
1160 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1161 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1162 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1163 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1164 "?TerrainImageID, ?block_search, ?casino, " +
1165 "?TelehubObject, ?ParcelImageID)";
1109 1166
1110 ExecuteNonQuery(cmd); 1167 ExecuteNonQuery(cmd);
1111 } 1168 }
@@ -1114,7 +1171,7 @@ namespace OpenSim.Data.MySQL
1114 SaveSpawnPoints(rs); 1171 SaveSpawnPoints(rs);
1115 } 1172 }
1116 1173
1117 public List<LandData> LoadLandObjects(UUID regionUUID) 1174 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
1118 { 1175 {
1119 List<LandData> landData = new List<LandData>(); 1176 List<LandData> landData = new List<LandData>();
1120 1177
@@ -1296,6 +1353,7 @@ namespace OpenSim.Data.MySQL
1296 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; 1353 prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"];
1297 1354
1298 prim.PassTouches = ((sbyte)row["PassTouches"] != 0); 1355 prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
1356 prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0);
1299 prim.LinkNum = (int)row["LinkNumber"]; 1357 prim.LinkNum = (int)row["LinkNumber"];
1300 1358
1301 if (!(row["MediaURL"] is System.DBNull)) 1359 if (!(row["MediaURL"] is System.DBNull))
@@ -1334,6 +1392,15 @@ namespace OpenSim.Data.MySQL
1334 prim.Friction = (float)(double)row["Friction"]; 1392 prim.Friction = (float)(double)row["Friction"];
1335 prim.Restitution = (float)(double)row["Restitution"]; 1393 prim.Restitution = (float)(double)row["Restitution"];
1336 1394
1395 SOPVehicle vehicle = null;
1396
1397 if (row["Vehicle"].ToString() != String.Empty)
1398 {
1399 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1400 if (vehicle != null)
1401 prim.VehicleParams = vehicle;
1402 }
1403
1337 return prim; 1404 return prim;
1338 } 1405 }
1339 1406
@@ -1344,32 +1411,40 @@ namespace OpenSim.Data.MySQL
1344 /// <returns></returns> 1411 /// <returns></returns>
1345 private static TaskInventoryItem BuildItem(IDataReader row) 1412 private static TaskInventoryItem BuildItem(IDataReader row)
1346 { 1413 {
1347 TaskInventoryItem taskItem = new TaskInventoryItem(); 1414 try
1348 1415 {
1349 taskItem.ItemID = DBGuid.FromDB(row["itemID"]); 1416 TaskInventoryItem taskItem = new TaskInventoryItem();
1350 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); 1417
1351 taskItem.AssetID = DBGuid.FromDB(row["assetID"]); 1418 taskItem.ItemID = DBGuid.FromDB(row["itemID"]);
1352 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); 1419 taskItem.ParentPartID = DBGuid.FromDB(row["primID"]);
1353 1420 taskItem.AssetID = DBGuid.FromDB(row["assetID"]);
1354 taskItem.InvType = Convert.ToInt32(row["invType"]); 1421 taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]);
1355 taskItem.Type = Convert.ToInt32(row["assetType"]); 1422
1356 1423 taskItem.InvType = Convert.ToInt32(row["invType"]);
1357 taskItem.Name = (String)row["name"]; 1424 taskItem.Type = Convert.ToInt32(row["assetType"]);
1358 taskItem.Description = (String)row["description"]; 1425
1359 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 1426 taskItem.Name = (String)row["name"];
1360 taskItem.CreatorIdentification = (String)row["creatorID"]; 1427 taskItem.Description = (String)row["description"];
1361 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); 1428 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
1362 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); 1429 taskItem.CreatorIdentification = (String)row["creatorID"];
1363 taskItem.GroupID = DBGuid.FromDB(row["groupID"]); 1430 taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]);
1364 1431 taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]);
1365 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); 1432 taskItem.GroupID = DBGuid.FromDB(row["groupID"]);
1366 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); 1433
1367 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); 1434 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
1368 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); 1435 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
1369 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); 1436 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
1370 taskItem.Flags = Convert.ToUInt32(row["flags"]); 1437 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
1371 1438 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
1372 return taskItem; 1439 taskItem.Flags = Convert.ToUInt32(row["flags"]);
1440
1441 return taskItem;
1442 }
1443 catch
1444 {
1445 m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString());
1446 throw;
1447 }
1373 } 1448 }
1374 1449
1375 private static RegionSettings BuildRegionSettings(IDataReader row) 1450 private static RegionSettings BuildRegionSettings(IDataReader row)
@@ -1427,6 +1502,9 @@ namespace OpenSim.Data.MySQL
1427 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); 1502 newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]);
1428 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); 1503 newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]);
1429 1504
1505 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
1506 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1507
1430 return newSettings; 1508 return newSettings;
1431 } 1509 }
1432 1510
@@ -1503,6 +1581,13 @@ namespace OpenSim.Data.MySQL
1503 1581
1504 newData.ParcelAccessList = new List<LandAccessEntry>(); 1582 newData.ParcelAccessList = new List<LandAccessEntry>();
1505 1583
1584 if (!(row["SeeAVs"] is System.DBNull))
1585 newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false;
1586 if (!(row["AnyAVSounds"] is System.DBNull))
1587 newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false;
1588 if (!(row["GroupAVSounds"] is System.DBNull))
1589 newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false;
1590
1506 return newData; 1591 return newData;
1507 } 1592 }
1508 1593
@@ -1521,6 +1606,34 @@ namespace OpenSim.Data.MySQL
1521 } 1606 }
1522 1607
1523 /// <summary> 1608 /// <summary>
1609 ///
1610 /// </summary>
1611 /// <param name="val"></param>
1612 /// <returns></returns>
1613 private static Array SerializeTerrain(double[,] val, double[,] oldTerrain)
1614 {
1615 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
1616 BinaryWriter bw = new BinaryWriter(str);
1617
1618 // TODO: COMPATIBILITY - Add byte-order conversions
1619 for (int x = 0; x < (int)Constants.RegionSize; x++)
1620 for (int y = 0; y < (int)Constants.RegionSize; y++)
1621 {
1622 double height = 20.0;
1623 if (oldTerrain != null)
1624 height = oldTerrain[x, y];
1625 if (!double.IsNaN(val[x, y]))
1626 height = val[x, y];
1627 if (height == 0.0)
1628 height = double.Epsilon;
1629
1630 bw.Write(height);
1631 }
1632
1633 return str.ToArray();
1634 }
1635
1636 /// <summary>
1524 /// Fill the prim command with prim values 1637 /// Fill the prim command with prim values
1525 /// </summary> 1638 /// </summary>
1526 /// <param name="row"></param> 1639 /// <param name="row"></param>
@@ -1654,6 +1767,11 @@ namespace OpenSim.Data.MySQL
1654 else 1767 else
1655 cmd.Parameters.AddWithValue("PassTouches", 0); 1768 cmd.Parameters.AddWithValue("PassTouches", 0);
1656 1769
1770 if (prim.PassCollisions)
1771 cmd.Parameters.AddWithValue("PassCollisions", 1);
1772 else
1773 cmd.Parameters.AddWithValue("PassCollisions", 0);
1774
1657 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1775 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1658 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1776 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1659 if (prim.AttachedPos != null) 1777 if (prim.AttachedPos != null)
@@ -1668,6 +1786,11 @@ namespace OpenSim.Data.MySQL
1668 else 1786 else
1669 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); 1787 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1670 1788
1789 if (prim.VehicleParams != null)
1790 cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2());
1791 else
1792 cmd.Parameters.AddWithValue("Vehicle", String.Empty);
1793
1671 if (prim.DynAttrs.CountNamespaces > 0) 1794 if (prim.DynAttrs.CountNamespaces > 0)
1672 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1795 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1673 else 1796 else
@@ -1756,6 +1879,8 @@ namespace OpenSim.Data.MySQL
1756 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1879 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1757 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1880 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1758 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1881 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1882 cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch);
1883 cmd.Parameters.AddWithValue("casino", settings.Casino);
1759 1884
1760 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1885 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1761 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1886 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
@@ -1813,6 +1938,10 @@ namespace OpenSim.Data.MySQL
1813 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); 1938 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
1814 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); 1939 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
1815 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); 1940 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
1941 cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0);
1942 cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0);
1943 cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0);
1944
1816 } 1945 }
1817 1946
1818 /// <summary> 1947 /// <summary>
@@ -1919,7 +2048,7 @@ namespace OpenSim.Data.MySQL
1919 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 2048 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1920 } 2049 }
1921 2050
1922 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 2051 public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1923 { 2052 {
1924 lock (m_dbLock) 2053 lock (m_dbLock)
1925 { 2054 {
@@ -1963,6 +2092,37 @@ namespace OpenSim.Data.MySQL
1963 } 2092 }
1964 } 2093 }
1965 2094
2095 public UUID[] GetObjectIDs(UUID regionID)
2096 {
2097 List<UUID> uuids = new List<UUID>();
2098
2099 lock (m_dbLock)
2100 {
2101 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2102 {
2103 dbcon.Open();
2104
2105 using (MySqlCommand cmd = dbcon.CreateCommand())
2106 {
2107 cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID";
2108 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
2109
2110 using (IDataReader reader = ExecuteReader(cmd))
2111 {
2112 while (reader.Read())
2113 {
2114 UUID id = new UUID(reader["UUID"].ToString());
2115
2116 uuids.Add(id);
2117 }
2118 }
2119 }
2120 }
2121 }
2122
2123 return uuids.ToArray();
2124 }
2125
1966 private void LoadSpawnPoints(RegionSettings rs) 2126 private void LoadSpawnPoints(RegionSettings rs)
1967 { 2127 {
1968 rs.ClearSpawnPoints(); 2128 rs.ClearSpawnPoints();