aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorSean Dague2008-07-17 18:59:10 +0000
committerSean Dague2008-07-17 18:59:10 +0000
commit6084a7ea3eb8fff88d57ca911b9b922a2f09ccf7 (patch)
tree048f753c7be960551f49c3f489b66b20371951b6 /OpenSim/Data/NHibernate
parentgit merge (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs30
-rw-r--r--OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml21
-rw-r--r--OpenSim/Data/NHibernate/TextureUserType.cs12
3 files changed, 59 insertions, 4 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
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Reflection; 32using 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 }
diff --git a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
index 5b8b7f2..40d3864 100644
--- a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
@@ -82,7 +82,26 @@
82 <column name="ScaleY" /> 82 <column name="ScaleY" />
83 <column name="ScaleZ" /> 83 <column name="ScaleZ" />
84 </property> 84 </property>
85 85 <property name="PCode" type="System.Byte" />
86 <property name="PathBegin" type="System.UInt16" />
87 <property name="PathEnd" type="System.UInt16" />
88 <property name="PathScaleX" type="System.Byte" />
89 <property name="PathScaleY" type="System.Byte" />
90 <property name="PathShearX" type="System.Byte" />
91 <property name="PathShearY" type="System.Byte" />
92 <property name="PathSkew" type="System.SByte" />
93 <property name="PathCurve" type="System.Byte" />
94 <property name="PathRadiusOffset" type="System.SByte" />
95 <property name="PathRevolutions" type="System.Byte" />
96 <property name="PathTaperX" type="System.SByte" />
97 <property name="PathTwist" type="System.SByte" />
98 <property name="ProfileBegin" type="System.UInt16" />
99 <property name="ProfileEnd" type="System.UInt16" />
100 <property name="ProfileCurve" type="System.Byte" />
101 <property name="ProfileHollow" type="System.UInt16" />
102 <property name="TextureEntry" column="Texture" type="System.Byte[]" />
103 <property name="ExtraParams" type="System.Byte[]" />
104 <property name="State" type="System.Byte" />
86 </component> 105 </component>
87 106
88 </class> 107 </class>
diff --git a/OpenSim/Data/NHibernate/TextureUserType.cs b/OpenSim/Data/NHibernate/TextureUserType.cs
index dac7c75..b688a16 100644
--- a/OpenSim/Data/NHibernate/TextureUserType.cs
+++ b/OpenSim/Data/NHibernate/TextureUserType.cs
@@ -49,8 +49,16 @@ namespace OpenSim.Data.NHibernate
49 49
50 public object DeepCopy(object texture) 50 public object DeepCopy(object texture)
51 { 51 {
52 byte[] bytes = ((LLObject.TextureEntry)texture).ToBytes(); 52 if (texture == null)
53 return new LLObject.TextureEntry(bytes, 0, bytes.Length); 53 {
54 // TODO: should parametrize this texture out
55 return new LLObject.TextureEntry(new LLUUID("89556747-24cb-43ed-920b-47caed15465f"));
56 }
57 else
58 {
59 byte[] bytes = ((LLObject.TextureEntry)texture).ToBytes();
60 return new LLObject.TextureEntry(bytes, 0, bytes.Length);
61 }
54 } 62 }
55 63
56 public object Disassemble(object texture) 64 public object Disassemble(object texture)