diff options
author | Sean Dague | 2008-05-02 19:16:54 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-02 19:16:54 +0000 |
commit | 286d681673a9c3211601a675429ca76bbc2ddf60 (patch) | |
tree | 99177d2c42fe6afe65a6617d920dd875de06401d /OpenSim/Data | |
parent | plumb in connection string to the user database paths. mysql and mssql (diff) | |
download | opensim-SC-286d681673a9c3211601a675429ca76bbc2ddf60.zip opensim-SC-286d681673a9c3211601a675429ca76bbc2ddf60.tar.gz opensim-SC-286d681673a9c3211601a675429ca76bbc2ddf60.tar.bz2 opensim-SC-286d681673a9c3211601a675429ca76bbc2ddf60.tar.xz |
in theory this gives me a back end that will do persistance
to actually have something to test plumbing in appearance
saving.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 6a830f6..87594db 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -244,16 +244,41 @@ namespace OpenSim.Data.NHibernate | |||
244 | public override bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) {return true;} | 244 | public override bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) {return true;} |
245 | public override bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory) {return true;} | 245 | public override bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory) {return true;} |
246 | 246 | ||
247 | /// Appearance | 247 | /// Appearance |
248 | /// TODO: stubs for now to get us to a compiling state gently | 248 | /// TODO: stubs for now to get us to a compiling state gently |
249 | override public UserAppearance GetUserAppearance(LLUUID user) | 249 | override public UserAppearance GetUserAppearance(LLUUID user) |
250 | { | 250 | { |
251 | return new UserAppearance(); | 251 | UserAppearance appearance; |
252 | // TODO: I'm sure I'll have to do something silly here | ||
253 | using(ISession session = factory.OpenSession()) { | ||
254 | appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; | ||
255 | } | ||
256 | return appearance; | ||
257 | } | ||
258 | |||
259 | private bool ExistsAppearance(LLUUID uuid) | ||
260 | { | ||
261 | UserAppearance appearance; | ||
262 | using(ISession session = factory.OpenSession()) { | ||
263 | appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; | ||
264 | } | ||
265 | return (appearance == null) ? false : true; | ||
252 | } | 266 | } |
253 | 267 | ||
268 | |||
254 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) | 269 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) |
255 | { | 270 | { |
256 | return; | 271 | bool exists = ExistsAppearance(user); |
272 | using(ISession session = factory.OpenSession()) { | ||
273 | using(ITransaction transaction = session.BeginTransaction()) { | ||
274 | if (exists) { | ||
275 | session.Update(appearance); | ||
276 | } else { | ||
277 | session.Save(appearance); | ||
278 | } | ||
279 | transaction.Commit(); | ||
280 | } | ||
281 | } | ||
257 | } | 282 | } |
258 | 283 | ||
259 | override public void AddAttachment(LLUUID user, LLUUID item) | 284 | override public void AddAttachment(LLUUID user, LLUUID item) |