aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorSean Dague2008-04-09 16:01:57 +0000
committerSean Dague2008-04-09 16:01:57 +0000
commit4cc3aad2f9182188b2536c0345f8ae4a4b70f810 (patch)
tree618e8c7ba056f4fb34a5c3b001b7cc050d1ff845 /OpenSim/Data/NHibernate
parent* Put explicit braces in for single line blocks (diff)
downloadopensim-SC-4cc3aad2f9182188b2536c0345f8ae4a4b70f810.zip
opensim-SC-4cc3aad2f9182188b2536c0345f8ae4a4b70f810.tar.gz
opensim-SC-4cc3aad2f9182188b2536c0345f8ae4a4b70f810.tar.bz2
opensim-SC-4cc3aad2f9182188b2536c0345f8ae4a4b70f810.tar.xz
more futzing around here. None of this works yet because
bloody LLUUID isn't serializable, which is really annoying.
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs15
-rw-r--r--OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs2
2 files changed, 9 insertions, 8 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 8043348..f99273a 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using libsecondlife; 32using libsecondlife;
33using NHibernate; 33using NHibernate;
34using NHibernate.Expression;
34using NHibernate.Cfg; 35using NHibernate.Cfg;
35using NHibernate.Tool.hbm2ddl; 36using NHibernate.Tool.hbm2ddl;
36using NHibernate.Mapping.Attributes; 37using NHibernate.Mapping.Attributes;
@@ -298,10 +299,10 @@ namespace OpenSim.Data.NHibernate
298 { 299 {
299 using(ISession session = factory.OpenSession()) { 300 using(ISession session = factory.OpenSession()) {
300 try { 301 try {
301 IQuery query = session.CreateQuery("from InventoryItems i where i.Folder = :folder"); 302 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
302 query.SetString("folder", folderID.ToString()); 303 criteria.Add(Expression.Eq("Folder", folderID) );
303 List<InventoryItemBase> list = new List<InventoryItemBase>(); 304 List<InventoryItemBase> list = new List<InventoryItemBase>();
304 foreach (InventoryItemBase item in query.List()) 305 foreach (InventoryItemBase item in criteria.List())
305 { 306 {
306 list.Add(item); 307 list.Add(item);
307 } 308 }
@@ -322,10 +323,10 @@ namespace OpenSim.Data.NHibernate
322 { 323 {
323 using(ISession session = factory.OpenSession()) { 324 using(ISession session = factory.OpenSession()) {
324 try { 325 try {
325 IQuery query = session.CreateQuery("from InventoryFolders i where i.ParentID = :parent and i.Owner = :owner"); 326 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
326 query.SetParameter("parent", LLUUID.Zero, NHibernateUtil.Custom(typeof(LLUUIDUserType))); 327 criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) );
327 query.SetParameter("owner", user, NHibernateUtil.Custom(typeof(LLUUIDUserType))); 328 criteria.Add(Expression.Eq("Owner", user) );
328 foreach (InventoryFolderBase folder in query.List()) 329 foreach (InventoryFolderBase folder in criteria.List())
329 { 330 {
330 return folder; 331 return folder;
331 } 332 }
diff --git a/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs b/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs
index 024d29b..9bc8016 100644
--- a/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs
+++ b/OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Data.NHibernate
67 67
68 public Type ReturnedType 68 public Type ReturnedType
69 { 69 {
70 get { return typeof(Guid); } 70 get { return typeof(LLUUID); }
71 } 71 }
72 72
73 public SqlType[] SqlTypes 73 public SqlType[] SqlTypes