diff options
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteFriendsData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteFriendsData.cs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs index 5f68977..cab85eb 100644 --- a/OpenSim/Data/SQLite/SQLiteFriendsData.cs +++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs | |||
@@ -53,13 +53,13 @@ namespace OpenSim.Data.SQLite | |||
53 | 53 | ||
54 | public FriendsData[] GetFriends(string userID) | 54 | public FriendsData[] GetFriends(string userID) |
55 | { | 55 | { |
56 | SqliteCommand cmd = new SqliteCommand(); | 56 | using (SqliteCommand cmd = new SqliteCommand()) |
57 | 57 | { | |
58 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm); | 58 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm); |
59 | cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString()); | 59 | cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString()); |
60 | |||
61 | return DoQuery(cmd); | ||
62 | 60 | ||
61 | return DoQuery(cmd); | ||
62 | } | ||
63 | } | 63 | } |
64 | 64 | ||
65 | public bool Delete(UUID principalID, string friend) | 65 | public bool Delete(UUID principalID, string friend) |
@@ -69,13 +69,14 @@ namespace OpenSim.Data.SQLite | |||
69 | 69 | ||
70 | public bool Delete(string principalID, string friend) | 70 | public bool Delete(string principalID, string friend) |
71 | { | 71 | { |
72 | SqliteCommand cmd = new SqliteCommand(); | 72 | using (SqliteCommand cmd = new SqliteCommand()) |
73 | 73 | { | |
74 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); | 74 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); |
75 | cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); | 75 | cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); |
76 | cmd.Parameters.AddWithValue(":Friend", friend); | 76 | cmd.Parameters.AddWithValue(":Friend", friend); |
77 | 77 | ||
78 | ExecuteNonQuery(cmd, m_Connection); | 78 | ExecuteNonQuery(cmd, m_Connection); |
79 | } | ||
79 | 80 | ||
80 | return true; | 81 | return true; |
81 | } | 82 | } |