aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs163
1 files changed, 81 insertions, 82 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index a6b8819..4b2c7af 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -26,10 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using System.Collections.Generic;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
@@ -57,7 +56,9 @@ namespace OpenSim.Framework.Data.MSSQL
57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 56 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 57 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 58
60 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 59 database =
60 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
61 settingPassword);
61 TestTables(); 62 TestTables();
62 } 63 }
63 64
@@ -72,7 +73,6 @@ namespace OpenSim.Framework.Data.MSSQL
72 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); 73 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
73 return; 74 return;
74 } 75 }
75
76 } 76 }
77 77
78 private void UpgradeItemsTable(string tableName) 78 private void UpgradeItemsTable(string tableName)
@@ -88,17 +88,17 @@ namespace OpenSim.Framework.Data.MSSQL
88 88
89 private void TestTables() 89 private void TestTables()
90 { 90 {
91
92 Dictionary<string, string> tableList = new Dictionary<string, string>(); 91 Dictionary<string, string> tableList = new Dictionary<string, string>();
93 92
94 tableList["inventoryfolders"] = null; 93 tableList["inventoryfolders"] = null;
95 tableList["inventoryitems"] = null; 94 tableList["inventoryitems"] = null;
96 95
97 database.GetTableVersion(tableList); 96 database.GetTableVersion(tableList);
98 97
99 UpgradeFoldersTable(tableList["inventoryfolders"]); 98 UpgradeFoldersTable(tableList["inventoryfolders"]);
100 UpgradeItemsTable(tableList["inventoryitems"]); 99 UpgradeItemsTable(tableList["inventoryitems"]);
101 } 100 }
101
102 #endregion 102 #endregion
103 103
104 /// <summary> 104 /// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.MSSQL
124 /// <returns>A string containing the DB provider</returns> 124 /// <returns>A string containing the DB provider</returns>
125 public string getVersion() 125 public string getVersion()
126 { 126 {
127 return database.getVersion(); 127 return database.getVersion();
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
@@ -143,15 +143,16 @@ namespace OpenSim.Framework.Data.MSSQL
143 Dictionary<string, string> param = new Dictionary<string, string>(); 143 Dictionary<string, string> param = new Dictionary<string, string>();
144 param["parentFolderID"] = folderID.ToString(); 144 param["parentFolderID"] = folderID.ToString();
145 145
146 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); 146 IDbCommand result =
147 database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param);
147 IDataReader reader = result.ExecuteReader(); 148 IDataReader reader = result.ExecuteReader();
148 149
149 while(reader.Read()) 150 while (reader.Read())
150 items.Add(readInventoryItem(reader)); 151 items.Add(readInventoryItem(reader));
151 152
152 reader.Close(); 153 reader.Close();
153 result.Dispose(); 154 result.Dispose();
154 155
155 return items; 156 return items;
156 } 157 }
157 } 158 }
@@ -174,16 +175,17 @@ namespace OpenSim.Framework.Data.MSSQL
174 { 175 {
175 lock (database) 176 lock (database)
176 { 177 {
177
178 Dictionary<string, string> param = new Dictionary<string, string>(); 178 Dictionary<string, string> param = new Dictionary<string, string>();
179 param["uuid"] = user.ToString(); 179 param["uuid"] = user.ToString();
180 param["zero"] = LLUUID.Zero.ToString(); 180 param["zero"] = LLUUID.Zero.ToString();
181 181
182 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 182 IDbCommand result =
183 database.Query(
184 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
183 IDataReader reader = result.ExecuteReader(); 185 IDataReader reader = result.ExecuteReader();
184 186
185 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 187 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
186 while(reader.Read()) 188 while (reader.Read())
187 items.Add(readInventoryFolder(reader)); 189 items.Add(readInventoryFolder(reader));
188 190
189 191
@@ -212,24 +214,27 @@ namespace OpenSim.Framework.Data.MSSQL
212 param["uuid"] = user.ToString(); 214 param["uuid"] = user.ToString();
213 param["zero"] = LLUUID.Zero.ToString(); 215 param["zero"] = LLUUID.Zero.ToString();
214 216
215 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 217 IDbCommand result =
218 database.Query(
219 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
216 IDataReader reader = result.ExecuteReader(); 220 IDataReader reader = result.ExecuteReader();
217 221
218 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 222 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
219 while(reader.Read()) 223 while (reader.Read())
220 items.Add(readInventoryFolder(reader)); 224 items.Add(readInventoryFolder(reader));
221 225
222 InventoryFolderBase rootFolder = null; 226 InventoryFolderBase rootFolder = null;
223 227
224 // There should only ever be one root folder for a user. However, if there's more 228 // There should only ever be one root folder for a user. However, if there's more
225 // than one we'll simply use the first one rather than failing. It would be even 229 // than one we'll simply use the first one rather than failing. It would be even
226 // nicer to print some message to this effect, but this feels like it's too low a 230 // nicer to print some message to this effect, but this feels like it's too low a
227 // to put such a message out, and it's too minor right now to spare the time to 231 // to put such a message out, and it's too minor right now to spare the time to
228 // suitably refactor. 232 // suitably refactor.
229 if (items.Count > 0) { 233 if (items.Count > 0)
234 {
230 rootFolder = items[0]; 235 rootFolder = items[0];
231 } 236 }
232 237
233 reader.Close(); 238 reader.Close();
234 result.Dispose(); 239 result.Dispose();
235 240
@@ -259,12 +264,13 @@ namespace OpenSim.Framework.Data.MSSQL
259 param["parentFolderID"] = parentID.ToString(); 264 param["parentFolderID"] = parentID.ToString();
260 265
261 266
262 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); 267 IDbCommand result =
268 database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param);
263 IDataReader reader = result.ExecuteReader(); 269 IDataReader reader = result.ExecuteReader();
264 270
265 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 271 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
266 272
267 while(reader.Read()) 273 while (reader.Read())
268 items.Add(readInventoryFolder(reader)); 274 items.Add(readInventoryFolder(reader));
269 275
270 reader.Close(); 276 reader.Close();
@@ -292,17 +298,17 @@ namespace OpenSim.Framework.Data.MSSQL
292 { 298 {
293 InventoryItemBase item = new InventoryItemBase(); 299 InventoryItemBase item = new InventoryItemBase();
294 300
295 item.inventoryID = new LLUUID((string)reader["inventoryID"]); 301 item.inventoryID = new LLUUID((string) reader["inventoryID"]);
296 item.assetID = new LLUUID((string)reader["assetID"]); 302 item.assetID = new LLUUID((string) reader["assetID"]);
297 item.assetType = (int)reader["assetType"]; 303 item.assetType = (int) reader["assetType"];
298 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); 304 item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
299 item.avatarID = new LLUUID((string)reader["avatarID"]); 305 item.avatarID = new LLUUID((string) reader["avatarID"]);
300 item.inventoryName = (string)reader["inventoryName"]; 306 item.inventoryName = (string) reader["inventoryName"];
301 item.inventoryDescription = (string)reader["inventoryDescription"]; 307 item.inventoryDescription = (string) reader["inventoryDescription"];
302 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); 308 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
303 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); 309 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
304 item.invType = (int)reader["invType"]; 310 item.invType = (int) reader["invType"];
305 item.creatorsID = new LLUUID((string)reader["creatorID"]); 311 item.creatorsID = new LLUUID((string) reader["creatorID"]);
306 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 312 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
307 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 313 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
308 return item; 314 return item;
@@ -322,7 +328,6 @@ namespace OpenSim.Framework.Data.MSSQL
322 /// <returns>An inventory item</returns> 328 /// <returns>An inventory item</returns>
323 public InventoryItemBase getInventoryItem(LLUUID itemID) 329 public InventoryItemBase getInventoryItem(LLUUID itemID)
324 { 330 {
325
326 try 331 try
327 { 332 {
328 lock (database) 333 lock (database)
@@ -330,11 +335,12 @@ namespace OpenSim.Framework.Data.MSSQL
330 Dictionary<string, string> param = new Dictionary<string, string>(); 335 Dictionary<string, string> param = new Dictionary<string, string>();
331 param["inventoryID"] = itemID.ToString(); 336 param["inventoryID"] = itemID.ToString();
332 337
333 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); 338 IDbCommand result =
339 database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param);
334 IDataReader reader = result.ExecuteReader(); 340 IDataReader reader = result.ExecuteReader();
335 341
336 InventoryItemBase item = null; 342 InventoryItemBase item = null;
337 if(reader.Read()) 343 if (reader.Read())
338 item = readInventoryItem(reader); 344 item = readInventoryItem(reader);
339 345
340 reader.Close(); 346 reader.Close();
@@ -361,12 +367,12 @@ namespace OpenSim.Framework.Data.MSSQL
361 try 367 try
362 { 368 {
363 InventoryFolderBase folder = new InventoryFolderBase(); 369 InventoryFolderBase folder = new InventoryFolderBase();
364 folder.agentID = new LLUUID((string)reader["agentID"]); 370 folder.agentID = new LLUUID((string) reader["agentID"]);
365 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 371 folder.parentID = new LLUUID((string) reader["parentFolderID"]);
366 folder.folderID = new LLUUID((string)reader["folderID"]); 372 folder.folderID = new LLUUID((string) reader["folderID"]);
367 folder.name = (string)reader["folderName"]; 373 folder.name = (string) reader["folderName"];
368 folder.type = (short)reader["type"]; 374 folder.type = (short) reader["type"];
369 folder.version = (ushort)((int)reader["version"]); 375 folder.version = (ushort) ((int) reader["version"]);
370 return folder; 376 return folder;
371 } 377 }
372 catch (Exception e) 378 catch (Exception e)
@@ -389,7 +395,7 @@ namespace OpenSim.Framework.Data.MSSQL
389 { 395 {
390 lock (database) 396 lock (database)
391 { 397 {
392 Dictionary<string, string> param = new Dictionary<string,string>(); 398 Dictionary<string, string> param = new Dictionary<string, string>();
393 param["uuid"] = folderID.ToString(); 399 param["uuid"] = folderID.ToString();
394 400
395 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param); 401 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param);
@@ -418,8 +424,10 @@ namespace OpenSim.Framework.Data.MSSQL
418 public void addInventoryItem(InventoryItemBase item) 424 public void addInventoryItem(InventoryItemBase item)
419 { 425 {
420 string sql = "INSERT INTO inventoryitems"; 426 string sql = "INSERT INTO inventoryitems";
421 sql += "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; 427 sql +=
422 sql += "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; 428 "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES ";
429 sql +=
430 "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);";
423 431
424 try 432 try
425 { 433 {
@@ -441,7 +449,6 @@ namespace OpenSim.Framework.Data.MSSQL
441 IDbCommand result = database.Query(sql, param); 449 IDbCommand result = database.Query(sql, param);
442 result.ExecuteNonQuery(); 450 result.ExecuteNonQuery();
443 result.Dispose(); 451 result.Dispose();
444
445 } 452 }
446 catch (SqlException e) 453 catch (SqlException e)
447 { 454 {
@@ -454,21 +461,21 @@ namespace OpenSim.Framework.Data.MSSQL
454 /// </summary> 461 /// </summary>
455 /// <param name="item">Inventory item to update</param> 462 /// <param name="item">Inventory item to update</param>
456 public void updateInventoryItem(InventoryItemBase item) 463 public void updateInventoryItem(InventoryItemBase item)
457 { 464 {
458 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " + 465 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " +
459 "assetID = @assetID, " + 466 "assetID = @assetID, " +
460 "assetType = @assetType" + 467 "assetType = @assetType" +
461 "parentFolderID = @parentFolderID" + 468 "parentFolderID = @parentFolderID" +
462 "avatarID = @avatarID" + 469 "avatarID = @avatarID" +
463 "inventoryName = @inventoryName"+ 470 "inventoryName = @inventoryName" +
464 "inventoryDescription = @inventoryDescription" + 471 "inventoryDescription = @inventoryDescription" +
465 "inventoryNextPermissions = @inventoryNextPermissions" + 472 "inventoryNextPermissions = @inventoryNextPermissions" +
466 "inventoryCurrentPermissions = @inventoryCurrentPermissions" + 473 "inventoryCurrentPermissions = @inventoryCurrentPermissions" +
467 "invType = @invType" + 474 "invType = @invType" +
468 "creatorID = @creatorID" + 475 "creatorID = @creatorID" +
469 "inventoryBasePermissions = @inventoryBasePermissions" + 476 "inventoryBasePermissions = @inventoryBasePermissions" +
470 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + 477 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " +
471 "invenoryID = @keyInventoryID;", database.getConnection()); 478 "invenoryID = @keyInventoryID;", database.getConnection());
472 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString()); 479 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString());
473 SqlParameter param2 = new SqlParameter("@assetID", item.assetID); 480 SqlParameter param2 = new SqlParameter("@assetID", item.assetID);
474 SqlParameter param3 = new SqlParameter("@assetType", item.assetType); 481 SqlParameter param3 = new SqlParameter("@assetType", item.assetType);
@@ -481,7 +488,7 @@ namespace OpenSim.Framework.Data.MSSQL
481 SqlParameter param10 = new SqlParameter("@invType", item.invType); 488 SqlParameter param10 = new SqlParameter("@invType", item.invType);
482 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID); 489 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID);
483 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions); 490 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions);
484 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); 491 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions);
485 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString()); 492 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString());
486 command.Parameters.Add(param1); 493 command.Parameters.Add(param1);
487 command.Parameters.Add(param2); 494 command.Parameters.Add(param2);
@@ -506,7 +513,6 @@ namespace OpenSim.Framework.Data.MSSQL
506 { 513 {
507 MainLog.Instance.Error(e.ToString()); 514 MainLog.Instance.Error(e.ToString());
508 } 515 }
509
510 } 516 }
511 517
512 /// <summary> 518 /// <summary>
@@ -523,8 +529,6 @@ namespace OpenSim.Framework.Data.MSSQL
523 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param); 529 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param);
524 cmd.ExecuteNonQuery(); 530 cmd.ExecuteNonQuery();
525 cmd.Dispose(); 531 cmd.Dispose();
526
527
528 } 532 }
529 catch (SqlException e) 533 catch (SqlException e)
530 { 534 {
@@ -539,7 +543,8 @@ namespace OpenSim.Framework.Data.MSSQL
539 /// <param name="folder">Folder to create</param> 543 /// <param name="folder">Folder to create</param>
540 public void addInventoryFolder(InventoryFolderBase folder) 544 public void addInventoryFolder(InventoryFolderBase folder)
541 { 545 {
542 string sql = "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; 546 string sql =
547 "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES ";
543 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; 548 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);";
544 549
545 550
@@ -550,9 +555,9 @@ namespace OpenSim.Framework.Data.MSSQL
550 param["folderName"] = folder.name; 555 param["folderName"] = folder.name;
551 param["type"] = Convert.ToString(folder.type); 556 param["type"] = Convert.ToString(folder.type);
552 param["version"] = Convert.ToString(folder.version); 557 param["version"] = Convert.ToString(folder.version);
553 558
554 try 559 try
555 { 560 {
556 IDbCommand result = database.Query(sql, param); 561 IDbCommand result = database.Query(sql, param);
557 result.ExecuteNonQuery(); 562 result.ExecuteNonQuery();
558 result.Dispose(); 563 result.Dispose();
@@ -567,16 +572,15 @@ namespace OpenSim.Framework.Data.MSSQL
567 /// Updates an inventory folder 572 /// Updates an inventory folder
568 /// </summary> 573 /// </summary>
569 /// <param name="folder">Folder to update</param> 574 /// <param name="folder">Folder to update</param>
570
571 public void updateInventoryFolder(InventoryFolderBase folder) 575 public void updateInventoryFolder(InventoryFolderBase folder)
572 { 576 {
573 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 577 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
574 "agentID = @agentID, " + 578 "agentID = @agentID, " +
575 "parentFolderID = @parentFolderID," + 579 "parentFolderID = @parentFolderID," +
576 "folderName = @folderName," + 580 "folderName = @folderName," +
577 "type = @type," + 581 "type = @type," +
578 "version = @version where " + 582 "version = @version where " +
579 "folderID = @keyFolderID;", database.getConnection()); 583 "folderID = @keyFolderID;", database.getConnection());
580 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 584 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
581 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); 585 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString());
582 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 586 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
@@ -600,20 +604,17 @@ namespace OpenSim.Framework.Data.MSSQL
600 { 604 {
601 MainLog.Instance.Error(e.ToString()); 605 MainLog.Instance.Error(e.ToString());
602 } 606 }
603
604
605 } 607 }
606 608
607 /// <summary> 609 /// <summary>
608 /// Updates an inventory folder 610 /// Updates an inventory folder
609 /// </summary> 611 /// </summary>
610 /// <param name="folder">Folder to update</param> 612 /// <param name="folder">Folder to update</param>
611
612 public void moveInventoryFolder(InventoryFolderBase folder) 613 public void moveInventoryFolder(InventoryFolderBase folder)
613 { 614 {
614 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 615 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
615 "parentFolderID = @parentFolderID," + 616 "parentFolderID = @parentFolderID," +
616 "folderID = @keyFolderID;", database.getConnection()); 617 "folderID = @keyFolderID;", database.getConnection());
617 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 618 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
618 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 619 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
619 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); 620 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString());
@@ -629,8 +630,6 @@ namespace OpenSim.Framework.Data.MSSQL
629 { 630 {
630 MainLog.Instance.Error(e.ToString()); 631 MainLog.Instance.Error(e.ToString());
631 } 632 }
632
633
634 } 633 }
635 634
636 /// <summary> 635 /// <summary>
@@ -645,7 +644,7 @@ namespace OpenSim.Framework.Data.MSSQL
645 foreach (InventoryFolderBase f in subfolderList) 644 foreach (InventoryFolderBase f in subfolderList)
646 folders.Add(f); 645 folders.Add(f);
647 } 646 }
648 647
649 /// <summary> 648 /// <summary>
650 /// Returns all child folders in the hierarchy from the parent folder and down 649 /// Returns all child folders in the hierarchy from the parent folder and down
651 /// </summary> 650 /// </summary>
@@ -672,7 +671,6 @@ namespace OpenSim.Framework.Data.MSSQL
672 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param); 671 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param);
673 cmd.ExecuteNonQuery(); 672 cmd.ExecuteNonQuery();
674 cmd.Dispose(); 673 cmd.Dispose();
675
676 } 674 }
677 catch (SqlException e) 675 catch (SqlException e)
678 { 676 {
@@ -689,7 +687,8 @@ namespace OpenSim.Framework.Data.MSSQL
689 param["parentFolderID"] = folderID.ToString(); 687 param["parentFolderID"] = folderID.ToString();
690 688
691 689
692 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); 690 IDbCommand cmd =
691 database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param);
693 cmd.ExecuteNonQuery(); 692 cmd.ExecuteNonQuery();
694 cmd.Dispose(); 693 cmd.Dispose();
695 } 694 }
@@ -724,4 +723,4 @@ namespace OpenSim.Framework.Data.MSSQL
724 } 723 }
725 } 724 }
726 } 725 }
727} 726} \ No newline at end of file