aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLInventoryData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs130
1 files changed, 67 insertions, 63 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 1a634e5..e9b10f3 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -467,43 +467,43 @@ namespace OpenSim.Data.MySQL
467 { 467 {
468 dbcon.Open(); 468 dbcon.Open();
469 469
470 MySqlCommand result = new MySqlCommand(sql, dbcon); 470 using (MySqlCommand result = new MySqlCommand(sql, dbcon))
471 result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
472 result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
473 result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
474 result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
475 result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
476 result.Parameters.AddWithValue("?inventoryName", itemName);
477 result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
478 result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
479 result.Parameters.AddWithValue("?inventoryCurrentPermissions",
480 item.CurrentPermissions.ToString());
481 result.Parameters.AddWithValue("?invType", item.InvType);
482 result.Parameters.AddWithValue("?creatorID", item.CreatorId);
483 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
484 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
485 result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
486 result.Parameters.AddWithValue("?salePrice", item.SalePrice);
487 result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
488 result.Parameters.AddWithValue("?creationDate", item.CreationDate);
489 result.Parameters.AddWithValue("?groupID", item.GroupID);
490 result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
491 result.Parameters.AddWithValue("?flags", item.Flags);
492
493 lock (m_dbLock)
494 { 471 {
495 result.ExecuteNonQuery(); 472 result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
473 result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
474 result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
475 result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
476 result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
477 result.Parameters.AddWithValue("?inventoryName", itemName);
478 result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
479 result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
480 result.Parameters.AddWithValue("?inventoryCurrentPermissions",
481 item.CurrentPermissions.ToString());
482 result.Parameters.AddWithValue("?invType", item.InvType);
483 result.Parameters.AddWithValue("?creatorID", item.CreatorId);
484 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
485 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
486 result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
487 result.Parameters.AddWithValue("?salePrice", item.SalePrice);
488 result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
489 result.Parameters.AddWithValue("?creationDate", item.CreationDate);
490 result.Parameters.AddWithValue("?groupID", item.GroupID);
491 result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
492 result.Parameters.AddWithValue("?flags", item.Flags);
493
494 lock (m_dbLock)
495 result.ExecuteNonQuery();
496
497 result.Dispose();
496 } 498 }
497 499
498 result.Dispose(); 500 using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
499
500 result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon);
501 result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
502 lock (m_dbLock)
503 { 501 {
504 result.ExecuteNonQuery(); 502 result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
503
504 lock (m_dbLock)
505 result.ExecuteNonQuery();
505 } 506 }
506 result.Dispose();
507 } 507 }
508 } 508 }
509 catch (MySqlException e) 509 catch (MySqlException e)
@@ -533,12 +533,12 @@ namespace OpenSim.Data.MySQL
533 { 533 {
534 dbcon.Open(); 534 dbcon.Open();
535 535
536 MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon); 536 using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon))
537 cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
538
539 lock (m_dbLock)
540 { 537 {
541 cmd.ExecuteNonQuery(); 538 cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
539
540 lock (m_dbLock)
541 cmd.ExecuteNonQuery();
542 } 542 }
543 } 543 }
544 } 544 }
@@ -579,24 +579,26 @@ namespace OpenSim.Data.MySQL
579 { 579 {
580 dbcon.Open(); 580 dbcon.Open();
581 581
582 MySqlCommand cmd = new MySqlCommand(sql, dbcon); 582 using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
583 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
584 cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
585 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
586 cmd.Parameters.AddWithValue("?folderName", folderName);
587 cmd.Parameters.AddWithValue("?type", folder.Type);
588 cmd.Parameters.AddWithValue("?version", folder.Version);
589
590 try
591 { 583 {
592 lock (m_dbLock) 584 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
585 cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
586 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
587 cmd.Parameters.AddWithValue("?folderName", folderName);
588 cmd.Parameters.AddWithValue("?type", folder.Type);
589 cmd.Parameters.AddWithValue("?version", folder.Version);
590
591 try
593 { 592 {
594 cmd.ExecuteNonQuery(); 593 lock (m_dbLock)
594 {
595 cmd.ExecuteNonQuery();
596 }
597 }
598 catch (Exception e)
599 {
600 m_log.Error(e.ToString());
595 } 601 }
596 }
597 catch (Exception e)
598 {
599 m_log.Error(e.ToString());
600 } 602 }
601 } 603 }
602 } 604 }
@@ -624,20 +626,22 @@ namespace OpenSim.Data.MySQL
624 { 626 {
625 dbcon.Open(); 627 dbcon.Open();
626 628
627 MySqlCommand cmd = new MySqlCommand(sql, dbcon); 629 using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
628 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
629 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
630
631 try
632 { 630 {
633 lock (m_dbLock) 631 cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
632 cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
633
634 try
634 { 635 {
635 cmd.ExecuteNonQuery(); 636 lock (m_dbLock)
637 {
638 cmd.ExecuteNonQuery();
639 }
640 }
641 catch (Exception e)
642 {
643 m_log.Error(e.ToString());
636 } 644 }
637 }
638 catch (Exception e)
639 {
640 m_log.Error(e.ToString());
641 } 645 }
642 } 646 }
643 } 647 }