From bdee86563cfce5211f182b78e64503a05fc7ffa1 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 4 Dec 2008 20:48:08 +0000 Subject: * Check in another patch from http://opensimulator.org/mantis/view.php?id=2710 * This allows removal of the old NHiberate.Mapping.Attributes.dll * Also add in the files I forgot about last time. Doh! --- OpenSim/Data/NHibernate/NHibernateAssetData.cs | 1 - OpenSim/Data/NHibernate/NHibernateManager.cs | 6 -- .../Resources/MySQLDialect/001_GridStore.sql | 32 +++++++ .../Resources/OpenSim.Data.NHibernate.addin.xml | 23 +++++ .../Resources/SQLiteDialect/001_GridStore.sql | 38 ++++++++ .../Resources/SQLiteDialect/001_RegionStore.sql | 102 ++++++++++++++++++++ .../Resources/SQLiteDialect/001_UserStore.sql | 79 ++++++++++++++++ OpenSim/Data/NHibernate/SByteType.cs | 104 ++++++++++++++++++++ OpenSim/Data/NHibernate/UInt16Type.cs | 105 +++++++++++++++++++++ OpenSim/Data/NHibernate/UInt32Type.cs | 105 +++++++++++++++++++++ OpenSim/Data/NHibernate/UInt64Type.cs | 105 +++++++++++++++++++++ prebuild.xml | 1 - 12 files changed, 693 insertions(+), 8 deletions(-) create mode 100644 OpenSim/Data/NHibernate/Resources/MySQLDialect/001_GridStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/OpenSim.Data.NHibernate.addin.xml create mode 100644 OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql create mode 100644 OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql create mode 100644 OpenSim/Data/NHibernate/SByteType.cs create mode 100644 OpenSim/Data/NHibernate/UInt16Type.cs create mode 100644 OpenSim/Data/NHibernate/UInt32Type.cs create mode 100644 OpenSim/Data/NHibernate/UInt64Type.cs diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 90d41e3..e1d074f 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs @@ -33,7 +33,6 @@ using System.Text.RegularExpressions; using OpenMetaverse; using log4net; using NHibernate; -using NHibernate.Mapping.Attributes; using OpenSim.Framework; using Environment=NHibernate.Cfg.Environment; diff --git a/OpenSim/Data/NHibernate/NHibernateManager.cs b/OpenSim/Data/NHibernate/NHibernateManager.cs index 36d84e2..46840ac 100644 --- a/OpenSim/Data/NHibernate/NHibernateManager.cs +++ b/OpenSim/Data/NHibernate/NHibernateManager.cs @@ -31,7 +31,6 @@ using System.IO; using log4net; using NHibernate; using NHibernate.Cfg; -using NHibernate.Mapping.Attributes; using NHibernate.Tool.hbm2ddl; using OpenMetaverse; using Environment = NHibernate.Cfg.Environment; @@ -77,11 +76,6 @@ namespace OpenSim.Data.NHibernate //exp.SetOutputFile("nameofthefile.sql"); //exp.Create(false, true); - HbmSerializer.Default.Validate = true; - using (MemoryStream stream = - HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) - cfg.AddInputStream(stream); - factory = cfg.BuildSessionFactory(); session = factory.OpenSession(); diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_GridStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_GridStore.sql new file mode 100644 index 0000000..df09603 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_GridStore.sql @@ -0,0 +1,32 @@ +CREATE TABLE `regions` ( + `Uuid` varchar(36) NOT NULL, + `RegionHandle` bigint(20) unsigned NOT NULL, + `RegionName` varchar(32) default NULL, + `RegionRecvKey` varchar(128) default NULL, + `RegionSendKey` varchar(128) default NULL, + `RegionSecret` varchar(128) default NULL, + `RegionDataURI` varchar(255) default NULL, + `ServerIP` varchar(64) default NULL, + `ServerPort` int(10) unsigned default NULL, + `ServerURI` varchar(255) default NULL, + `RegionLocX` int(10) unsigned default NULL, + `RegionLocY` int(10) unsigned default NULL, + `RegionLocZ` int(10) unsigned default NULL, + `EastOverrideHandle` bigint(20) unsigned default NULL, + `WestOverrideHandle` bigint(20) unsigned default NULL, + `SouthOverrideHandle` bigint(20) unsigned default NULL, + `NorthOverrideHandle` bigint(20) unsigned default NULL, + `RegionAssetURI` varchar(255) default NULL, + `RegionAssetRecvKey` varchar(128) default NULL, + `RegionAssetSendKey` varchar(128) default NULL, + `RegionUserURI` varchar(255) default NULL, + `RegionUserRecvKey` varchar(128) default NULL, + `RegionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, + `ServerHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, + `Owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null, + `OriginUUID` varchar(36), + PRIMARY KEY (`uuid`), + KEY `region_name` (`RegionName`), + KEY `region_handle` (`RegionHandle`), + KEY `overrideHandles` (`EastOverrideHandle`,`WestOverrideHandle`,`SouthOverrideHandle`,`NorthOverrideHandle`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 3'; \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/Resources/OpenSim.Data.NHibernate.addin.xml b/OpenSim/Data/NHibernate/Resources/OpenSim.Data.NHibernate.addin.xml new file mode 100644 index 0000000..37b23cb --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/OpenSim.Data.NHibernate.addin.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql new file mode 100644 index 0000000..1cb18e3 --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_GridStore.sql @@ -0,0 +1,38 @@ +BEGIN TRANSACTION; + +create table Regions ( + Uuid NVARCHAR(255) not null, + RegionHandle BIGINT null, + RegionName NVARCHAR(32) null, + RegionRecvKey NVARCHAR(128) null, + RegionSendKey NVARCHAR(128) null, + RegionSecret NVARCHAR(128) null, + RegionDataURI NVARCHAR(255) null, + ServerIP NVARCHAR(64) null, + ServerPort INT null, + ServerURI NVARCHAR(255) null, + RegionLocX INT null, + RegionLocY INT null, + RegionLocZ INT null, + EastOverrideHandle BIGINT null, + WestOverrideHandle BIGINT null, + SouthOverrideHandle BIGINT null, + NorthOverrideHandle BIGINT null, + RegionAssetURI NVARCHAR(255) null, + RegionAssetRecvKey NVARCHAR(128) null, + RegionAssetSendKey NVARCHAR(128) null, + RegionUserURI NVARCHAR(255) null, + RegionUserRecvKey NVARCHAR(128) null, + RegionUserSendKey NVARCHAR(128) null, + ServerHttpPort INT null, + ServerRemotingPort INT null, + RegionMapTextureID NVARCHAR(255) null, + Owner_uuid NVARCHAR(255) null, + OriginUUID NVARCHAR(255) null, + primary key (Uuid) +); + +create index region_handle on Regions (RegionHandle); +create index region_name on Regions (RegionName); + +COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql new file mode 100644 index 0000000..d557b9a --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql @@ -0,0 +1,102 @@ +BEGIN TRANSACTION; + +create table Prims ( + UUID TEXT not null, + ParentID INTEGER, + ParentUUID TEXT, + RegionID TEXT, + CreationDate INTEGER, + Name TEXT, + Text TEXT, + Description TEXT, + SitName TEXT, + TouchName TEXT, + ObjectFlags INTEGER, + CreatorID TEXT, + OwnerID TEXT, + GroupID TEXT, + LastOwnerID TEXT, + OwnerMask INTEGER, + NextOwnerMask INTEGER, + GroupMask INTEGER, + EveryoneMask INTEGER, + BaseMask INTEGER, + PositionX NUMERIC, + PositionY NUMERIC, + PositionZ NUMERIC, + GroupPositionX NUMERIC, + GroupPositionY NUMERIC, + GroupPositionZ NUMERIC, + VelocityX NUMERIC, + VelocityY NUMERIC, + VelocityZ NUMERIC, + AngularVelocityX NUMERIC, + AngularVelocityY NUMERIC, + AngularVelocityZ NUMERIC, + AccelerationX NUMERIC, + AccelerationY NUMERIC, + AccelerationZ NUMERIC, + SitTargetOffsetX NUMERIC, + SitTargetOffsetY NUMERIC, + SitTargetOffsetZ NUMERIC, + RotationX NUMERIC, + RotationY NUMERIC, + RotationZ NUMERIC, + RotationW NUMERIC, + SitTargetOrientX NUMERIC, + SitTargetOrientY NUMERIC, + SitTargetOrientZ NUMERIC, + SitTargetOrientW NUMERIC, + ScaleX NUMERIC, + ScaleY NUMERIC, + ScaleZ NUMERIC, + PCode INTEGER, + PathBegin INTEGER, + PathEnd INTEGER, + PathScaleX INTEGER, + PathScaleY INTEGER, + PathShearX INTEGER, + PathShearY INTEGER, + PathSkew INTEGER, + PathCurve INTEGER, + PathRadiusOffset INTEGER, + PathRevolutions INTEGER, + PathTaperX INTEGER, + PathTwist INTEGER, + ProfileBegin INTEGER, + ProfileEnd INTEGER, + ProfileCurve INTEGER, + ProfileHollow INTEGER, + Texture BLOB, + ExtraParams BLOB, + State INTEGER, + primary key (UUID) +); +create table Terrain ( + RegionID TEXT not null, + MapData BLOB, + primary key (RegionID) +); +create table PrimItems ( + ItemID TEXT not null, + PrimID TEXT, + AssetID TEXT, + ParentFolderID TEXT, + CreatorID TEXT, + OwnerID TEXT, + GroupID TEXT, + LastOwnerID TEXT, + CurrentPermissions INTEGER, + BasePermissions INTEGER, + EveryonePermissions INTEGER, + GroupPermissions INTEGER, + NextPermissions INTEGER, + Name TEXT, + Description TEXT, + CreationDate INTEGER, + Flags INTEGER, + InvType INTEGER, + primary key (ItemID) +); + +COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql new file mode 100644 index 0000000..8d1ba5c --- /dev/null +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql @@ -0,0 +1,79 @@ +BEGIN TRANSACTION; + +create table UserAgents ( + ProfileID TEXT not null, + AgentIP TEXT, + AgentPort INTEGER, + AgentOnline INTEGER, + SessionID TEXT, + SecureSessionID TEXT, + InitialRegion TEXT, + Region TEXT, + LoginTime INTEGER, + LogoutTime INTEGER, + Handle INTEGER, + primary key (ProfileID) +); +create table UserProfiles ( + ID TEXT not null, + FirstName TEXT, + SurName TEXT, + PasswordHash TEXT, + PasswordSalt TEXT, + WebLoginKey TEXT, + HomeRegionX INTEGER, + HomeRegionY INTEGER, + HomeLocationX NUMERIC, + HomeLocationY NUMERIC, + HomeLocationZ NUMERIC, + HomeLookAtX NUMERIC, + HomeLookAtY NUMERIC, + HomeLookAtZ NUMERIC, + Created INTEGER, + LastLogin INTEGER, + RootInventoryFolderID TEXT, + UserInventoryURI TEXT, + UserAssetURI TEXT, + Image TEXT, + FirstLifeImage TEXT, + AboutText TEXT, + FirstLifeAboutText TEXT, + primary key (ID) +); +create table UserAppearances ( + Owner TEXT not null, + BodyItem TEXT, + BodyAsset TEXT, + SkinItem TEXT, + SkinAsset TEXT, + HairItem TEXT, + HairAsset TEXT, + EyesItem TEXT, + EyesAsset TEXT, + ShirtItem TEXT, + ShirtAsset TEXT, + PantsItem TEXT, + PantsAsset TEXT, + ShoesItem TEXT, + ShoesAsset TEXT, + SocksItem TEXT, + SocksAsset TEXT, + JacketItem TEXT, + JacketAsset TEXT, + GlovesItem TEXT, + GlovesAsset TEXT, + UnderShirtItem TEXT, + UnderShirtAsset TEXT, + UnderPantsItem TEXT, + UnderPantsAsset TEXT, + SkirtItem TEXT, + SkirtAsset TEXT, + Texture BLOB, + VisualParams BLOB, + Serial INTEGER, + primary key (Owner) +); +create index user_firstname on UserProfiles (FirstName); +create index user_surname on UserProfiles (SurName); + +COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/NHibernate/SByteType.cs b/OpenSim/Data/NHibernate/SByteType.cs new file mode 100644 index 0000000..0d8431d --- /dev/null +++ b/OpenSim/Data/NHibernate/SByteType.cs @@ -0,0 +1,104 @@ +/* + * 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 OpenSim 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.Data; +using OpenMetaverse; +using OpenSim.Framework; +using NHibernate; +using NHibernate.SqlTypes; +using NHibernate.UserTypes; + +namespace OpenSim.Data.NHibernate +{ + [Serializable] + public class SByteType: IUserType + { + public object Assemble(object cached, object owner) + { + return cached; + } + + bool IUserType.Equals(object sbyte1, object sbyte2) + { + return sbyte1.Equals(sbyte2); + } + + public object DeepCopy(object sbyte1) + { + return sbyte1; + } + + public object Disassemble(object sbyte1) + { + return sbyte1; + } + + public int GetHashCode(object sbyte1) + { + return (sbyte1 == null) ? 0 : sbyte1.GetHashCode(); + } + + public bool IsMutable + { + get { return false; } + } + + public object NullSafeGet(IDataReader rs, string[] names, object owner) + { + object sbyte1 = null; + + int ord = rs.GetOrdinal(names[0]); + if (!rs.IsDBNull(ord)) + { + sbyte1 = Convert.ToSByte(rs.GetInt16(ord)); + } + return sbyte1; + } + + public void NullSafeSet(IDbCommand cmd, object obj, int index) + { + sbyte b = (sbyte)obj; + ((IDataParameter)cmd.Parameters[index]).Value = Convert.ToInt16(b); + } + + public object Replace(object original, object target, object owner) + { + return original; + } + + public Type ReturnedType + { + get { return typeof(sbyte); } + } + + public SqlType[] SqlTypes + { + get { return new SqlType [] { NHibernateUtil.Byte.SqlType }; } + } + } +} diff --git a/OpenSim/Data/NHibernate/UInt16Type.cs b/OpenSim/Data/NHibernate/UInt16Type.cs new file mode 100644 index 0000000..b805288 --- /dev/null +++ b/OpenSim/Data/NHibernate/UInt16Type.cs @@ -0,0 +1,105 @@ +/* + * 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 OpenSim 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.Data; +using OpenMetaverse; +using OpenSim.Framework; +using NHibernate; +using NHibernate.SqlTypes; +using NHibernate.UserTypes; + +namespace OpenSim.Data.NHibernate +{ + [Serializable] + public class UInt16Type : IUserType + { + public object Assemble(object cached, object owner) + { + return cached; + } + + bool IUserType.Equals(object uint1, object uint2) + { + return uint1.Equals(uint2); + } + + public object DeepCopy(object uint1) + { + return uint1; + } + + public object Disassemble(object uint1) + { + return uint1; + } + + public int GetHashCode(object uint1) + { + return (uint1 == null) ? 0 : uint1.GetHashCode(); + } + + public bool IsMutable + { + get { return false; } + } + + public object NullSafeGet(IDataReader rs, string[] names, object owner) + { + object uint1 = null; + + int ord = rs.GetOrdinal(names[0]); + if (!rs.IsDBNull(ord)) + { + uint1 = (UInt16)rs.GetInt16(ord); + } + + return uint1; + } + + public void NullSafeSet(IDbCommand cmd, object obj, int index) + { + UInt16 uint1 = (UInt16)obj; + ((IDataParameter)cmd.Parameters[index]).Value = Convert.ToInt16(uint1); + } + + public object Replace(object original, object target, object owner) + { + return original; + } + + public Type ReturnedType + { + get { return typeof(UInt16); } + } + + public SqlType[] SqlTypes + { + get { return new SqlType [] { NHibernateUtil.Int16.SqlType }; } + } + } +} diff --git a/OpenSim/Data/NHibernate/UInt32Type.cs b/OpenSim/Data/NHibernate/UInt32Type.cs new file mode 100644 index 0000000..2500194 --- /dev/null +++ b/OpenSim/Data/NHibernate/UInt32Type.cs @@ -0,0 +1,105 @@ +/* + * 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 OpenSim 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.Data; +using OpenMetaverse; +using OpenSim.Framework; +using NHibernate; +using NHibernate.SqlTypes; +using NHibernate.UserTypes; + +namespace OpenSim.Data.NHibernate +{ + [Serializable] + public class UInt32Type : IUserType + { + public object Assemble(object cached, object owner) + { + return cached; + } + + bool IUserType.Equals(object uint1, object uint2) + { + return uint1.Equals(uint2); + } + + public object DeepCopy(object uint1) + { + return uint1; + } + + public object Disassemble(object uint1) + { + return uint1; + } + + public int GetHashCode(object uint1) + { + return (uint1 == null) ? 0 : uint1.GetHashCode(); + } + + public bool IsMutable + { + get { return false; } + } + + public object NullSafeGet(IDataReader rs, string[] names, object owner) + { + object uint1 = null; + + int ord = rs.GetOrdinal(names[0]); + if (!rs.IsDBNull(ord)) + { + uint1 = (UInt32)rs.GetInt32(ord); + } + + return uint1; + } + + public void NullSafeSet(IDbCommand cmd, object obj, int index) + { + UInt32 uint1 = (UInt32)obj; + ((IDataParameter)cmd.Parameters[index]).Value = Convert.ToInt32(uint1); + } + + public object Replace(object original, object target, object owner) + { + return original; + } + + public Type ReturnedType + { + get { return typeof(UInt32); } + } + + public SqlType[] SqlTypes + { + get { return new SqlType [] { NHibernateUtil.Int32.SqlType }; } + } + } +} diff --git a/OpenSim/Data/NHibernate/UInt64Type.cs b/OpenSim/Data/NHibernate/UInt64Type.cs new file mode 100644 index 0000000..304c9371 --- /dev/null +++ b/OpenSim/Data/NHibernate/UInt64Type.cs @@ -0,0 +1,105 @@ +/* + * 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 OpenSim 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.Data; +using OpenMetaverse; +using OpenSim.Framework; +using NHibernate; +using NHibernate.SqlTypes; +using NHibernate.UserTypes; + +namespace OpenSim.Data.NHibernate +{ + [Serializable] + public class UInt64Type : IUserType + { + public object Assemble(object cached, object owner) + { + return cached; + } + + bool IUserType.Equals(object uint1, object uint2) + { + return uint1.Equals(uint2); + } + + public object DeepCopy(object uint1) + { + return uint1; + } + + public object Disassemble(object uint1) + { + return uint1; + } + + public int GetHashCode(object uint1) + { + return (uint1 == null) ? 0 : uint1.GetHashCode(); + } + + public bool IsMutable + { + get { return false; } + } + + public object NullSafeGet(IDataReader rs, string[] names, object owner) + { + object uint1 = null; + + int ord = rs.GetOrdinal(names[0]); + if (!rs.IsDBNull(ord)) + { + uint1 = (UInt64)rs.GetInt64(ord); + } + + return uint1; + } + + public void NullSafeSet(IDbCommand cmd, object obj, int index) + { + UInt64 uint1 = (UInt64)obj; + ((IDataParameter)cmd.Parameters[index]).Value = Convert.ToInt64(uint1); + } + + public object Replace(object original, object target, object owner) + { + return original; + } + + public Type ReturnedType + { + get { return typeof(UInt64); } + } + + public SqlType[] SqlTypes + { + get { return new SqlType [] { NHibernateUtil.Int64.SqlType }; } + } + } +} diff --git a/prebuild.xml b/prebuild.xml index 1320ff3..f4f17f7 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1861,7 +1861,6 @@ - -- cgit v1.1