aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLPresenceData.cs
diff options
context:
space:
mode:
authorMelanie2010-02-08 17:38:05 +0000
committerMelanie2010-02-08 17:38:05 +0000
commit210649f0d4c55b840fc5886fe41e7d4505fa5097 (patch)
treefde70a95db4b13d4666ed2d5da49de6e9f2a44ae /OpenSim/Data/MySQL/MySQLPresenceData.cs
parentBug fix in configger (diff)
downloadopensim-SC_OLD-210649f0d4c55b840fc5886fe41e7d4505fa5097.zip
opensim-SC_OLD-210649f0d4c55b840fc5886fe41e7d4505fa5097.tar.gz
opensim-SC_OLD-210649f0d4c55b840fc5886fe41e7d4505fa5097.tar.bz2
opensim-SC_OLD-210649f0d4c55b840fc5886fe41e7d4505fa5097.tar.xz
Make an exception report more clear. Fix a database access in Presence to
conform to the changes in the generic table handler.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLPresenceData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLPresenceData.cs37
1 files changed, 22 insertions, 15 deletions
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs
index 4950f7f..fcbe3d6 100644
--- a/OpenSim/Data/MySQL/MySQLPresenceData.cs
+++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs
@@ -122,26 +122,33 @@ namespace OpenSim.Data.MySQL
122 cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm); 122 cmd.CommandText = String.Format("select * from {0} where UserID=?UserID", m_Realm);
123 123
124 cmd.Parameters.AddWithValue("?UserID", userID); 124 cmd.Parameters.AddWithValue("?UserID", userID);
125;
126 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
127 {
128 dbcon.Open();
125 129
126 using (IDataReader reader = cmd.ExecuteReader()) 130 cmd.Connection = dbcon;
127 {
128 131
129 List<UUID> deleteSessions = new List<UUID>(); 132 using (IDataReader reader = cmd.ExecuteReader())
130 int online = 0;
131
132 while(reader.Read())
133 { 133 {
134 if (bool.Parse(reader["Online"].ToString()))
135 online++;
136 else
137 deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
138 }
139 134
140 if (online == 0 && deleteSessions.Count > 0) 135 List<UUID> deleteSessions = new List<UUID>();
141 deleteSessions.RemoveAt(0); 136 int online = 0;
137
138 while(reader.Read())
139 {
140 if (bool.Parse(reader["Online"].ToString()))
141 online++;
142 else
143 deleteSessions.Add(new UUID(reader["SessionID"].ToString()));
144 }
142 145
143 foreach (UUID s in deleteSessions) 146 if (online == 0 && deleteSessions.Count > 0)
144 Delete("SessionID", s.ToString()); 147 deleteSessions.RemoveAt(0);
148
149 foreach (UUID s in deleteSessions)
150 Delete("SessionID", s.ToString());
151 }
145 } 152 }
146 } 153 }
147 } 154 }