aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorunknown2010-03-07 23:20:23 +0000
committerMelanie2010-03-09 18:37:08 +0000
commitc1352350004064a1722c2aeaaff313c4cc51181a (patch)
treef265aa0672585567210ff5650b17589c5093b727 /OpenSim/Data
parentComment a debug message that is a tad too spammy (diff)
downloadopensim-SC_OLD-c1352350004064a1722c2aeaaff313c4cc51181a.zip
opensim-SC_OLD-c1352350004064a1722c2aeaaff313c4cc51181a.tar.gz
opensim-SC_OLD-c1352350004064a1722c2aeaaff313c4cc51181a.tar.bz2
opensim-SC_OLD-c1352350004064a1722c2aeaaff313c4cc51181a.tar.xz
MSSQL tweaks for latest ROBUST - friends handling fixed, GridUserData placeholder added.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLFriendsData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridUserData.cs68
-rw-r--r--OpenSim/Data/MSSQL/Resources/001_FriendsStore.sql2
-rw-r--r--OpenSim/Data/MSSQL/Resources/001_UserAccount.sql14
-rw-r--r--OpenSim/Data/MSSQL/Resources/002_FriendsStore.sql2
-rw-r--r--OpenSim/Data/MSSQL/Resources/003_UserAccount.sql9
-rw-r--r--OpenSim/Data/MSSQL/Resources/004_UserAccount.sql7
7 files changed, 101 insertions, 3 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
index 34da943..af4fd9b 100644
--- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Data.MSSQL
72 using (SqlCommand cmd = new SqlCommand()) 72 using (SqlCommand cmd = new SqlCommand())
73 { 73 {
74 74
75 cmd.CommandText = String.Format("select a.*,b.Flags 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 and b.Flags is not null", m_Realm); 75 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);
76 cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString())); 76 cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
77 cmd.Connection = conn; 77 cmd.Connection = conn;
78 conn.Open(); 78 conn.Open();
diff --git a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs
new file mode 100644
index 0000000..b4a945c
--- /dev/null
+++ b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs
@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Data;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using OpenMetaverse;
35using OpenSim.Framework;
36using System.Data.SqlClient;
37
38namespace OpenSim.Data.MSSQL
39{
40 /// <summary>
41 /// A MSSQL Interface for Avatar Storage
42 /// </summary>
43 public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>,
44 IGridUserData
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 public MSSQLGridUserData(string connectionString, string realm) :
49 base(connectionString, realm, "UserGrid")
50 {
51 }
52
53 public GridUserData GetGridUserData(string userID)
54 {
55 GridUserData[] ret = Get("UserID", userID);
56
57 if (ret.Length == 0)
58 return null;
59
60 return ret[0];
61 }
62
63 public bool StoreGridUserData(GridUserData data)
64 {
65 return Store(data);
66 }
67 }
68}
diff --git a/OpenSim/Data/MSSQL/Resources/001_FriendsStore.sql b/OpenSim/Data/MSSQL/Resources/001_FriendsStore.sql
index f6480f7..94d240b 100644
--- a/OpenSim/Data/MSSQL/Resources/001_FriendsStore.sql
+++ b/OpenSim/Data/MSSQL/Resources/001_FriendsStore.sql
@@ -2,7 +2,7 @@ BEGIN TRANSACTION
2 2
3CREATE TABLE [Friends] ( 3CREATE TABLE [Friends] (
4[PrincipalID] uniqueidentifier NOT NULL, 4[PrincipalID] uniqueidentifier NOT NULL,
5[FriendID] varchar(255) NOT NULL, 5[Friend] varchar(255) NOT NULL,
6[Flags] char(16) NOT NULL DEFAULT '0', 6[Flags] char(16) NOT NULL DEFAULT '0',
7[Offered] varchar(32) NOT NULL DEFAULT 0) 7[Offered] varchar(32) NOT NULL DEFAULT 0)
8 ON [PRIMARY] 8 ON [PRIMARY]
diff --git a/OpenSim/Data/MSSQL/Resources/001_UserAccount.sql b/OpenSim/Data/MSSQL/Resources/001_UserAccount.sql
new file mode 100644
index 0000000..3dbf8a4
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/001_UserAccount.sql
@@ -0,0 +1,14 @@
1CREATE TABLE [UserAccounts] (
2 [PrincipalID] uniqueidentifier NOT NULL,
3 [ScopeID] uniqueidentifier NOT NULL,
4 [FirstName] [varchar](64) NOT NULL,
5 [LastName] [varchar](64) NOT NULL,
6 [Email] [varchar](64) NULL,
7 [ServiceURLs] [text] NULL,
8 [Created] [int] default NULL,
9
10 PRIMARY KEY CLUSTERED
11(
12 [PrincipalID] ASC
13)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
14) ON [PRIMARY]
diff --git a/OpenSim/Data/MSSQL/Resources/002_FriendsStore.sql b/OpenSim/Data/MSSQL/Resources/002_FriendsStore.sql
index 7762a26..e67d20e 100644
--- a/OpenSim/Data/MSSQL/Resources/002_FriendsStore.sql
+++ b/OpenSim/Data/MSSQL/Resources/002_FriendsStore.sql
@@ -1,6 +1,6 @@
1BEGIN TRANSACTION 1BEGIN TRANSACTION
2 2
3INSERT INTO Friends (PrincipalID, FriendID, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends; 3INSERT INTO Friends (PrincipalID, Friend, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
4 4
5 5
6COMMIT \ No newline at end of file 6COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/003_UserAccount.sql b/OpenSim/Data/MSSQL/Resources/003_UserAccount.sql
new file mode 100644
index 0000000..da0395b
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/003_UserAccount.sql
@@ -0,0 +1,9 @@
1BEGIN TRANSACTION
2
3CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID);
4CREATE INDEX Email ON UserAccounts(Email);
5CREATE INDEX FirstName ON UserAccounts(FirstName);
6CREATE INDEX LastName ON UserAccounts(LastName);
7CREATE INDEX Name ON UserAccounts(FirstName,LastName);
8
9COMMIT \ No newline at end of file
diff --git a/OpenSim/Data/MSSQL/Resources/004_UserAccount.sql b/OpenSim/Data/MSSQL/Resources/004_UserAccount.sql
new file mode 100644
index 0000000..a9a9021
--- /dev/null
+++ b/OpenSim/Data/MSSQL/Resources/004_UserAccount.sql
@@ -0,0 +1,7 @@
1BEGIN TRANSACTION
2
3ALTER TABLE UserAccounts ADD UserLevel integer NOT NULL DEFAULT 0;
4ALTER TABLE UserAccounts ADD UserFlags integer NOT NULL DEFAULT 0;
5ALTER TABLE UserAccounts ADD UserTitle varchar(64) NOT NULL DEFAULT '';
6
7COMMIT \ No newline at end of file