29 using System.Collections;
30 using System.Collections.Generic;
33 using OpenSim.Framework;
34 using System.Reflection;
38 namespace OpenSim.Data.PGSQL
43 : base(connectionString, realm,
"FriendsStore")
45 using (NpgsqlConnection conn =
new NpgsqlConnection(m_ConnectionString))
54 public override bool Delete(
string principalID,
string friend)
56 UUID princUUID = UUID.Zero;
58 bool ret = UUID.TryParse(principalID, out princUUID);
61 return Delete(princUUID,
friend);
66 public bool Delete(UUID principalID,
string friend)
68 using (NpgsqlConnection conn =
new NpgsqlConnection(m_ConnectionString))
69 using (NpgsqlCommand cmd =
new NpgsqlCommand())
71 cmd.CommandText = String.Format(
"delete from {0} where \"PrincipalID\" = :PrincipalID and \"Friend\" = :Friend", m_Realm);
72 cmd.Parameters.Add(m_database.CreateParameter(
"PrincipalID", principalID.ToString()));
73 cmd.Parameters.Add(m_database.CreateParameter(
"Friend",
friend));
74 cmd.Connection = conn;
76 cmd.ExecuteNonQuery();
84 UUID princUUID = UUID.Zero;
86 bool ret = UUID.TryParse(principalID, out princUUID);
89 return GetFriends(princUUID);
96 using (NpgsqlConnection conn =
new NpgsqlConnection(m_ConnectionString))
97 using (NpgsqlCommand cmd =
new NpgsqlCommand())
100 cmd.CommandText = String.Format(
"select a.*,case when b.\"Flags\" is null then '-1' else b.\"Flags\" end as \"TheirFlags\" from {0} as a " +
101 " left join {0} as b on a.\"PrincipalID\" = b.\"Friend\" and a.\"Friend\" = b.\"PrincipalID\" " +
102 " where a.\"PrincipalID\" = :PrincipalID", m_Realm);
103 cmd.Parameters.Add(m_database.CreateParameter(
"PrincipalID", principalID.ToString()));
104 cmd.Connection = conn;
112 return GetFriends(principalID);
override bool Delete(string principalID, string friend)
FriendsData[] GetFriends(Guid principalID)
PGSQLFriendsData(string connectionString, string realm)
An interface for connecting to the friends datastore
bool Delete(UUID principalID, string friend)
FriendsData[] GetFriends(UUID principalID)
FriendsData[] GetFriends(string principalID)