aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorSean Dague2008-07-17 18:53:38 +0000
committerSean Dague2008-07-17 18:53:38 +0000
commit9aa0302e5b05f056a9378c3b0fd02c4b021ca9e2 (patch)
tree03aca0f0087568ae975e5c51f3481d3e3fec526d /OpenSim/Data/NHibernate
parentrearranging variables in OSHttpRequest and adding Query property. (diff)
downloadopensim-SC-9aa0302e5b05f056a9378c3b0fd02c4b021ca9e2.zip
opensim-SC-9aa0302e5b05f056a9378c3b0fd02c4b021ca9e2.tar.gz
opensim-SC-9aa0302e5b05f056a9378c3b0fd02c4b021ca9e2.tar.bz2
opensim-SC-9aa0302e5b05f056a9378c3b0fd02c4b021ca9e2.tar.xz
early remove calls
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs45
1 files changed, 38 insertions, 7 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 1f997e7..8ca0afe 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -120,21 +120,45 @@ namespace OpenSim.Data.NHibernate
120 /// <param name="regionUUID">the region UUID</param> 120 /// <param name="regionUUID">the region UUID</param>
121 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 121 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
122 { 122 {
123 foreach (SceneObjectPart part in obj.Children.Values) 123 try
124 { 124 {
125 try 125 foreach (SceneObjectPart part in obj.Children.Values)
126 { 126 {
127 m_log.InfoFormat("Storing part {0}", part.UUID); 127 m_log.InfoFormat("Storing part {0}", part.UUID);
128 session.SaveOrUpdate(part); 128 session.SaveOrUpdate(part);
129 session.Flush();
130 }
131 catch (Exception e)
132 {
133 m_log.Error("Can't save: ", e);
134 } 129 }
130 session.Flush();
131 }
132 catch (Exception e)
133 {
134 m_log.Error("Can't save: ", e);
135 }
136 }
137
138 private SceneObjectGroup LoadObject(LLUUID uuid, LLUUID region)
139 {
140 SceneObjectGroup group = new SceneObjectGroup();
135 141
142 ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
143 criteria.Add(Expression.Eq("RegionID", region));
144 criteria.Add(Expression.Eq("ParentUUID", uuid));
145 criteria.AddOrder( Order.Asc("ParentID") );
146
147 foreach (SceneObjectPart p in criteria.List())
148 {
149 // root part
150 if (p.UUID == uuid)
151 {
152 group.AddPart(p);
153 group.RootPart = p;
154 }
155 else
156 {
157 group.AddPart(p);
158 }
136 } 159 }
137 160
161 return group;
138 } 162 }
139 163
140 /// <summary> 164 /// <summary>
@@ -144,6 +168,13 @@ namespace OpenSim.Data.NHibernate
144 /// <param name="regionUUID">the region UUID</param> 168 /// <param name="regionUUID">the region UUID</param>
145 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 169 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
146 { 170 {
171 SceneObjectGroup g = LoadObject(obj, regionUUID);
172 foreach (SceneObjectPart p in g.Children.Values)
173 {
174 session.Delete(p);
175 }
176 session.Flush();
177
147 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); 178 m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
148 179
149 } 180 }