aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteFriendsData.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-14 04:45:59 +0000
committerJustin Clark-Casey (justincc)2012-11-14 04:45:59 +0000
commit94da908813e42c328572bc5da2ddc41b6664b59c (patch)
tree1a3e1ffaadb34cac64c798f5cc06eadf612c6af9 /OpenSim/Data/SQLite/SQLiteFriendsData.cs
parentIf no ISimulationDataStore or IEstateDataStore implementations could be loade... (diff)
downloadopensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.zip
opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.gz
opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.bz2
opensim-SC_OLD-94da908813e42c328572bc5da2ddc41b6664b59c.tar.xz
More consistently dispose of SqliteCommand in OpenSim.Data.SQLite where possible.
Not doing SQLiteInventoryStore since this is no longer used and should disappear in the future.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteFriendsData.cs25
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 }