aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
diff options
context:
space:
mode:
authorJeff Ames2008-05-14 05:11:23 +0000
committerJeff Ames2008-05-14 05:11:23 +0000
commitc995d60d37032db3198b8496e186aa7a892dc7a8 (patch)
tree826147e66f61c812897d9b0acdb16ebfeb30d4d3 /OpenSim/Data/NHibernate/NHibernateInventoryData.cs
parent* Added 3 warnings in response to the warnings. Adam, read the warnings. (diff)
downloadopensim-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/NHibernateInventoryData.cs')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs46
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index f8e3655..6ee1b4a 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -95,14 +95,14 @@ namespace OpenSim.Data.NHibernate
95 string regex = @"no such table: Inventory"; 95 string regex = @"no such table: Inventory";
96 Regex RE = new Regex(regex, RegexOptions.Multiline); 96 Regex RE = new Regex(regex, RegexOptions.Multiline);
97 try { 97 try {
98 using(ISession session = factory.OpenSession()) { 98 using (ISession session = factory.OpenSession()) {
99 session.Load(typeof(InventoryItemBase), LLUUID.Zero); 99 session.Load(typeof(InventoryItemBase), LLUUID.Zero);
100 } 100 }
101 } catch (ObjectNotFoundException) { 101 } catch (ObjectNotFoundException) {
102 // yes, we know it's not there, but that's ok 102 // yes, we know it's not there, but that's ok
103 } catch (ADOException e) { 103 } catch (ADOException e) {
104 Match m = RE.Match(e.ToString()); 104 Match m = RE.Match(e.ToString());
105 if(m.Success) { 105 if (m.Success) {
106 // We don't have this table, so create it. 106 // We don't have this table, so create it.
107 new SchemaExport(cfg).Create(true, true); 107 new SchemaExport(cfg).Create(true, true);
108 } 108 }
@@ -125,7 +125,7 @@ namespace OpenSim.Data.NHibernate
125 /// <returns>A class containing item information</returns> 125 /// <returns>A class containing item information</returns>
126 public InventoryItemBase getInventoryItem(LLUUID item) 126 public InventoryItemBase getInventoryItem(LLUUID item)
127 { 127 {
128 using(ISession session = factory.OpenSession()) { 128 using (ISession session = factory.OpenSession()) {
129 try { 129 try {
130 return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase; 130 return session.Load(typeof(InventoryItemBase), item) as InventoryItemBase;
131 } catch { 131 } catch {
@@ -142,8 +142,8 @@ namespace OpenSim.Data.NHibernate
142 public void addInventoryItem(InventoryItemBase item) 142 public void addInventoryItem(InventoryItemBase item)
143 { 143 {
144 if (!ExistsItem(item.ID)) { 144 if (!ExistsItem(item.ID)) {
145 using(ISession session = factory.OpenSession()) { 145 using (ISession session = factory.OpenSession()) {
146 using(ITransaction transaction = session.BeginTransaction()) { 146 using (ITransaction transaction = session.BeginTransaction()) {
147 session.Save(item); 147 session.Save(item);
148 transaction.Commit(); 148 transaction.Commit();
149 } 149 }
@@ -161,8 +161,8 @@ namespace OpenSim.Data.NHibernate
161 public void updateInventoryItem(InventoryItemBase item) 161 public void updateInventoryItem(InventoryItemBase item)
162 { 162 {
163 if (ExistsItem(item.ID)) { 163 if (ExistsItem(item.ID)) {
164 using(ISession session = factory.OpenSession()) { 164 using (ISession session = factory.OpenSession()) {
165 using(ITransaction transaction = session.BeginTransaction()) { 165 using (ITransaction transaction = session.BeginTransaction()) {
166 session.Update(item); 166 session.Update(item);
167 transaction.Commit(); 167 transaction.Commit();
168 } 168 }
@@ -178,8 +178,8 @@ namespace OpenSim.Data.NHibernate
178 /// <param name="item"></param> 178 /// <param name="item"></param>
179 public void deleteInventoryItem(LLUUID itemID) 179 public void deleteInventoryItem(LLUUID itemID)
180 { 180 {
181 using(ISession session = factory.OpenSession()) { 181 using (ISession session = factory.OpenSession()) {
182 using(ITransaction transaction = session.BeginTransaction()) { 182 using (ITransaction transaction = session.BeginTransaction()) {
183 session.Delete(itemID); 183 session.Delete(itemID);
184 transaction.Commit(); 184 transaction.Commit();
185 } 185 }
@@ -194,7 +194,7 @@ namespace OpenSim.Data.NHibernate
194 /// <returns>A class containing folder information</returns> 194 /// <returns>A class containing folder information</returns>
195 public InventoryFolderBase getInventoryFolder(LLUUID folder) 195 public InventoryFolderBase getInventoryFolder(LLUUID folder)
196 { 196 {
197 using(ISession session = factory.OpenSession()) { 197 using (ISession session = factory.OpenSession()) {
198 try { 198 try {
199 return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase; 199 return session.Load(typeof(InventoryFolderBase), folder) as InventoryFolderBase;
200 } catch { 200 } catch {
@@ -211,8 +211,8 @@ namespace OpenSim.Data.NHibernate
211 public void addInventoryFolder(InventoryFolderBase folder) 211 public void addInventoryFolder(InventoryFolderBase folder)
212 { 212 {
213 if (!ExistsFolder(folder.ID)) { 213 if (!ExistsFolder(folder.ID)) {
214 using(ISession session = factory.OpenSession()) { 214 using (ISession session = factory.OpenSession()) {
215 using(ITransaction transaction = session.BeginTransaction()) { 215 using (ITransaction transaction = session.BeginTransaction()) {
216 session.Save(folder); 216 session.Save(folder);
217 transaction.Commit(); 217 transaction.Commit();
218 } 218 }
@@ -230,8 +230,8 @@ namespace OpenSim.Data.NHibernate
230 public void updateInventoryFolder(InventoryFolderBase folder) 230 public void updateInventoryFolder(InventoryFolderBase folder)
231 { 231 {
232 if (ExistsFolder(folder.ID)) { 232 if (ExistsFolder(folder.ID)) {
233 using(ISession session = factory.OpenSession()) { 233 using (ISession session = factory.OpenSession()) {
234 using(ITransaction transaction = session.BeginTransaction()) { 234 using (ITransaction transaction = session.BeginTransaction()) {
235 session.Update(folder); 235 session.Update(folder);
236 transaction.Commit(); 236 transaction.Commit();
237 } 237 }
@@ -247,8 +247,8 @@ namespace OpenSim.Data.NHibernate
247 /// <param name="folder"></param> 247 /// <param name="folder"></param>
248 public void deleteInventoryFolder(LLUUID folderID) 248 public void deleteInventoryFolder(LLUUID folderID)
249 { 249 {
250 using(ISession session = factory.OpenSession()) { 250 using (ISession session = factory.OpenSession()) {
251 using(ITransaction transaction = session.BeginTransaction()) { 251 using (ITransaction transaction = session.BeginTransaction()) {
252 session.Delete(folderID.ToString()); 252 session.Delete(folderID.ToString());
253 transaction.Commit(); 253 transaction.Commit();
254 } 254 }
@@ -324,10 +324,10 @@ namespace OpenSim.Data.NHibernate
324 /// <returns>A List of InventoryItemBase items</returns> 324 /// <returns>A List of InventoryItemBase items</returns>
325 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 325 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
326 { 326 {
327 using(ISession session = factory.OpenSession()) { 327 using (ISession session = factory.OpenSession()) {
328 // try { 328 // try {
329 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase)); 329 ICriteria criteria = session.CreateCriteria(typeof(InventoryItemBase));
330 criteria.Add(Expression.Eq("Folder", folderID) ); 330 criteria.Add(Expression.Eq("Folder", folderID));
331 List<InventoryItemBase> list = new List<InventoryItemBase>(); 331 List<InventoryItemBase> list = new List<InventoryItemBase>();
332 foreach (InventoryItemBase item in criteria.List()) 332 foreach (InventoryItemBase item in criteria.List())
333 { 333 {
@@ -348,11 +348,11 @@ namespace OpenSim.Data.NHibernate
348 // see InventoryItemBase.getUserRootFolder 348 // see InventoryItemBase.getUserRootFolder
349 public InventoryFolderBase getUserRootFolder(LLUUID user) 349 public InventoryFolderBase getUserRootFolder(LLUUID user)
350 { 350 {
351 using(ISession session = factory.OpenSession()) { 351 using (ISession session = factory.OpenSession()) {
352 // try { 352 // try {
353 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); 353 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
354 criteria.Add(Expression.Eq("ParentID", LLUUID.Zero) ); 354 criteria.Add(Expression.Eq("ParentID", LLUUID.Zero));
355 criteria.Add(Expression.Eq("Owner", user) ); 355 criteria.Add(Expression.Eq("Owner", user));
356 foreach (InventoryFolderBase folder in criteria.List()) 356 foreach (InventoryFolderBase folder in criteria.List())
357 { 357 {
358 return folder; 358 return folder;
@@ -372,10 +372,10 @@ namespace OpenSim.Data.NHibernate
372 /// <param name="parentID">ID of parent</param> 372 /// <param name="parentID">ID of parent</param>
373 private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) 373 private void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
374 { 374 {
375 using(ISession session = factory.OpenSession()) { 375 using (ISession session = factory.OpenSession()) {
376 // try { 376 // try {
377 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); 377 ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
378 criteria.Add(Expression.Eq("ParentID", parentID) ); 378 criteria.Add(Expression.Eq("ParentID", parentID));
379 foreach (InventoryFolderBase item in criteria.List()) 379 foreach (InventoryFolderBase item in criteria.List())
380 { 380 {
381 folders.Add(item); 381 folders.Add(item);