From 1bd0b06ec1a0a5a7d6302d8017edcea7faf557e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Aug 2010 20:38:20 +0100 Subject: Implement Dynamic Attributes for SOP and PBS. Implement storage in SQLite --- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 29cac3c..b97653b 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1232,6 +1232,8 @@ namespace OpenSim.Data.SQLite createCol(prims, "VolumeDetect", typeof(Int16)); createCol(prims, "MediaURL", typeof(String)); + + createCol(prims, "DynAttrs", typeof(String)); // Add in contraints prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; @@ -1280,6 +1282,7 @@ namespace OpenSim.Data.SQLite createCol(shapes, "Texture", typeof(Byte[])); createCol(shapes, "ExtraParams", typeof(Byte[])); createCol(shapes, "Media", typeof(String)); + createCol(shapes, "DynAttrs", typeof(String)); shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; @@ -1711,6 +1714,16 @@ namespace OpenSim.Data.SQLite // m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); prim.MediaUrl = (string)row["MediaURL"]; } + + if (!(row["DynAttrs"] is System.DBNull)) + { + //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); + prim.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]); + } + else + { + prim.DynAttrs = new DynAttrsOSDMap(); + } return prim; } @@ -2133,6 +2146,7 @@ namespace OpenSim.Data.SQLite row["VolumeDetect"] = 0; row["MediaURL"] = prim.MediaUrl; + row["DynAttrs"] = prim.DynAttrs.ToXml(); } /// @@ -2393,6 +2407,11 @@ namespace OpenSim.Data.SQLite if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); + if (!(row["DynAttrs"] is System.DBNull)) + s.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]); + else + s.DynAttrs = new DynAttrsOSDMap(); + return s; } @@ -2439,6 +2458,8 @@ namespace OpenSim.Data.SQLite if (s.Media != null) row["Media"] = s.Media.ToXml(); + + row["DynAttrs"] = s.DynAttrs.ToXml(); } /// -- cgit v1.1 From a6d9c263650cc23d60f941718f87a64aa2f360b2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Aug 2010 22:21:46 +0100 Subject: Encapsulate an OSDMap in DAMap (was DynAttrsOSDMap) rather than inheriting from it This is the easier way to give us control over locking, rather than asking that OSDMap IDictionary methods be virtual --- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index b97653b..6875ed6 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1718,11 +1718,11 @@ namespace OpenSim.Data.SQLite if (!(row["DynAttrs"] is System.DBNull)) { //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); - prim.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]); + prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); } else { - prim.DynAttrs = new DynAttrsOSDMap(); + prim.DynAttrs = new DAMap(); } return prim; @@ -2408,9 +2408,9 @@ namespace OpenSim.Data.SQLite s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); if (!(row["DynAttrs"] is System.DBNull)) - s.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]); + s.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); else - s.DynAttrs = new DynAttrsOSDMap(); + s.DynAttrs = new DAMap(); return s; } -- cgit v1.1 From fdec05a15ef126f344c03427e9ef264b4248646b Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Jan 2013 08:49:36 +0200 Subject: Stopped storing dynamic attributes in the PrimShape --- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 6875ed6..fda7728 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1282,7 +1282,6 @@ namespace OpenSim.Data.SQLite createCol(shapes, "Texture", typeof(Byte[])); createCol(shapes, "ExtraParams", typeof(Byte[])); createCol(shapes, "Media", typeof(String)); - createCol(shapes, "DynAttrs", typeof(String)); shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; @@ -2406,11 +2405,6 @@ namespace OpenSim.Data.SQLite if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - - if (!(row["DynAttrs"] is System.DBNull)) - s.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); - else - s.DynAttrs = new DAMap(); return s; } @@ -2458,8 +2452,6 @@ namespace OpenSim.Data.SQLite if (s.Media != null) row["Media"] = s.Media.ToXml(); - - row["DynAttrs"] = s.DynAttrs.ToXml(); } /// -- cgit v1.1 From 86802bcf937e19ea99c2f9b7bc757b4e9daf3d16 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Jan 2013 08:55:15 +0200 Subject: Store NULL in the 'DynAttrs' column if the prim doesn't have any dynamic attributes --- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Data/SQLite/SQLiteSimulationData.cs') diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index fda7728..91fc704 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -2145,7 +2145,11 @@ namespace OpenSim.Data.SQLite row["VolumeDetect"] = 0; row["MediaURL"] = prim.MediaUrl; - row["DynAttrs"] = prim.DynAttrs.ToXml(); + + if (prim.DynAttrs.Count > 0) + row["DynAttrs"] = prim.DynAttrs.ToXml(); + else + row["DynAttrs"] = null; } /// -- cgit v1.1