aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations11
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs74
2 files changed, 81 insertions, 4 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..c1c7b7e 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 {
@@ -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)
@@ -1354,7 +1419,7 @@ namespace OpenSim.Data.SQLite
1354 createCol(land, "Name", typeof(String)); 1419 createCol(land, "Name", typeof(String));
1355 createCol(land, "Desc", typeof(String)); 1420 createCol(land, "Desc", typeof(String));
1356 createCol(land, "OwnerUUID", typeof(String)); 1421 createCol(land, "OwnerUUID", typeof(String));
1357 createCol(land, "IsGroupOwned", typeof(String)); 1422 createCol(land, "IsGroupOwned", typeof(string));
1358 createCol(land, "Area", typeof(Int32)); 1423 createCol(land, "Area", typeof(Int32));
1359 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 1424 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
1360 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory 1425 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
@@ -2942,7 +3007,8 @@ namespace OpenSim.Data.SQLite
2942 { 3007 {
2943 return DbType.Binary; 3008 return DbType.Binary;
2944 } 3009 }
2945 else if (type == typeof(Boolean)) { 3010 else if (type == typeof(Boolean))
3011 {
2946 return DbType.Boolean; 3012 return DbType.Boolean;
2947 } 3013 }
2948 else 3014 else