diff options
author | Jeff Ames | 2008-05-14 05:11:23 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-14 05:11:23 +0000 |
commit | c995d60d37032db3198b8496e186aa7a892dc7a8 (patch) | |
tree | 826147e66f61c812897d9b0acdb16ebfeb30d4d3 /OpenSim/Data/NHibernate/NHibernateUserData.cs | |
parent | * Added 3 warnings in response to the warnings. Adam, read the warnings. (diff) | |
download | opensim-SC_OLD-c995d60d37032db3198b8496e186aa7a892dc7a8.zip opensim-SC_OLD-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.gz opensim-SC_OLD-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.bz2 opensim-SC_OLD-c995d60d37032db3198b8496e186aa7a892dc7a8.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Data/NHibernate/NHibernateUserData.cs')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index e680840..2c84ef9 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -88,14 +88,14 @@ namespace OpenSim.Data.NHibernate | |||
88 | string regex = @"no such table: UserProfiles"; | 88 | string regex = @"no such table: UserProfiles"; |
89 | Regex RE = new Regex(regex, RegexOptions.Multiline); | 89 | Regex RE = new Regex(regex, RegexOptions.Multiline); |
90 | try { | 90 | try { |
91 | using(ISession session = factory.OpenSession()) { | 91 | using (ISession session = factory.OpenSession()) { |
92 | session.Load(typeof(UserProfileData), LLUUID.Zero); | 92 | session.Load(typeof(UserProfileData), LLUUID.Zero); |
93 | } | 93 | } |
94 | } catch (ObjectNotFoundException) { | 94 | } catch (ObjectNotFoundException) { |
95 | // yes, we know it's not there, but that's ok | 95 | // yes, we know it's not there, but that's ok |
96 | } catch (ADOException e) { | 96 | } catch (ADOException e) { |
97 | Match m = RE.Match(e.ToString()); | 97 | Match m = RE.Match(e.ToString()); |
98 | if(m.Success) { | 98 | if (m.Success) { |
99 | // We don't have this table, so create it. | 99 | // We don't have this table, so create it. |
100 | new SchemaExport(cfg).Create(true, true); | 100 | new SchemaExport(cfg).Create(true, true); |
101 | } | 101 | } |
@@ -106,7 +106,7 @@ namespace OpenSim.Data.NHibernate | |||
106 | { | 106 | { |
107 | UserProfileData user = null; | 107 | UserProfileData user = null; |
108 | try { | 108 | try { |
109 | using(ISession session = factory.OpenSession()) { | 109 | using (ISession session = factory.OpenSession()) { |
110 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; | 110 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; |
111 | } | 111 | } |
112 | // BUG: CATCHALL IS BAD. | 112 | // BUG: CATCHALL IS BAD. |
@@ -119,7 +119,7 @@ namespace OpenSim.Data.NHibernate | |||
119 | { | 119 | { |
120 | UserProfileData user; | 120 | UserProfileData user; |
121 | // TODO: I'm sure I'll have to do something silly here | 121 | // TODO: I'm sure I'll have to do something silly here |
122 | using(ISession session = factory.OpenSession()) { | 122 | using (ISession session = factory.OpenSession()) { |
123 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; | 123 | user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; |
124 | user.CurrentAgent = GetAgentByUUID(uuid); | 124 | user.CurrentAgent = GetAgentByUUID(uuid); |
125 | } | 125 | } |
@@ -129,8 +129,8 @@ namespace OpenSim.Data.NHibernate | |||
129 | override public void AddNewUserProfile(UserProfileData profile) | 129 | override public void AddNewUserProfile(UserProfileData profile) |
130 | { | 130 | { |
131 | if (!ExistsUser(profile.ID)) { | 131 | if (!ExistsUser(profile.ID)) { |
132 | using(ISession session = factory.OpenSession()) { | 132 | using (ISession session = factory.OpenSession()) { |
133 | using(ITransaction transaction = session.BeginTransaction()) { | 133 | using (ITransaction transaction = session.BeginTransaction()) { |
134 | session.Save(profile); | 134 | session.Save(profile); |
135 | SetAgentData(profile.ID, profile.CurrentAgent, session); | 135 | SetAgentData(profile.ID, profile.CurrentAgent, session); |
136 | // TODO: save agent | 136 | // TODO: save agent |
@@ -166,8 +166,8 @@ namespace OpenSim.Data.NHibernate | |||
166 | override public bool UpdateUserProfile(UserProfileData profile) | 166 | override public bool UpdateUserProfile(UserProfileData profile) |
167 | { | 167 | { |
168 | if (ExistsUser(profile.ID)) { | 168 | if (ExistsUser(profile.ID)) { |
169 | using(ISession session = factory.OpenSession()) { | 169 | using (ISession session = factory.OpenSession()) { |
170 | using(ITransaction transaction = session.BeginTransaction()) { | 170 | using (ITransaction transaction = session.BeginTransaction()) { |
171 | session.Update(profile); | 171 | session.Update(profile); |
172 | SetAgentData(profile.ID, profile.CurrentAgent, session); | 172 | SetAgentData(profile.ID, profile.CurrentAgent, session); |
173 | transaction.Commit(); | 173 | transaction.Commit(); |
@@ -183,8 +183,8 @@ namespace OpenSim.Data.NHibernate | |||
183 | 183 | ||
184 | override public void AddNewUserAgent(UserAgentData agent) | 184 | override public void AddNewUserAgent(UserAgentData agent) |
185 | { | 185 | { |
186 | using(ISession session = factory.OpenSession()) { | 186 | using (ISession session = factory.OpenSession()) { |
187 | using(ITransaction transaction = session.BeginTransaction()) { | 187 | using (ITransaction transaction = session.BeginTransaction()) { |
188 | session.Save(agent); | 188 | session.Save(agent); |
189 | transaction.Commit(); | 189 | transaction.Commit(); |
190 | } | 190 | } |
@@ -193,8 +193,8 @@ namespace OpenSim.Data.NHibernate | |||
193 | 193 | ||
194 | public void UpdateUserAgent(UserAgentData agent) | 194 | public void UpdateUserAgent(UserAgentData agent) |
195 | { | 195 | { |
196 | using(ISession session = factory.OpenSession()) { | 196 | using (ISession session = factory.OpenSession()) { |
197 | using(ITransaction transaction = session.BeginTransaction()) { | 197 | using (ITransaction transaction = session.BeginTransaction()) { |
198 | session.Update(agent); | 198 | session.Update(agent); |
199 | transaction.Commit(); | 199 | transaction.Commit(); |
200 | } | 200 | } |
@@ -206,7 +206,7 @@ namespace OpenSim.Data.NHibernate | |||
206 | override public UserAgentData GetAgentByUUID(LLUUID uuid) | 206 | override public UserAgentData GetAgentByUUID(LLUUID uuid) |
207 | { | 207 | { |
208 | try { | 208 | try { |
209 | using(ISession session = factory.OpenSession()) { | 209 | using (ISession session = factory.OpenSession()) { |
210 | return session.Load(typeof(UserAgentData), uuid) as UserAgentData; | 210 | return session.Load(typeof(UserAgentData), uuid) as UserAgentData; |
211 | } | 211 | } |
212 | } catch { | 212 | } catch { |
@@ -216,7 +216,7 @@ namespace OpenSim.Data.NHibernate | |||
216 | 216 | ||
217 | override public UserProfileData GetUserByName(string fname, string lname) | 217 | override public UserProfileData GetUserByName(string fname, string lname) |
218 | { | 218 | { |
219 | using(ISession session = factory.OpenSession()) { | 219 | using (ISession session = factory.OpenSession()) { |
220 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); | 220 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); |
221 | criteria.Add(Expression.Eq("FirstName", fname)); | 221 | criteria.Add(Expression.Eq("FirstName", fname)); |
222 | criteria.Add(Expression.Eq("SurName", lname)); | 222 | criteria.Add(Expression.Eq("SurName", lname)); |
@@ -247,11 +247,11 @@ namespace OpenSim.Data.NHibernate | |||
247 | 247 | ||
248 | if (querysplit.Length == 2) | 248 | if (querysplit.Length == 2) |
249 | { | 249 | { |
250 | using(ISession session = factory.OpenSession()) { | 250 | using (ISession session = factory.OpenSession()) { |
251 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); | 251 | ICriteria criteria = session.CreateCriteria(typeof(UserProfileData)); |
252 | criteria.Add(Expression.Like("FirstName", querysplit[0])); | 252 | criteria.Add(Expression.Like("FirstName", querysplit[0])); |
253 | criteria.Add(Expression.Like("SurName", querysplit[1])); | 253 | criteria.Add(Expression.Like("SurName", querysplit[1])); |
254 | foreach(UserProfileData profile in criteria.List()) | 254 | foreach (UserProfileData profile in criteria.List()) |
255 | { | 255 | { |
256 | AvatarPickerAvatar user = new AvatarPickerAvatar(); | 256 | AvatarPickerAvatar user = new AvatarPickerAvatar(); |
257 | user.AvatarID = profile.ID; | 257 | user.AvatarID = profile.ID; |
@@ -280,7 +280,7 @@ namespace OpenSim.Data.NHibernate | |||
280 | { | 280 | { |
281 | UserAppearance appearance; | 281 | UserAppearance appearance; |
282 | // TODO: I'm sure I'll have to do something silly here | 282 | // TODO: I'm sure I'll have to do something silly here |
283 | using(ISession session = factory.OpenSession()) { | 283 | using (ISession session = factory.OpenSession()) { |
284 | appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; | 284 | appearance = session.Load(typeof(UserAppearance), user) as UserAppearance; |
285 | } | 285 | } |
286 | return appearance; | 286 | return appearance; |
@@ -289,7 +289,7 @@ namespace OpenSim.Data.NHibernate | |||
289 | private bool ExistsAppearance(LLUUID uuid) | 289 | private bool ExistsAppearance(LLUUID uuid) |
290 | { | 290 | { |
291 | UserAppearance appearance; | 291 | UserAppearance appearance; |
292 | using(ISession session = factory.OpenSession()) { | 292 | using (ISession session = factory.OpenSession()) { |
293 | appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; | 293 | appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance; |
294 | } | 294 | } |
295 | return (appearance == null) ? false : true; | 295 | return (appearance == null) ? false : true; |
@@ -299,8 +299,8 @@ namespace OpenSim.Data.NHibernate | |||
299 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) | 299 | override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance) |
300 | { | 300 | { |
301 | bool exists = ExistsAppearance(user); | 301 | bool exists = ExistsAppearance(user); |
302 | using(ISession session = factory.OpenSession()) { | 302 | using (ISession session = factory.OpenSession()) { |
303 | using(ITransaction transaction = session.BeginTransaction()) { | 303 | using (ITransaction transaction = session.BeginTransaction()) { |
304 | if (exists) { | 304 | if (exists) { |
305 | session.Update(appearance); | 305 | session.Update(appearance); |
306 | } else { | 306 | } else { |