From b5efb49d74919b991fe86b53692180cf4829b565 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Tue, 15 Jul 2008 18:57:18 +0000
Subject: added new ParentUUID property to map out from SOP. Updated some
nhibernate parts, started in on migration.
---
OpenSim/Data/NHibernate/NHibernateRegionData.cs | 19 ++++++--
.../Resources/MySQLDialect/001_RegionStore.sql | 51 ++++++++++++++++++++++
.../Region/Environment/Scenes/SceneObjectPart.cs | 5 +++
3 files changed, 71 insertions(+), 4 deletions(-)
create mode 100644 OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index a2caab1..1c9e363 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Data.NHibernate
private Configuration cfg;
private ISessionFactory factory;
- //private ISession session;
+ private ISession session;
public void Initialise()
{
@@ -89,11 +89,11 @@ namespace OpenSim.Data.NHibernate
cfg.AddInputStream(stream);
factory = cfg.BuildSessionFactory();
- //session = factory.OpenSession();
+ session = factory.OpenSession();
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
- Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore");
+ Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore");
m.Update();
}
@@ -119,7 +119,18 @@ namespace OpenSim.Data.NHibernate
/// the region UUID
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{
- //NHPrim[] prims = (NHPrim[]) obj.GetParts();
+ foreach (SceneObjectPart part in obj.Children.Values)
+ {
+ try
+ {
+ session.SaveOrUpdate(part);
+ }
+ catch (Exception e)
+ {
+ m_log.Error("Can't save: ", e);
+ }
+ }
+
}
///
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
new file mode 100644
index 0000000..f3b7a73
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
@@ -0,0 +1,51 @@
+CREATE TABLE `prims` (
+ `ParentID` int(11) default NULL,
+ `CreationDate` int(11) default NULL,
+ `Name` varchar(255) default NULL,
+ `ParentUUID` char(36) default NULL,
+ `Text` varchar(255) default NULL,
+ `Description` varchar(255) default NULL,
+ `SitName` varchar(255) default NULL,
+ `TouchName` varchar(255) default NULL,
+ `ObjectFlags` int(11) default NULL,
+ `OwnerMask` int(11) default NULL,
+ `NextOwnerMask` int(11) default NULL,
+ `GroupMask` int(11) default NULL,
+ `EveryoneMask` int(11) default NULL,
+ `BaseMask` int(11) default NULL,
+ `PositionX` float default NULL,
+ `PositionY` float default NULL,
+ `PositionZ` float default NULL,
+ `GroupPositionX` float default NULL,
+ `GroupPositionY` float default NULL,
+ `GroupPositionZ` float default NULL,
+ `VelocityX` float default NULL,
+ `VelocityY` float default NULL,
+ `VelocityZ` float default NULL,
+ `AngularVelocityX` float default NULL,
+ `AngularVelocityY` float default NULL,
+ `AngularVelocityZ` float default NULL,
+ `AccelerationX` float default NULL,
+ `AccelerationY` float default NULL,
+ `AccelerationZ` float default NULL,
+ `RotationX` float default NULL,
+ `RotationY` float default NULL,
+ `RotationZ` float default NULL,
+ `RotationW` float default NULL,
+ `SitTargetOffsetX` float default NULL,
+ `SitTargetOffsetY` float default NULL,
+ `SitTargetOffsetZ` float default NULL,
+ `SitTargetOrientW` float default NULL,
+ `SitTargetOrientX` float default NULL,
+ `SitTargetOrientY` float default NULL,
+ `SitTargetOrientZ` float default NULL,
+ `UUID` char(36) NOT NULL default '',
+ `RegionID` char(36) default NULL,
+ `CreatorID` char(36) default NULL,
+ `OwnerID` char(36) default NULL,
+ `GroupID` char(36) default NULL,
+ `LastOwnerID` char(36) default NULL,
+ PRIMARY KEY (`UUID`),
+ KEY `prims_regionuuid` (`RegionID`),
+ KEY 'prims_parentuuid' ('ParentUUID')
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 677a120..36d1f50 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -920,6 +920,11 @@ namespace OpenSim.Region.Environment.Scenes
{
get { return ParentGroup.Scene.RegionInfo.RegionID; }
}
+ [XmlIgnore]
+ public LLUUID ParentUUID
+ {
+ get { return ParentGroup.UUID; }
+ }
#endregion Public Properties with only Get
--
cgit v1.1