diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/IFriendsData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLFriendsData.cs | 5 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFriendsData.cs | 17 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullFriendsData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteFriendsData.cs | 5 |
5 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Data/IFriendsData.cs b/OpenSim/Data/IFriendsData.cs index 52e7f14..3fdf87b 100644 --- a/OpenSim/Data/IFriendsData.cs +++ b/OpenSim/Data/IFriendsData.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Data | |||
46 | { | 46 | { |
47 | bool Store(FriendsData data); | 47 | bool Store(FriendsData data); |
48 | bool Delete(UUID ownerID, string friend); | 48 | bool Delete(UUID ownerID, string friend); |
49 | bool Delete(string ownerID, string friend); | ||
49 | FriendsData[] GetFriends(UUID principalID); | 50 | FriendsData[] GetFriends(UUID principalID); |
50 | FriendsData[] GetFriends(string principalID); | 51 | FriendsData[] GetFriends(string principalID); |
51 | } | 52 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs index ba1b085..0b178f1 100644 --- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs +++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs | |||
@@ -52,6 +52,11 @@ namespace OpenSim.Data.MSSQL | |||
52 | 52 | ||
53 | public bool Delete(UUID principalID, string friend) | 53 | public bool Delete(UUID principalID, string friend) |
54 | { | 54 | { |
55 | return Delete(principalID.ToString(), friend); | ||
56 | } | ||
57 | |||
58 | public bool Delete(string principalID, string friend) | ||
59 | { | ||
55 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 60 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) |
56 | using (SqlCommand cmd = new SqlCommand()) | 61 | using (SqlCommand cmd = new SqlCommand()) |
57 | { | 62 | { |
diff --git a/OpenSim/Data/MySQL/MySQLFriendsData.cs b/OpenSim/Data/MySQL/MySQLFriendsData.cs index 69fac9d..130ba5e 100644 --- a/OpenSim/Data/MySQL/MySQLFriendsData.cs +++ b/OpenSim/Data/MySQL/MySQLFriendsData.cs | |||
@@ -44,6 +44,11 @@ namespace OpenSim.Data.MySQL | |||
44 | 44 | ||
45 | public bool Delete(UUID principalID, string friend) | 45 | public bool Delete(UUID principalID, string friend) |
46 | { | 46 | { |
47 | return Delete(principalID.ToString(), friend); | ||
48 | } | ||
49 | |||
50 | public bool Delete(string principalID, string friend) | ||
51 | { | ||
47 | MySqlCommand cmd = new MySqlCommand(); | 52 | MySqlCommand cmd = new MySqlCommand(); |
48 | 53 | ||
49 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); | 54 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm); |
@@ -57,16 +62,20 @@ namespace OpenSim.Data.MySQL | |||
57 | 62 | ||
58 | public FriendsData[] GetFriends(UUID principalID) | 63 | public FriendsData[] GetFriends(UUID principalID) |
59 | { | 64 | { |
60 | return GetFriends(principalID.ToString()); | 65 | MySqlCommand cmd = new MySqlCommand(); |
66 | |||
67 | 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); | ||
68 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | ||
69 | |||
70 | return DoQuery(cmd); | ||
61 | } | 71 | } |
62 | 72 | ||
63 | public FriendsData[] GetFriends(string principalID) | 73 | public FriendsData[] GetFriends(string principalID) |
64 | { | 74 | { |
65 | MySqlCommand cmd = new MySqlCommand(); | 75 | MySqlCommand cmd = new MySqlCommand(); |
66 | 76 | ||
67 | 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); | 77 | 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 LIKE ?PrincipalID", m_Realm); |
68 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | 78 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%'); |
69 | |||
70 | return DoQuery(cmd); | 79 | return DoQuery(cmd); |
71 | } | 80 | } |
72 | } | 81 | } |
diff --git a/OpenSim/Data/Null/NullFriendsData.cs b/OpenSim/Data/Null/NullFriendsData.cs index 2bfdc7a..d90788a 100644 --- a/OpenSim/Data/Null/NullFriendsData.cs +++ b/OpenSim/Data/Null/NullFriendsData.cs | |||
@@ -77,7 +77,12 @@ namespace OpenSim.Data.Null | |||
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | 79 | ||
80 | public bool Delete(UUID userID, string friendID) | 80 | public bool Delete(UUID principalID, string friend) |
81 | { | ||
82 | return Delete(principalID.ToString(), friend); | ||
83 | } | ||
84 | |||
85 | public bool Delete(string userID, string friendID) | ||
81 | { | 86 | { |
82 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); }); | 87 | List<FriendsData> lst = m_Data.FindAll(delegate(FriendsData fdata) { return fdata.PrincipalID == userID.ToString(); }); |
83 | if (lst != null) | 88 | if (lst != null) |
diff --git a/OpenSim/Data/SQLite/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs index d925412..b14c348 100644 --- a/OpenSim/Data/SQLite/SQLiteFriendsData.cs +++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs | |||
@@ -64,6 +64,11 @@ namespace OpenSim.Data.SQLite | |||
64 | 64 | ||
65 | public bool Delete(UUID principalID, string friend) | 65 | public bool Delete(UUID principalID, string friend) |
66 | { | 66 | { |
67 | return Delete(principalID.ToString(), friend); | ||
68 | } | ||
69 | |||
70 | public bool Delete(string principalID, string friend) | ||
71 | { | ||
67 | SqliteCommand cmd = new SqliteCommand(); | 72 | SqliteCommand cmd = new SqliteCommand(); |
68 | 73 | ||
69 | 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); |