aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteUserData.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index f847ba9..4beae07 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -117,6 +117,13 @@ namespace OpenSim.Data.SQLite
117 117
118 setupUserFriendsCommands(daf, conn); 118 setupUserFriendsCommands(daf, conn);
119 daf.Fill(ds.Tables["userfriends"]); 119 daf.Fill(ds.Tables["userfriends"]);
120
121 string Unique = "create unique index friend_unique on userfriends (ownerID,friendID)";
122 using (SqliteCommand cmd = new SqliteCommand(Unique, g_conn))
123 {
124 cmd.ExecuteNonQuery();
125 }
126
120 } 127 }
121 128
122 return; 129 return;
@@ -210,8 +217,7 @@ namespace OpenSim.Data.SQLite
210 /// <param name="perms">permission flag</param> 217 /// <param name="perms">permission flag</param>
211 override public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) 218 override public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
212 { 219 {
213 string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; 220 string InsertFriends = "insert or ignore into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
214
215 using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn)) 221 using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn))
216 { 222 {
217 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString())); 223 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString()));
@@ -235,7 +241,7 @@ namespace OpenSim.Data.SQLite
235 /// <param name="friend">UUID of the friend to remove</param> 241 /// <param name="friend">UUID of the friend to remove</param>
236 override public void RemoveUserFriend(UUID friendlistowner, UUID friend) 242 override public void RemoveUserFriend(UUID friendlistowner, UUID friend)
237 { 243 {
238 string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)"; 244 string DeletePerms = "delete from userfriends where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
239 using (SqliteCommand cmd = new SqliteCommand(DeletePerms, g_conn)) 245 using (SqliteCommand cmd = new SqliteCommand(DeletePerms, g_conn))
240 { 246 {
241 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString())); 247 cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString()));
@@ -252,7 +258,7 @@ namespace OpenSim.Data.SQLite
252 /// <param name="perms">updated permission flag</param> 258 /// <param name="perms">updated permission flag</param>
253 override public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) 259 override public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
254 { 260 {
255 string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID"; 261 string UpdatePerms = "update userfriends set friendPerms=:perms where ownerID=:ownerID and friendID=:friendID";
256 using (SqliteCommand cmd = new SqliteCommand(UpdatePerms, g_conn)) 262 using (SqliteCommand cmd = new SqliteCommand(UpdatePerms, g_conn))
257 { 263 {
258 cmd.Parameters.Add(new SqliteParameter(":perms", perms)); 264 cmd.Parameters.Add(new SqliteParameter(":perms", perms));