aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLPresenceData.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-30 15:54:35 +0100
committerJustin Clark-Casey (justincc)2012-04-30 15:54:35 +0100
commit522eff61383e9a8acfdf34289cd64a8fdc27bb19 (patch)
tree3e9d6428bf6832caafd69d45c3a377a9f643dcae /OpenSim/Data/MySQL/MySQLPresenceData.cs
parentComment out debug [ASYNC DELETER] messages for now. (diff)
downloadopensim-SC_OLD-522eff61383e9a8acfdf34289cd64a8fdc27bb19.zip
opensim-SC_OLD-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.gz
opensim-SC_OLD-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.bz2
opensim-SC_OLD-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.xz
Consistently use using() to make sure we dispose of used MySqlCommands where this is not already being done.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLPresenceData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLPresenceData.cs36
1 files changed, 19 insertions, 17 deletions
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs
index fc625f0..7808060 100644
--- a/OpenSim/Data/MySQL/MySQLPresenceData.cs
+++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs
@@ -63,13 +63,14 @@ namespace OpenSim.Data.MySQL
63 63
64 public void LogoutRegionAgents(UUID regionID) 64 public void LogoutRegionAgents(UUID regionID)
65 { 65 {
66 MySqlCommand cmd = new MySqlCommand(); 66 using (MySqlCommand cmd = new MySqlCommand())
67 67 {
68 cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); 68 cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
69 69
70 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); 70 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
71 71
72 ExecuteNonQuery(cmd); 72 ExecuteNonQuery(cmd);
73 }
73 } 74 }
74 75
75 public bool ReportAgent(UUID sessionID, UUID regionID) 76 public bool ReportAgent(UUID sessionID, UUID regionID)
@@ -81,17 +82,18 @@ namespace OpenSim.Data.MySQL
81 if (regionID == UUID.Zero) 82 if (regionID == UUID.Zero)
82 return false; 83 return false;
83 84
84 MySqlCommand cmd = new MySqlCommand(); 85 using (MySqlCommand cmd = new MySqlCommand())
85 86 {
86 cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); 87 cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
87 88
88 cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); 89 cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
89 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); 90 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
90 91
91 if (ExecuteNonQuery(cmd) == 0) 92 if (ExecuteNonQuery(cmd) == 0)
92 return false; 93 return false;
94 }
93 95
94 return true; 96 return true;
95 } 97 }
96 } 98 }
97} 99} \ No newline at end of file