From e538a34accb1032ac738eb18fe998aae1afc652d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 2 May 2008 19:57:35 +0000 Subject: fixed up a bunch of the nhibernate user driver. Friends are not implemented, and something is still funny with agents, but this at least got me logged in, so is good enough to plumb through appearance and see how that goes. --- OpenSim/Data/NHibernate/NHibernateUserData.cs | 25 ++++++++++++++-------- .../NHibernate/Resources/UserAgentData.hbm.xml | 2 +- .../NHibernate/Resources/UserAppearance.hbm.xml | 2 +- .../NHibernate/Resources/UserProfileData.hbm.xml | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 8983753..491cb2a 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -85,11 +85,11 @@ namespace OpenSim.Data.NHibernate private void InitDB() { - string regex = @"no such table: Users"; + string regex = @"no such table: UserProfiles"; Regex RE = new Regex(regex, RegexOptions.Multiline); try { using(ISession session = factory.OpenSession()) { - session.Load(typeof(InventoryItemBase), LLUUID.Zero); + session.Load(typeof(UserProfileData), LLUUID.Zero); } } catch (ObjectNotFoundException e) { // yes, we know it's not there, but that's ok @@ -104,11 +104,14 @@ namespace OpenSim.Data.NHibernate private bool ExistsUser(LLUUID uuid) { - UserProfileData user; - using(ISession session = factory.OpenSession()) { - user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; - } - return (user == null) ? false : true; + UserProfileData user = null; + try { + using(ISession session = factory.OpenSession()) { + user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; + } + } catch (Exception e) {} + + return (user != null); } override public UserProfileData GetUserByUUID(LLUUID uuid) @@ -201,8 +204,12 @@ namespace OpenSim.Data.NHibernate override public UserAgentData GetAgentByUUID(LLUUID uuid) { - using(ISession session = factory.OpenSession()) { - return session.Load(typeof(UserAgentData), uuid) as UserAgentData; + try { + using(ISession session = factory.OpenSession()) { + return session.Load(typeof(UserAgentData), uuid) as UserAgentData; + } + } catch { + return null; } } diff --git a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml index a642ae8..b2abeae 100644 --- a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml @@ -1,6 +1,6 @@ - + diff --git a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml index 0eabf0e..85d888d 100644 --- a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml @@ -1,6 +1,6 @@ - + diff --git a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml index 572916a..3e4b5aa 100644 --- a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml @@ -1,6 +1,6 @@ - + -- cgit v1.1