diff options
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index d28c227..9a47e37 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Data.SQLite | |||
51 | public class SQLiteSimulationData : ISimulationDataStore | 51 | public class SQLiteSimulationData : ISimulationDataStore |
52 | { | 52 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | private static readonly string LogHeader = "[REGION DB SQLLITE]"; | 54 | private static readonly string LogHeader = "[REGION DB SQLITE]"; |
55 | 55 | ||
56 | private const string primSelect = "select * from prims"; | 56 | private const string primSelect = "select * from prims"; |
57 | private const string shapeSelect = "select * from primshapes"; | 57 | private const string shapeSelect = "select * from primshapes"; |
@@ -835,28 +835,15 @@ namespace OpenSim.Data.SQLite | |||
835 | { | 835 | { |
836 | lock (ds) | 836 | lock (ds) |
837 | { | 837 | { |
838 | int revision = Util.UnixTimeSinceEpoch(); | ||
839 | |||
840 | // This is added to get rid of the infinitely growing | ||
841 | // terrain databases which negatively impact on SQLite | ||
842 | // over time. Before reenabling this feature there | ||
843 | // needs to be a limitter put on the number of | ||
844 | // revisions in the database, as this old | ||
845 | // implementation is a DOS attack waiting to happen. | ||
846 | |||
847 | using ( | 838 | using ( |
848 | SqliteCommand cmd = | 839 | SqliteCommand cmd = new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID", m_conn)) |
849 | new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", | ||
850 | m_conn)) | ||
851 | { | 840 | { |
852 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | 841 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); |
853 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | ||
854 | cmd.ExecuteNonQuery(); | 842 | cmd.ExecuteNonQuery(); |
855 | } | 843 | } |
856 | 844 | ||
857 | // the following is an work around for .NET. The perf | 845 | // the following is an work around for .NET. The perf |
858 | // issues associated with it aren't as bad as you think. | 846 | // issues associated with it aren't as bad as you think. |
859 | m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString()); | ||
860 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | 847 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + |
861 | " values(:RegionUUID, :Revision, :Heightfield)"; | 848 | " values(:RegionUUID, :Revision, :Heightfield)"; |
862 | 849 | ||
@@ -1618,7 +1605,7 @@ namespace OpenSim.Data.SQLite | |||
1618 | prim.SitName = (String)row["SitName"]; | 1605 | prim.SitName = (String)row["SitName"]; |
1619 | prim.TouchName = (String)row["TouchName"]; | 1606 | prim.TouchName = (String)row["TouchName"]; |
1620 | // permissions | 1607 | // permissions |
1621 | prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); | 1608 | prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]); |
1622 | prim.CreatorIdentification = (String)row["CreatorID"]; | 1609 | prim.CreatorIdentification = (String)row["CreatorID"]; |
1623 | prim.OwnerID = new UUID((String)row["OwnerID"]); | 1610 | prim.OwnerID = new UUID((String)row["OwnerID"]); |
1624 | prim.GroupID = new UUID((String)row["GroupID"]); | 1611 | prim.GroupID = new UUID((String)row["GroupID"]); |
@@ -2030,41 +2017,6 @@ namespace OpenSim.Data.SQLite | |||
2030 | /// <summary> | 2017 | /// <summary> |
2031 | /// | 2018 | /// |
2032 | /// </summary> | 2019 | /// </summary> |
2033 | /// <param name="val"></param> | ||
2034 | /// <returns></returns> | ||
2035 | private static Array serializeTerrain(double[,] val) | ||
2036 | { | ||
2037 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double)); | ||
2038 | BinaryWriter bw = new BinaryWriter(str); | ||
2039 | |||
2040 | // TODO: COMPATIBILITY - Add byte-order conversions | ||
2041 | for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
2042 | for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
2043 | bw.Write(val[x, y]); | ||
2044 | |||
2045 | return str.ToArray(); | ||
2046 | } | ||
2047 | */ | ||
2048 | |||
2049 | // private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) | ||
2050 | // { | ||
2051 | // row["RegionUUID"] = regionUUID; | ||
2052 | // row["Revision"] = rev; | ||
2053 | |||
2054 | // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); | ||
2055 | // BinaryWriter bw = new BinaryWriter(str); | ||
2056 | |||
2057 | // // TODO: COMPATIBILITY - Add byte-order conversions | ||
2058 | // for (int x = 0; x < (int)Constants.RegionSize; x++) | ||
2059 | // for (int y = 0; y < (int)Constants.RegionSize; y++) | ||
2060 | // bw.Write(val[x, y]); | ||
2061 | |||
2062 | // row["Heightfield"] = str.ToArray(); | ||
2063 | // } | ||
2064 | |||
2065 | /// <summary> | ||
2066 | /// | ||
2067 | /// </summary> | ||
2068 | /// <param name="row"></param> | 2020 | /// <param name="row"></param> |
2069 | /// <param name="prim"></param> | 2021 | /// <param name="prim"></param> |
2070 | /// <param name="sceneGroupID"></param> | 2022 | /// <param name="sceneGroupID"></param> |
@@ -2083,7 +2035,7 @@ namespace OpenSim.Data.SQLite | |||
2083 | row["SitName"] = prim.SitName; | 2035 | row["SitName"] = prim.SitName; |
2084 | row["TouchName"] = prim.TouchName; | 2036 | row["TouchName"] = prim.TouchName; |
2085 | // permissions | 2037 | // permissions |
2086 | row["ObjectFlags"] = prim.ObjectFlags; | 2038 | row["ObjectFlags"] = (uint)prim.Flags; |
2087 | row["CreatorID"] = prim.CreatorIdentification.ToString(); | 2039 | row["CreatorID"] = prim.CreatorIdentification.ToString(); |
2088 | row["OwnerID"] = prim.OwnerID.ToString(); | 2040 | row["OwnerID"] = prim.OwnerID.ToString(); |
2089 | row["GroupID"] = prim.GroupID.ToString(); | 2041 | row["GroupID"] = prim.GroupID.ToString(); |