diff options
author | Sean Dague | 2008-07-17 18:58:47 +0000 |
---|---|---|
committer | Sean Dague | 2008-07-17 18:58:47 +0000 |
commit | d5e0a3a184d52121a82e2f5f4c7f2acf5befe3e4 (patch) | |
tree | b33b723baa3964e891df873bc43cf22e914ea93b /OpenSim/Data/NHibernate | |
parent | early remove calls (diff) | |
download | opensim-SC-d5e0a3a184d52121a82e2f5f4c7f2acf5befe3e4.zip opensim-SC-d5e0a3a184d52121a82e2f5f4c7f2acf5befe3e4.tar.gz opensim-SC-d5e0a3a184d52121a82e2f5f4c7f2acf5befe3e4.tar.bz2 opensim-SC-d5e0a3a184d52121a82e2f5f4c7f2acf5befe3e4.tar.xz |
got basic region object saves working time for lunch
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateRegionData.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index 8ca0afe..3ba3556 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -112,6 +113,33 @@ namespace OpenSim.Data.NHibernate | |||
112 | { | 113 | { |
113 | return null; | 114 | return null; |
114 | } | 115 | } |
116 | |||
117 | private void SaveOrUpdate(SceneObjectPart p) | ||
118 | { | ||
119 | try | ||
120 | { | ||
121 | ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart)); | ||
122 | criteria.Add(Expression.Eq("UUID", p.UUID)); | ||
123 | if (criteria.List().Count < 1) | ||
124 | { | ||
125 | session.Save(p); | ||
126 | } | ||
127 | else if (criteria.List().Count == 1) | ||
128 | { | ||
129 | SceneObjectPart old = (SceneObjectPart)criteria.List()[0]; | ||
130 | session.Evict(old); | ||
131 | session.Update(p); | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | m_log.Error("Not unique"); | ||
136 | } | ||
137 | } | ||
138 | catch (Exception e) | ||
139 | { | ||
140 | m_log.Error("[NHIBERNATE] issue saving asset", e); | ||
141 | } | ||
142 | } | ||
115 | 143 | ||
116 | /// <summary> | 144 | /// <summary> |
117 | /// Adds an object into region storage | 145 | /// Adds an object into region storage |
@@ -125,7 +153,7 @@ namespace OpenSim.Data.NHibernate | |||
125 | foreach (SceneObjectPart part in obj.Children.Values) | 153 | foreach (SceneObjectPart part in obj.Children.Values) |
126 | { | 154 | { |
127 | m_log.InfoFormat("Storing part {0}", part.UUID); | 155 | m_log.InfoFormat("Storing part {0}", part.UUID); |
128 | session.SaveOrUpdate(part); | 156 | SaveOrUpdate(part); |
129 | } | 157 | } |
130 | session.Flush(); | 158 | session.Flush(); |
131 | } | 159 | } |