diff options
author | Sean Dague | 2008-04-09 16:01:57 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-09 16:01:57 +0000 |
commit | 4cc3aad2f9182188b2536c0345f8ae4a4b70f810 (patch) | |
tree | 618e8c7ba056f4fb34a5c3b001b7cc050d1ff845 | |
parent | * Put explicit braces in for single line blocks (diff) | |
download | opensim-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.
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 15 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/Types/LLUUIDUserType.cs | 2 |
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; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using NHibernate; | 33 | using NHibernate; |
34 | using NHibernate.Expression; | ||
34 | using NHibernate.Cfg; | 35 | using NHibernate.Cfg; |
35 | using NHibernate.Tool.hbm2ddl; | 36 | using NHibernate.Tool.hbm2ddl; |
36 | using NHibernate.Mapping.Attributes; | 37 | using 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 |