diff options
author | Charles Krinke | 2008-07-03 22:30:16 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-03 22:30:16 +0000 |
commit | 7fea52be3542c1eea884f92ea14285560923e57d (patch) | |
tree | 94cfbf76bde53220735e095e77af48e0d4f4ea73 /OpenSim/Data/MySQL/MySQLInventoryData.cs | |
parent | Mantis#1463. Thank you, Melanie for a patch that addresses: (diff) | |
download | opensim-SC-7fea52be3542c1eea884f92ea14285560923e57d.zip opensim-SC-7fea52be3542c1eea884f92ea14285560923e57d.tar.gz opensim-SC-7fea52be3542c1eea884f92ea14285560923e57d.tar.bz2 opensim-SC-7fea52be3542c1eea884f92ea14285560923e57d.tar.xz |
Mantis#1661. Thank you kindly, CMickeyb for a patch that:
patch attached to check for timeouts on mysql connections *before*
operations occur that are likely to timeout. if timeout occurs or
the connections is down, it is reconnected before the operation fails.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 911958c..5bde40a 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -219,6 +219,8 @@ namespace OpenSim.Data.MySQL | |||
219 | { | 219 | { |
220 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 220 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
221 | 221 | ||
222 | database.CheckConnection(); | ||
223 | |||
222 | MySqlCommand result = | 224 | MySqlCommand result = |
223 | new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", | 225 | new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", |
224 | database.Connection); | 226 | database.Connection); |
@@ -253,6 +255,8 @@ namespace OpenSim.Data.MySQL | |||
253 | { | 255 | { |
254 | lock (database) | 256 | lock (database) |
255 | { | 257 | { |
258 | database.CheckConnection(); | ||
259 | |||
256 | MySqlCommand result = | 260 | MySqlCommand result = |
257 | new MySqlCommand( | 261 | new MySqlCommand( |
258 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", | 262 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", |
@@ -292,6 +296,8 @@ namespace OpenSim.Data.MySQL | |||
292 | { | 296 | { |
293 | lock (database) | 297 | lock (database) |
294 | { | 298 | { |
299 | database.CheckConnection(); | ||
300 | |||
295 | MySqlCommand result = | 301 | MySqlCommand result = |
296 | new MySqlCommand( | 302 | new MySqlCommand( |
297 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", | 303 | "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", |
@@ -344,6 +350,8 @@ namespace OpenSim.Data.MySQL | |||
344 | { | 350 | { |
345 | lock (database) | 351 | lock (database) |
346 | { | 352 | { |
353 | database.CheckConnection(); | ||
354 | |||
347 | MySqlCommand result = | 355 | MySqlCommand result = |
348 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", | 356 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", |
349 | database.Connection); | 357 | database.Connection); |
@@ -421,6 +429,8 @@ namespace OpenSim.Data.MySQL | |||
421 | { | 429 | { |
422 | lock (database) | 430 | lock (database) |
423 | { | 431 | { |
432 | database.CheckConnection(); | ||
433 | |||
424 | MySqlCommand result = | 434 | MySqlCommand result = |
425 | new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); | 435 | new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); |
426 | result.Parameters.AddWithValue("?uuid", itemID.ToString()); | 436 | result.Parameters.AddWithValue("?uuid", itemID.ToString()); |
@@ -482,6 +492,8 @@ namespace OpenSim.Data.MySQL | |||
482 | { | 492 | { |
483 | lock (database) | 493 | lock (database) |
484 | { | 494 | { |
495 | database.CheckConnection(); | ||
496 | |||
485 | MySqlCommand result = | 497 | MySqlCommand result = |
486 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); | 498 | new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); |
487 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); | 499 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); |
@@ -522,6 +534,8 @@ namespace OpenSim.Data.MySQL | |||
522 | 534 | ||
523 | try | 535 | try |
524 | { | 536 | { |
537 | database.CheckConnection(); | ||
538 | |||
525 | MySqlCommand result = new MySqlCommand(sql, database.Connection); | 539 | MySqlCommand result = new MySqlCommand(sql, database.Connection); |
526 | result.Parameters.AddWithValue("?inventoryID", item.ID.ToString()); | 540 | result.Parameters.AddWithValue("?inventoryID", item.ID.ToString()); |
527 | result.Parameters.AddWithValue("?assetID", item.AssetID.ToString()); | 541 | result.Parameters.AddWithValue("?assetID", item.AssetID.ToString()); |
@@ -574,6 +588,8 @@ namespace OpenSim.Data.MySQL | |||
574 | { | 588 | { |
575 | try | 589 | try |
576 | { | 590 | { |
591 | database.CheckConnection(); | ||
592 | |||
577 | MySqlCommand cmd = | 593 | MySqlCommand cmd = |
578 | new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); | 594 | new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); |
579 | cmd.Parameters.AddWithValue("?uuid", itemID.ToString()); | 595 | cmd.Parameters.AddWithValue("?uuid", itemID.ToString()); |
@@ -600,6 +616,8 @@ namespace OpenSim.Data.MySQL | |||
600 | "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; | 616 | "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; |
601 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; | 617 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; |
602 | 618 | ||
619 | database.CheckConnection(); | ||
620 | |||
603 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); | 621 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); |
604 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); | 622 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); |
605 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); | 623 | cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString()); |
@@ -640,6 +658,8 @@ namespace OpenSim.Data.MySQL | |||
640 | string sql = | 658 | string sql = |
641 | "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; | 659 | "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID"; |
642 | 660 | ||
661 | database.CheckConnection(); | ||
662 | |||
643 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); | 663 | MySqlCommand cmd = new MySqlCommand(sql, database.Connection); |
644 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); | 664 | cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString()); |
645 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); | 665 | cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString()); |
@@ -695,6 +715,8 @@ namespace OpenSim.Data.MySQL | |||
695 | { | 715 | { |
696 | try | 716 | try |
697 | { | 717 | { |
718 | database.CheckConnection(); | ||
719 | |||
698 | MySqlCommand cmd = | 720 | MySqlCommand cmd = |
699 | new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); | 721 | new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); |
700 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); | 722 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); |
@@ -719,6 +741,8 @@ namespace OpenSim.Data.MySQL | |||
719 | { | 741 | { |
720 | try | 742 | try |
721 | { | 743 | { |
744 | database.CheckConnection(); | ||
745 | |||
722 | MySqlCommand cmd = | 746 | MySqlCommand cmd = |
723 | new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); | 747 | new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); |
724 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); | 748 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); |