diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLPresenceData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLPresenceData.cs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 3f90639..b9114eb 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs | |||
@@ -52,8 +52,17 @@ namespace OpenSim.Data.MySQL | |||
52 | 52 | ||
53 | public PresenceData Get(UUID sessionID) | 53 | public PresenceData Get(UUID sessionID) |
54 | { | 54 | { |
55 | PresenceData[] ret = Get("SessionID", | 55 | PresenceData[] ret = Get("SessionID", sessionID.ToString()); |
56 | sessionID.ToString()); | 56 | |
57 | if (ret.Length == 0) | ||
58 | return null; | ||
59 | |||
60 | return ret[0]; | ||
61 | } | ||
62 | |||
63 | public PresenceData GetByUser(UUID userID) | ||
64 | { | ||
65 | PresenceData[] ret = Get("UserID", userID.ToString()); | ||
57 | 66 | ||
58 | if (ret.Length == 0) | 67 | if (ret.Length == 0) |
59 | return null; | 68 | return null; |
@@ -66,9 +75,9 @@ namespace OpenSim.Data.MySQL | |||
66 | using (MySqlCommand cmd = new MySqlCommand()) | 75 | using (MySqlCommand cmd = new MySqlCommand()) |
67 | { | 76 | { |
68 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); | 77 | cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm); |
69 | 78 | ||
70 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 79 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
71 | 80 | ||
72 | ExecuteNonQuery(cmd); | 81 | ExecuteNonQuery(cmd); |
73 | } | 82 | } |
74 | } | 83 | } |
@@ -85,10 +94,10 @@ namespace OpenSim.Data.MySQL | |||
85 | using (MySqlCommand cmd = new MySqlCommand()) | 94 | using (MySqlCommand cmd = new MySqlCommand()) |
86 | { | 95 | { |
87 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); | 96 | cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm); |
88 | 97 | ||
89 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); | 98 | cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString()); |
90 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 99 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
91 | 100 | ||
92 | if (ExecuteNonQuery(cmd) == 0) | 101 | if (ExecuteNonQuery(cmd) == 0) |
93 | return false; | 102 | return false; |
94 | } | 103 | } |