diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLPresenceData.cs | 37 |
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 | } |