MSSQL tweaks for latest ROBUST - friends handling fixed, GridUserData placeholder added.
Signed-off-by: Melanie <melanie@t-data.com>slimupdates
							parent
							
								
									9ea6509a1c
								
							
						
					
					
						commit
						c135235000
					
				| 
						 | 
				
			
			@ -72,7 +72,7 @@ namespace OpenSim.Data.MSSQL
 | 
			
		|||
            using (SqlCommand cmd = new SqlCommand())
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                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);
 | 
			
		||||
                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);
 | 
			
		||||
                cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
 | 
			
		||||
                cmd.Connection = conn;
 | 
			
		||||
                conn.Open();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) Contributors, http://opensimulator.org/
 | 
			
		||||
 * See CONTRIBUTORS.TXT for a full list of copyright holders.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions are met:
 | 
			
		||||
 *     * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *       notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *     * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *       notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *       documentation and/or other materials provided with the distribution.
 | 
			
		||||
 *     * Neither the name of the OpenSimulator Project nor the
 | 
			
		||||
 *       names of its contributors may be used to endorse or promote products
 | 
			
		||||
 *       derived from this software without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
 | 
			
		||||
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 | 
			
		||||
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
 | 
			
		||||
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 | 
			
		||||
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 | 
			
		||||
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 | 
			
		||||
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using log4net;
 | 
			
		||||
using OpenMetaverse;
 | 
			
		||||
using OpenSim.Framework;
 | 
			
		||||
using System.Data.SqlClient;
 | 
			
		||||
 | 
			
		||||
namespace OpenSim.Data.MSSQL
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// A MSSQL Interface for Avatar Storage
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>,
 | 
			
		||||
            IGridUserData
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
 | 
			
		||||
        public MSSQLGridUserData(string connectionString, string realm) :
 | 
			
		||||
            base(connectionString, realm, "UserGrid")
 | 
			
		||||
        {            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public GridUserData GetGridUserData(string userID)
 | 
			
		||||
        {
 | 
			
		||||
            GridUserData[] ret = Get("UserID", userID);
 | 
			
		||||
 | 
			
		||||
            if (ret.Length == 0)
 | 
			
		||||
                return null;
 | 
			
		||||
 | 
			
		||||
            return ret[0];
 | 
			
		||||
        }   
 | 
			
		||||
 | 
			
		||||
        public bool StoreGridUserData(GridUserData data)
 | 
			
		||||
        {
 | 
			
		||||
            return Store(data);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ BEGIN TRANSACTION
 | 
			
		|||
 | 
			
		||||
CREATE TABLE [Friends] (
 | 
			
		||||
[PrincipalID] uniqueidentifier NOT NULL, 
 | 
			
		||||
[FriendID] varchar(255) NOT NULL, 
 | 
			
		||||
[Friend] varchar(255) NOT NULL, 
 | 
			
		||||
[Flags] char(16) NOT NULL DEFAULT '0',
 | 
			
		||||
[Offered] varchar(32) NOT NULL DEFAULT 0)
 | 
			
		||||
 ON [PRIMARY]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
CREATE TABLE [UserAccounts] (
 | 
			
		||||
  [PrincipalID] uniqueidentifier NOT NULL,
 | 
			
		||||
  [ScopeID] uniqueidentifier NOT NULL,
 | 
			
		||||
  [FirstName] [varchar](64) NOT NULL,
 | 
			
		||||
  [LastName] [varchar](64) NOT NULL,
 | 
			
		||||
  [Email] [varchar](64) NULL,
 | 
			
		||||
  [ServiceURLs] [text] NULL,
 | 
			
		||||
  [Created] [int] default NULL,
 | 
			
		||||
  
 | 
			
		||||
  PRIMARY KEY CLUSTERED
 | 
			
		||||
(
 | 
			
		||||
	[PrincipalID] ASC
 | 
			
		||||
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
 | 
			
		||||
) ON [PRIMARY]
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
BEGIN TRANSACTION
 | 
			
		||||
 | 
			
		||||
INSERT INTO Friends (PrincipalID, FriendID, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
 | 
			
		||||
INSERT INTO Friends (PrincipalID, Friend, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COMMIT
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
BEGIN TRANSACTION
 | 
			
		||||
 | 
			
		||||
CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID);
 | 
			
		||||
CREATE INDEX Email ON UserAccounts(Email);
 | 
			
		||||
CREATE INDEX FirstName ON UserAccounts(FirstName);
 | 
			
		||||
CREATE INDEX LastName ON UserAccounts(LastName);
 | 
			
		||||
CREATE INDEX Name ON UserAccounts(FirstName,LastName);
 | 
			
		||||
 | 
			
		||||
COMMIT
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
BEGIN TRANSACTION
 | 
			
		||||
 | 
			
		||||
ALTER TABLE UserAccounts ADD UserLevel integer NOT NULL DEFAULT 0;
 | 
			
		||||
ALTER TABLE UserAccounts ADD UserFlags integer NOT NULL DEFAULT 0;
 | 
			
		||||
ALTER TABLE UserAccounts ADD UserTitle varchar(64) NOT NULL DEFAULT '';
 | 
			
		||||
 | 
			
		||||
COMMIT
 | 
			
		||||
		Loading…
	
		Reference in New Issue