diff options
author | Sean Dague | 2008-07-17 18:59:10 +0000 |
---|---|---|
committer | Sean Dague | 2008-07-17 18:59:10 +0000 |
commit | 6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7 (patch) | |
tree | 048f753c7be960551f49c3f489b66b20371951b6 /OpenSim/Data/NHibernate/NHibernateRegionData.cs | |
parent | git merge (diff) | |
download | opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.zip opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.gz opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.bz2 opensim-SC_OLD-6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7.tar.xz |
Revert "git merge"
This reverts commit 80e1c3742a3ba7eb9aa1686a242b36f64331095a.
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateRegionData.cs')
-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 | } |