From ffca7de65d2c19081899dae75303a3f98833c665 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 30 Dec 2018 22:31:32 +0000
Subject: add some persistence (mysql only)

---
 OpenSim/Data/MySQL/MySQLSimulationData.cs          | 26 ++++++++++++++++++----
 .../Data/MySQL/Resources/RegionStore.migrations    |  7 ++++++
 2 files changed, 29 insertions(+), 4 deletions(-)

(limited to 'OpenSim/Data')

diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index e754522..55de192 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Data.MySQL
         /// </summary>
         private object m_dbLock = new object();
 
-        protected virtual Assembly Assembly
+        protected Assembly Assembly
         {
             get { return GetType().Assembly; }
         }
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL
             Initialise(connectionString);
         }
 
-        public virtual void Initialise(string connectionString)
+        public void Initialise(string connectionString)
         {
             m_connectionString = connectionString;
 
@@ -189,7 +189,7 @@ namespace OpenSim.Data.MySQL
                                     "AttachedPosY, AttachedPosZ, " +
                                     "PhysicsShapeType, Density, GravityModifier, " +
                                     "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
-                                    "RotationAxisLocks" +
+                                    "RotationAxisLocks, sopanims" +
                                     ") values (" + "?UUID, " +
                                     "?CreationDate, ?Name, ?Text, " +
                                     "?Description, ?SitName, ?TouchName, " +
@@ -226,7 +226,7 @@ namespace OpenSim.Data.MySQL
                                     "?AttachedPosY, ?AttachedPosZ, " +
                                     "?PhysicsShapeType, ?Density, ?GravityModifier, " +
                                     "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
-                                    "?RotationAxisLocks)";
+                                    "?RotationAxisLocks, ?sopanims)";
 
                             FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
 
@@ -1499,6 +1499,19 @@ namespace OpenSim.Data.MySQL
                 pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
             prim.PhysicsInertia = pdata;
 
+            if (!(row["sopanims"] is DBNull))
+            {
+                Byte[] data = (byte[])row["sopanims"];
+                if (data.Length > 0)
+                    prim.DeSerializeAnimations(data);
+                else
+                    prim.Animations = null;
+            }
+            else
+            {
+                prim.Animations = null;
+            }
+
             return prim;
         }
 
@@ -1878,6 +1891,11 @@ namespace OpenSim.Data.MySQL
             cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
             cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
             cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks);
+
+            if (prim.Animations!= null)
+                cmd.Parameters.AddWithValue("sopanims", prim.SerializeAnimations());
+            else
+                cmd.Parameters.AddWithValue("sopanims", null);
         }
 
         /// <summary>
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 0577392..7333df7 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -467,3 +467,10 @@ COMMIT;
 BEGIN;
 ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
 COMMIT;
+
+:VERSION 58         #----- Add sop animations
+
+BEGIN;
+ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
+COMMIT;
+
-- 
cgit v1.1