From 98687df56b00c252cae4aacafd364c8dd8c4fe17 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 24 Jul 2009 20:39:46 +0000 Subject: [PATCH] * Apply http://opensimulator.org/mantis/view.php?id=3586 * Make MSSQL current in NHibernate * Thanks mpallari --- .../MsSql2005Dialect/002_RegionStore.sql | 51 +++++++++++++++++++ .../MsSql2005Dialect/002_UserStore.sql | 27 ++++++++++ OpenSim/Data/NHibernate/SByteType.cs | 11 +++- 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_RegionStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_UserStore.sql diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_RegionStore.sql new file mode 100644 index 0000000000..dfaac6e78e --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_RegionStore.sql @@ -0,0 +1,51 @@ +ALTER TABLE Prims ADD LinkNum INT null; +ALTER TABLE Prims ADD Material TINYINT null; +ALTER TABLE Prims ADD ScriptAccessPin INT null; +ALTER TABLE Prims ADD TextureAnimation VARBINARY(max) null; +ALTER TABLE Prims ADD ParticleSystem VARBINARY(max) null; +ALTER TABLE Prims ADD ClickAction TINYINT null; +ALTER TABLE Prims ADD Color INT null; + +CREATE TABLE RegionSettings +( + RegionID NVARCHAR(255) NOT NULL, + BlockTerraform bit NOT NULL, + BlockFly bit NOT NULL, + AllowDamage bit NOT NULL, + RestrictPushing bit NOT NULL, + AllowLandResell bit NOT NULL, + AllowLandJoinDivide bit NOT NULL, + BlockShowInSearch bit NOT NULL, + AgentLimit int NOT NULL, + ObjectBonus float(53) NOT NULL, + Maturity int NOT NULL, + DisableScripts bit NOT NULL, + DisableCollisions bit NOT NULL, + DisablePhysics bit NOT NULL, + TerrainTexture1 NVARCHAR(36) NOT NULL, + TerrainTexture2 NVARCHAR(36) NOT NULL, + TerrainTexture3 NVARCHAR(36) NOT NULL, + TerrainTexture4 NVARCHAR(36) NOT NULL, + Elevation1NW float(53) NOT NULL, + Elevation2NW float(53) NOT NULL, + Elevation1NE float(53) NOT NULL, + Elevation2NE float(53) NOT NULL, + Elevation1SE float(53) NOT NULL, + Elevation2SE float(53) NOT NULL, + Elevation1SW float(53) NOT NULL, + Elevation2SW float(53) NOT NULL, + WaterHeight float(53) NOT NULL, + TerrainRaiseLimit float(53) NOT NULL, + TerrainLowerLimit float(53) NOT NULL, + UseEstateSun bit NOT NULL, + FixedSun bit NOT NULL, + SunPosition float(53) NOT NULL, + Covenant NVARCHAR(36) NULL DEFAULT (NULL), + Sandbox bit NOT NULL, + SunVectorX float(53) NOT NULL DEFAULT ((0)), + SunVectorY float(53) NOT NULL DEFAULT ((0)), + SunVectorZ float(53) NOT NULL DEFAULT ((0)), + + primary key (RegionID) +) + diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_UserStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_UserStore.sql new file mode 100644 index 0000000000..f5e0c00a1b --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/002_UserStore.sql @@ -0,0 +1,27 @@ +ALTER TABLE UserAgents ADD PositionX REAL null; +ALTER TABLE UserAgents ADD PositionY REAL null; +ALTER TABLE UserAgents ADD PositionZ REAL null; +ALTER TABLE UserAgents ADD LookAtX REAL null; +ALTER TABLE UserAgents ADD LookAtY REAL null; +ALTER TABLE UserAgents ADD LookAtZ REAL null; + +ALTER TABLE UserProfiles ADD Email NVARCHAR(250) null; +ALTER TABLE UserProfiles ADD HomeRegionID NVARCHAR(36) null; +ALTER TABLE UserProfiles ADD CanDoMask INT null; +ALTER TABLE UserProfiles ADD WantDoMask INT null; +ALTER TABLE UserProfiles ADD UserFlags INT null; +ALTER TABLE UserProfiles ADD GodLevel INT null; +ALTER TABLE UserProfiles ADD CustomType NVARCHAR(32) null; +ALTER TABLE UserProfiles ADD Partner NVARCHAR(36) null; + +ALTER TABLE UserAppearances ADD AvatarHeight FLOAT null; + +CREATE TABLE UserFriends ( + UserFriendID NVARCHAR(36) NOT NULL, + OwnerID NVARCHAR(36) NULL, + FriendID NVARCHAR(36) NULL, + FriendPermissions INT NULL, + PRIMARY KEY (UserFriendID) +); + +CREATE INDEX UserFriendsOwnerIdFriendIdIndex ON UserFriends (OwnerID,FriendID); diff --git a/OpenSim/Data/NHibernate/SByteType.cs b/OpenSim/Data/NHibernate/SByteType.cs index b2bbe74f82..92ab0ba83f 100644 --- a/OpenSim/Data/NHibernate/SByteType.cs +++ b/OpenSim/Data/NHibernate/SByteType.cs @@ -73,7 +73,16 @@ namespace OpenSim.Data.NHibernate int ord = rs.GetOrdinal(names[0]); if (!rs.IsDBNull(ord)) { - sbyte1 = Convert.ToSByte(rs.GetInt16(ord)); + object tempO = rs.GetValue(ord); + if (tempO is Byte) + { + sbyte1 = Convert.ToSByte(((byte)tempO)); + } + else + { + short temp = rs.GetInt16(ord); + sbyte1 = Convert.ToSByte(temp); + } } return sbyte1; }