aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
authorUbitUmarov2016-09-17 15:45:11 +0100
committerUbitUmarov2016-09-17 15:45:11 +0100
commit3f9f10529548599d1810ca8a630734586ed3fa9d (patch)
treec889183859774ec4eb1032af2502ecf294b505cd /OpenSim/Data/SQLite
parent stop using legacy storeterrain in scene.cs (diff)
downloadopensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.zip
opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.gz
opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.bz2
opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.xz
add to databases a table to store baked terrain.
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations11
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs53
2 files changed, 53 insertions, 11 deletions
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 25f3ad9..64624db 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -352,3 +352,14 @@ BEGIN;
352ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0'; 352ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0';
353 353
354COMMIT; 354COMMIT;
355
356:VERSION 34 #---- add baked terrain store
357
358BEGIN;
359
360CREATE TABLE IF NOT EXISTS bakedterrain(
361 RegionUUID varchar(255),
362 Revision integer,
363 Heightfield blob);
364
365COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index cd20c4e..76b367a 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -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 {
@@ -1354,7 +1391,7 @@ namespace OpenSim.Data.SQLite
1354 createCol(land, "Name", typeof(String)); 1391 createCol(land, "Name", typeof(String));
1355 createCol(land, "Desc", typeof(String)); 1392 createCol(land, "Desc", typeof(String));
1356 createCol(land, "OwnerUUID", typeof(String)); 1393 createCol(land, "OwnerUUID", typeof(String));
1357 createCol(land, "IsGroupOwned", typeof(String)); 1394 createCol(land, "IsGroupOwned", typeof(Boolean));
1358 createCol(land, "Area", typeof(Int32)); 1395 createCol(land, "Area", typeof(Int32));
1359 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 1396 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
1360 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory 1397 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -1387,9 +1424,6 @@ namespace OpenSim.Data.SQLite
1387 createCol(land, "MediaLoop", typeof(Boolean)); 1424 createCol(land, "MediaLoop", typeof(Boolean));
1388 createCol(land, "ObscureMedia", typeof(Boolean)); 1425 createCol(land, "ObscureMedia", typeof(Boolean));
1389 createCol(land, "ObscureMusic", typeof(Boolean)); 1426 createCol(land, "ObscureMusic", typeof(Boolean));
1390 createCol(land, "SeeAVs", typeof(Boolean));
1391 createCol(land, "AnyAVSounds", typeof(Boolean));
1392 createCol(land, "GroupAVSounds", typeof(Boolean));
1393 1427
1394 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 1428 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
1395 1429
@@ -1832,7 +1866,7 @@ namespace OpenSim.Data.SQLite
1832 newData.Name = (String)row["Name"]; 1866 newData.Name = (String)row["Name"];
1833 newData.Description = (String)row["Desc"]; 1867 newData.Description = (String)row["Desc"];
1834 newData.OwnerID = (UUID)(String)row["OwnerUUID"]; 1868 newData.OwnerID = (UUID)(String)row["OwnerUUID"];
1835 newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); 1869 newData.IsGroupOwned = (Boolean)row["IsGroupOwned"];
1836 newData.Area = Convert.ToInt32(row["Area"]); 1870 newData.Area = Convert.ToInt32(row["Area"]);
1837 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 1871 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
1838 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); 1872 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
@@ -2248,7 +2282,7 @@ namespace OpenSim.Data.SQLite
2248 row["Name"] = land.Name; 2282 row["Name"] = land.Name;
2249 row["Desc"] = land.Description; 2283 row["Desc"] = land.Description;
2250 row["OwnerUUID"] = land.OwnerID.ToString(); 2284 row["OwnerUUID"] = land.OwnerID.ToString();
2251 row["IsGroupOwned"] = land.IsGroupOwned.ToString(); 2285 row["IsGroupOwned"] = land.IsGroupOwned;
2252 row["Area"] = land.Area; 2286 row["Area"] = land.Area;
2253 row["AuctionID"] = land.AuctionID; //Unemplemented 2287 row["AuctionID"] = land.AuctionID; //Unemplemented
2254 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory 2288 row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -2942,9 +2976,6 @@ namespace OpenSim.Data.SQLite
2942 { 2976 {
2943 return DbType.Binary; 2977 return DbType.Binary;
2944 } 2978 }
2945 else if (type == typeof(Boolean)) {
2946 return DbType.Boolean;
2947 }
2948 else 2979 else
2949 { 2980 {
2950 return DbType.String; 2981 return DbType.String;