aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteSimulationData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs158
1 files changed, 140 insertions, 18 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 6ed3d40..19880de 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -707,7 +707,7 @@ namespace OpenSim.Data.SQLite
707 DataRow[] primsForRegion = prims.Select(byRegion); 707 DataRow[] primsForRegion = prims.Select(byRegion);
708// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 708// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
709 709
710 // First, create all groups 710 // First, create all groups
711 foreach (DataRow primRow in primsForRegion) 711 foreach (DataRow primRow in primsForRegion)
712 { 712 {
713 try 713 try
@@ -733,12 +733,12 @@ namespace OpenSim.Data.SQLite
733 } 733 }
734 734
735 SceneObjectGroup group = new SceneObjectGroup(prim); 735 SceneObjectGroup group = new SceneObjectGroup(prim);
736 736
737 createdObjects.Add(group.UUID, group); 737 createdObjects.Add(group.UUID, group);
738 retvals.Add(group); 738 retvals.Add(group);
739 LoadItems(prim); 739 LoadItems(prim);
740 740
741 741
742 } 742 }
743 } 743 }
744 catch (Exception e) 744 catch (Exception e)
@@ -827,7 +827,7 @@ namespace OpenSim.Data.SQLite
827 } 827 }
828 828
829 /// <summary> 829 /// <summary>
830 /// Store a terrain revision in region storage 830 /// Store a terrain in region storage
831 /// </summary> 831 /// </summary>
832 /// <param name="ter">terrain heightfield</param> 832 /// <param name="ter">terrain heightfield</param>
833 /// <param name="regionID">region UUID</param> 833 /// <param name="regionID">region UUID</param>
@@ -851,7 +851,44 @@ namespace OpenSim.Data.SQLite
851 Array terrainDBblob; 851 Array terrainDBblob;
852 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); 852 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
853 853
854 m_log.DebugFormat("{0} Storing terrain revision r {1}", LogHeader, terrainDBRevision); 854 m_log.DebugFormat("{0} Storing terrain format {1}", LogHeader, terrainDBRevision);
855
856 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
857 {
858 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
859 cmd.Parameters.Add(new SqliteParameter(":Revision", terrainDBRevision));
860 cmd.Parameters.Add(new SqliteParameter(":Heightfield", terrainDBblob));
861 cmd.ExecuteNonQuery();
862 }
863 }
864 }
865
866 /// <summary>
867 /// Store baked terrain in region storage
868 /// </summary>
869 /// <param name="ter">terrain heightfield</param>
870 /// <param name="regionID">region UUID</param>
871 public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
872 {
873 lock (ds)
874 {
875 using (
876 SqliteCommand cmd = new SqliteCommand("delete from bakedterrain where RegionUUID=:RegionUUID", m_conn))
877 {
878 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
879 cmd.ExecuteNonQuery();
880 }
881
882 // the following is an work around for .NET. The perf
883 // issues associated with it aren't as bad as you think.
884 String sql = "insert into bakedterrain(RegionUUID, Revision, Heightfield)" +
885 " values(:RegionUUID, :Revision, :Heightfield)";
886
887 int terrainDBRevision;
888 Array terrainDBblob;
889 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
890
891 m_log.DebugFormat("{0} Storing bakedterrain format {1}", LogHeader, terrainDBRevision);
855 892
856 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) 893 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
857 { 894 {
@@ -913,6 +950,34 @@ namespace OpenSim.Data.SQLite
913 return terrData; 950 return terrData;
914 } 951 }
915 952
953 public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
954 {
955 TerrainData terrData = null;
956
957 lock (ds)
958 {
959 String sql = "select RegionUUID, Revision, Heightfield from bakedterrain" +
960 " where RegionUUID=:RegionUUID";
961
962 using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
963 {
964 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
965
966 using (IDataReader row = cmd.ExecuteReader())
967 {
968 int rev = 0;
969 if (row.Read())
970 {
971 rev = Convert.ToInt32(row["Revision"]);
972 byte[] blob = (byte[])row["Heightfield"];
973 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
974 }
975 }
976 }
977 }
978 return terrData;
979 }
980
916 public void RemoveLandObject(UUID globalID) 981 public void RemoveLandObject(UUID globalID)
917 { 982 {
918 lock (ds) 983 lock (ds)
@@ -1151,6 +1216,7 @@ namespace OpenSim.Data.SQLite
1151 createCol(prims, "OwnerID", typeof(String)); 1216 createCol(prims, "OwnerID", typeof(String));
1152 createCol(prims, "GroupID", typeof(String)); 1217 createCol(prims, "GroupID", typeof(String));
1153 createCol(prims, "LastOwnerID", typeof(String)); 1218 createCol(prims, "LastOwnerID", typeof(String));
1219 createCol(prims, "RezzerID", typeof(String));
1154 createCol(prims, "OwnerMask", typeof(Int32)); 1220 createCol(prims, "OwnerMask", typeof(Int32));
1155 createCol(prims, "NextOwnerMask", typeof(Int32)); 1221 createCol(prims, "NextOwnerMask", typeof(Int32));
1156 createCol(prims, "GroupMask", typeof(Int32)); 1222 createCol(prims, "GroupMask", typeof(Int32));
@@ -1232,7 +1298,7 @@ namespace OpenSim.Data.SQLite
1232 createCol(prims, "VolumeDetect", typeof(Int16)); 1298 createCol(prims, "VolumeDetect", typeof(Int16));
1233 1299
1234 createCol(prims, "MediaURL", typeof(String)); 1300 createCol(prims, "MediaURL", typeof(String));
1235 1301
1236 createCol(prims, "AttachedPosX", typeof(Double)); 1302 createCol(prims, "AttachedPosX", typeof(Double));
1237 createCol(prims, "AttachedPosY", typeof(Double)); 1303 createCol(prims, "AttachedPosY", typeof(Double));
1238 createCol(prims, "AttachedPosZ", typeof(Double)); 1304 createCol(prims, "AttachedPosZ", typeof(Double));
@@ -1246,6 +1312,7 @@ namespace OpenSim.Data.SQLite
1246 createCol(prims, "Restitution", typeof(Double)); 1312 createCol(prims, "Restitution", typeof(Double));
1247 1313
1248 createCol(prims, "KeyframeMotion", typeof(Byte[])); 1314 createCol(prims, "KeyframeMotion", typeof(Byte[]));
1315
1249 // Add in contraints 1316 // Add in contraints
1250 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 1317 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
1251 1318
@@ -1353,7 +1420,7 @@ namespace OpenSim.Data.SQLite
1353 createCol(land, "Name", typeof(String)); 1420 createCol(land, "Name", typeof(String));
1354 createCol(land, "Desc", typeof(String)); 1421 createCol(land, "Desc", typeof(String));
1355 createCol(land, "OwnerUUID", typeof(String)); 1422 createCol(land, "OwnerUUID", typeof(String));
1356 createCol(land, "IsGroupOwned", typeof(Boolean)); 1423 createCol(land, "IsGroupOwned", typeof(string));
1357 createCol(land, "Area", typeof(Int32)); 1424 createCol(land, "Area", typeof(Int32));
1358 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 1425 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
1359 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory 1426 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -1386,6 +1453,9 @@ namespace OpenSim.Data.SQLite
1386 createCol(land, "MediaLoop", typeof(Boolean)); 1453 createCol(land, "MediaLoop", typeof(Boolean));
1387 createCol(land, "ObscureMedia", typeof(Boolean)); 1454 createCol(land, "ObscureMedia", typeof(Boolean));
1388 createCol(land, "ObscureMusic", typeof(Boolean)); 1455 createCol(land, "ObscureMusic", typeof(Boolean));
1456 createCol(land, "SeeAVs", typeof(Boolean));
1457 createCol(land, "AnyAVSounds", typeof(Boolean));
1458 createCol(land, "GroupAVSounds", typeof(Boolean));
1389 1459
1390 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 1460 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
1391 1461
@@ -1610,6 +1680,7 @@ namespace OpenSim.Data.SQLite
1610 prim.OwnerID = new UUID((String)row["OwnerID"]); 1680 prim.OwnerID = new UUID((String)row["OwnerID"]);
1611 prim.GroupID = new UUID((String)row["GroupID"]); 1681 prim.GroupID = new UUID((String)row["GroupID"]);
1612 prim.LastOwnerID = new UUID((String)row["LastOwnerID"]); 1682 prim.LastOwnerID = new UUID((String)row["LastOwnerID"]);
1683 prim.RezzerID = row["RezzerID"] == DBNull.Value ? UUID.Zero : new UUID((String)row["RezzerID"]);
1613 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 1684 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
1614 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 1685 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
1615 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 1686 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -1724,7 +1795,7 @@ namespace OpenSim.Data.SQLite
1724// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1795// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
1725 prim.MediaUrl = (string)row["MediaURL"]; 1796 prim.MediaUrl = (string)row["MediaURL"];
1726 } 1797 }
1727 1798
1728 prim.AttachedPos = new Vector3( 1799 prim.AttachedPos = new Vector3(
1729 Convert.ToSingle(row["AttachedPosX"]), 1800 Convert.ToSingle(row["AttachedPosX"]),
1730 Convert.ToSingle(row["AttachedPosY"]), 1801 Convert.ToSingle(row["AttachedPosY"]),
@@ -1735,7 +1806,7 @@ namespace OpenSim.Data.SQLite
1735 { 1806 {
1736 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); 1807 //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType());
1737 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); 1808 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
1738 } 1809 }
1739 else 1810 else
1740 { 1811 {
1741 prim.DynAttrs = new DAMap(); 1812 prim.DynAttrs = new DAMap();
@@ -1747,7 +1818,7 @@ namespace OpenSim.Data.SQLite
1747 prim.Friction = Convert.ToSingle(row["Friction"]); 1818 prim.Friction = Convert.ToSingle(row["Friction"]);
1748 prim.Restitution = Convert.ToSingle(row["Restitution"]); 1819 prim.Restitution = Convert.ToSingle(row["Restitution"]);
1749 1820
1750 1821
1751 if (!(row["KeyframeMotion"] is DBNull)) 1822 if (!(row["KeyframeMotion"] is DBNull))
1752 { 1823 {
1753 Byte[] data = (byte[])row["KeyframeMotion"]; 1824 Byte[] data = (byte[])row["KeyframeMotion"];
@@ -1760,7 +1831,24 @@ namespace OpenSim.Data.SQLite
1760 { 1831 {
1761 prim.KeyframeMotion = null; 1832 prim.KeyframeMotion = null;
1762 } 1833 }
1763 1834
1835 prim.PassCollisions = Convert.ToBoolean(row["PassCollisions"]);
1836 prim.PassTouches = Convert.ToBoolean(row["PassTouches"]);
1837 prim.RotationAxisLocks = Convert.ToByte(row["RotationAxisLocks"]);
1838
1839 SOPVehicle vehicle = null;
1840 if (!(row["Vehicle"] is DBNull) && row["Vehicle"].ToString() != String.Empty)
1841 {
1842 vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString());
1843 if (vehicle != null)
1844 prim.VehicleParams = vehicle;
1845 }
1846
1847 PhysicsInertiaData pdata = null;
1848 if (!(row["PhysInertia"] is DBNull) && row["PhysInertia"].ToString() != String.Empty)
1849 pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
1850 prim.PhysicsInertia = pdata;
1851
1764 return prim; 1852 return prim;
1765 } 1853 }
1766 1854
@@ -1817,7 +1905,7 @@ namespace OpenSim.Data.SQLite
1817 newData.Name = (String)row["Name"]; 1905 newData.Name = (String)row["Name"];
1818 newData.Description = (String)row["Desc"]; 1906 newData.Description = (String)row["Desc"];
1819 newData.OwnerID = (UUID)(String)row["OwnerUUID"]; 1907 newData.OwnerID = (UUID)(String)row["OwnerUUID"];
1820 newData.IsGroupOwned = (Boolean)row["IsGroupOwned"]; 1908 newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
1821 newData.Area = Convert.ToInt32(row["Area"]); 1909 newData.Area = Convert.ToInt32(row["Area"]);
1822 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 1910 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
1823 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); 1911 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
@@ -1845,6 +1933,10 @@ namespace OpenSim.Data.SQLite
1845 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); 1933 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1846 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); 1934 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1847 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); 1935 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1936 newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
1937 newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
1938 newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
1939
1848 try 1940 try
1849 { 1941 {
1850 newData.UserLocation = 1942 newData.UserLocation =
@@ -1918,7 +2010,8 @@ namespace OpenSim.Data.SQLite
1918 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); 2010 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
1919 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); 2011 newSettings.TelehubObject = new UUID((String)row["TelehubObject"]);
1920 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]); 2012 newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
1921 2013 newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
2014 newSettings.Casino = Convert.ToBoolean(row["casino"]);
1922 return newSettings; 2015 return newSettings;
1923 } 2016 }
1924 2017
@@ -2013,6 +2106,7 @@ namespace OpenSim.Data.SQLite
2013 return entry; 2106 return entry;
2014 } 2107 }
2015 2108
2109
2016 /// <summary> 2110 /// <summary>
2017 /// 2111 ///
2018 /// </summary> 2112 /// </summary>
@@ -2039,6 +2133,7 @@ namespace OpenSim.Data.SQLite
2039 row["OwnerID"] = prim.OwnerID.ToString(); 2133 row["OwnerID"] = prim.OwnerID.ToString();
2040 row["GroupID"] = prim.GroupID.ToString(); 2134 row["GroupID"] = prim.GroupID.ToString();
2041 row["LastOwnerID"] = prim.LastOwnerID.ToString(); 2135 row["LastOwnerID"] = prim.LastOwnerID.ToString();
2136 row["RezzerID"] = prim.RezzerID.ToString();
2042 row["OwnerMask"] = prim.OwnerMask; 2137 row["OwnerMask"] = prim.OwnerMask;
2043 row["NextOwnerMask"] = prim.NextOwnerMask; 2138 row["NextOwnerMask"] = prim.NextOwnerMask;
2044 row["GroupMask"] = prim.GroupMask; 2139 row["GroupMask"] = prim.GroupMask;
@@ -2137,7 +2232,6 @@ namespace OpenSim.Data.SQLite
2137 // click action 2232 // click action
2138 row["ClickAction"] = prim.ClickAction; 2233 row["ClickAction"] = prim.ClickAction;
2139 2234
2140 row["SalePrice"] = prim.SalePrice;
2141 row["Material"] = prim.Material; 2235 row["Material"] = prim.Material;
2142 2236
2143 row["CollisionSound"] = prim.CollisionSound.ToString(); 2237 row["CollisionSound"] = prim.CollisionSound.ToString();
@@ -2168,8 +2262,21 @@ namespace OpenSim.Data.SQLite
2168 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize(); 2262 row["KeyframeMotion"] = prim.KeyframeMotion.Serialize();
2169 else 2263 else
2170 row["KeyframeMotion"] = new Byte[0]; 2264 row["KeyframeMotion"] = new Byte[0];
2171 2265
2172 2266 row["PassTouches"] = prim.PassTouches;
2267 row["PassCollisions"] = prim.PassCollisions;
2268 row["RotationAxisLocks"] = prim.RotationAxisLocks;
2269
2270 if (prim.VehicleParams != null)
2271 row["Vehicle"] = prim.VehicleParams.ToXml2();
2272 else
2273 row["Vehicle"] = String.Empty;
2274
2275 if (prim.PhysicsInertia != null)
2276 row["PhysInertia"] = prim.PhysicsInertia.ToXml2();
2277 else
2278 row["PhysInertia"] = String.Empty;
2279
2173 } 2280 }
2174 2281
2175 /// <summary> 2282 /// <summary>
@@ -2220,7 +2327,7 @@ namespace OpenSim.Data.SQLite
2220 row["Name"] = land.Name; 2327 row["Name"] = land.Name;
2221 row["Desc"] = land.Description; 2328 row["Desc"] = land.Description;
2222 row["OwnerUUID"] = land.OwnerID.ToString(); 2329 row["OwnerUUID"] = land.OwnerID.ToString();
2223 row["IsGroupOwned"] = land.IsGroupOwned; 2330 row["IsGroupOwned"] = land.IsGroupOwned.ToString();
2224 row["Area"] = land.Area; 2331 row["Area"] = land.Area;
2225 row["AuctionID"] = land.AuctionID; //Unemplemented 2332 row["AuctionID"] = land.AuctionID; //Unemplemented
2226 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory 2333 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -2253,6 +2360,10 @@ namespace OpenSim.Data.SQLite
2253 row["MediaLoop"] = land.MediaLoop; 2360 row["MediaLoop"] = land.MediaLoop;
2254 row["ObscureMusic"] = land.ObscureMusic; 2361 row["ObscureMusic"] = land.ObscureMusic;
2255 row["ObscureMedia"] = land.ObscureMedia; 2362 row["ObscureMedia"] = land.ObscureMedia;
2363 row["SeeAVs"] = land.SeeAVs;
2364 row["AnyAVSounds"] = land.AnyAVSounds;
2365 row["GroupAVSounds"] = land.GroupAVSounds;
2366
2256 } 2367 }
2257 2368
2258 /// <summary> 2369 /// <summary>
@@ -2311,6 +2422,8 @@ namespace OpenSim.Data.SQLite
2311 row["map_tile_ID"] = settings.TerrainImageID.ToString(); 2422 row["map_tile_ID"] = settings.TerrainImageID.ToString();
2312 row["TelehubObject"] = settings.TelehubObject.ToString(); 2423 row["TelehubObject"] = settings.TelehubObject.ToString();
2313 row["parcel_tile_ID"] = settings.ParcelImageID.ToString(); 2424 row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
2425 row["block_search"] = settings.GodBlockSearch;
2426 row["casino"] = settings.Casino;
2314 } 2427 }
2315 2428
2316 /// <summary> 2429 /// <summary>
@@ -2430,7 +2543,7 @@ namespace OpenSim.Data.SQLite
2430 2543
2431 if (!(row["Media"] is System.DBNull)) 2544 if (!(row["Media"] is System.DBNull))
2432 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 2545 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
2433 2546
2434 return s; 2547 return s;
2435 } 2548 }
2436 2549
@@ -2908,6 +3021,10 @@ namespace OpenSim.Data.SQLite
2908 { 3021 {
2909 return DbType.Binary; 3022 return DbType.Binary;
2910 } 3023 }
3024 else if (type == typeof(Boolean))
3025 {
3026 return DbType.Boolean;
3027 }
2911 else 3028 else
2912 { 3029 {
2913 return DbType.String; 3030 return DbType.String;
@@ -2944,6 +3061,11 @@ namespace OpenSim.Data.SQLite
2944 } 3061 }
2945 } 3062 }
2946 3063
3064 public UUID[] GetObjectIDs(UUID regionID)
3065 {
3066 return new UUID[0];
3067 }
3068
2947 public void SaveExtra(UUID regionID, string name, string value) 3069 public void SaveExtra(UUID regionID, string name, string value)
2948 { 3070 {
2949 } 3071 }