From a27352010a0d0ae13b5beeac0132474e3ca6ac03 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Tue, 14 Oct 2008 19:00:43 +0000
Subject: Merge commit 'arthur/master'
---
OpenSim/Data/SQLite/SQLiteUserData.cs | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Data/SQLite/SQLiteUserData.cs')
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
setupUserFriendsCommands(daf, conn);
daf.Fill(ds.Tables["userfriends"]);
+
+ string Unique = "create unique index friend_unique on userfriends (ownerID,friendID)";
+ using (SqliteCommand cmd = new SqliteCommand(Unique, g_conn))
+ {
+ cmd.ExecuteNonQuery();
+ }
+
}
return;
@@ -210,8 +217,7 @@ namespace OpenSim.Data.SQLite
/// permission flag
override public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{
- string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
-
+ string InsertFriends = "insert or ignore into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn))
{
cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString()));
@@ -235,7 +241,7 @@ namespace OpenSim.Data.SQLite
/// UUID of the friend to remove
override public void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
- string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
+ string DeletePerms = "delete from userfriends where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
using (SqliteCommand cmd = new SqliteCommand(DeletePerms, g_conn))
{
cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.ToString()));
@@ -252,7 +258,7 @@ namespace OpenSim.Data.SQLite
/// updated permission flag
override public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
- string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID";
+ string UpdatePerms = "update userfriends set friendPerms=:perms where ownerID=:ownerID and friendID=:friendID";
using (SqliteCommand cmd = new SqliteCommand(UpdatePerms, g_conn))
{
cmd.Parameters.Add(new SqliteParameter(":perms", perms));
--
cgit v1.1