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.
0.6.0-stable
Sean Dague 2008-05-02 19:57:35 +00:00
parent 17496f3edf
commit e538a34acc
4 changed files with 19 additions and 12 deletions

View File

@ -85,11 +85,11 @@ namespace OpenSim.Data.NHibernate
private void InitDB() private void InitDB()
{ {
string regex = @"no such table: Users"; string regex = @"no such table: UserProfiles";
Regex RE = new Regex(regex, RegexOptions.Multiline); Regex RE = new Regex(regex, RegexOptions.Multiline);
try { try {
using(ISession session = factory.OpenSession()) { using(ISession session = factory.OpenSession()) {
session.Load(typeof(InventoryItemBase), LLUUID.Zero); session.Load(typeof(UserProfileData), LLUUID.Zero);
} }
} catch (ObjectNotFoundException e) { } catch (ObjectNotFoundException e) {
// yes, we know it's not there, but that's ok // yes, we know it's not there, but that's ok
@ -104,11 +104,14 @@ namespace OpenSim.Data.NHibernate
private bool ExistsUser(LLUUID uuid) private bool ExistsUser(LLUUID uuid)
{ {
UserProfileData user; UserProfileData user = null;
using(ISession session = factory.OpenSession()) { try {
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; using(ISession session = factory.OpenSession()) {
} user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
return (user == null) ? false : true; }
} catch (Exception e) {}
return (user != null);
} }
override public UserProfileData GetUserByUUID(LLUUID uuid) override public UserProfileData GetUserByUUID(LLUUID uuid)
@ -201,8 +204,12 @@ namespace OpenSim.Data.NHibernate
override public UserAgentData GetAgentByUUID(LLUUID uuid) override public UserAgentData GetAgentByUUID(LLUUID uuid)
{ {
using(ISession session = factory.OpenSession()) { try {
return session.Load(typeof(UserAgentData), uuid) as UserAgentData; using(ISession session = factory.OpenSession()) {
return session.Load(typeof(UserAgentData), uuid) as UserAgentData;
}
} catch {
return null;
} }
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.UserAgentData, OpenSim.Framework" table="Users" lazy="false"> <class name="OpenSim.Framework.UserAgentData, OpenSim.Framework" table="UserAgents" lazy="false">
<id name="ProfileID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate"> <id name="ProfileID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.UserAppearance, OpenSim.Framework" table="Users" lazy="false"> <class name="OpenSim.Framework.UserAppearance, OpenSim.Framework" table="UserAppearances" lazy="false">
<id name="User" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate"> <id name="User" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.UserProfileData, OpenSim.Framework" table="Users" lazy="false"> <class name="OpenSim.Framework.UserProfileData, OpenSim.Framework" table="UserProfiles" lazy="false">
<id name="ID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate"> <id name="ID" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>