From 849fc0483f02984abf03994967168d6c38174732 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 26 Jul 2010 23:19:31 +0100 Subject: add mysql support for media on a prim --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 8 ++++++-- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index bfeae12..f17e8ae 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -222,7 +222,7 @@ namespace OpenSim.Data.MySQL "PathTaperX, PathTaperY, PathTwist, " + "PathTwistBegin, ProfileBegin, ProfileEnd, " + "ProfileCurve, ProfileHollow, Texture, " + - "ExtraParams, State) values (?UUID, " + + "ExtraParams, State, Media) values (?UUID, " + "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + "?PCode, ?PathBegin, ?PathEnd, " + "?PathScaleX, ?PathScaleY, " + @@ -233,7 +233,7 @@ namespace OpenSim.Data.MySQL "?PathTwistBegin, ?ProfileBegin, " + "?ProfileEnd, ?ProfileCurve, " + "?ProfileHollow, ?Texture, ?ExtraParams, " + - "?State)"; + "?State, ?Media)"; FillShapeCommand(cmd, prim); @@ -1700,6 +1700,9 @@ namespace OpenSim.Data.MySQL s.ExtraParams = (byte[])row["ExtraParams"]; s.State = (byte)(int)row["State"]; + + if (!(row["Media"] is System.DBNull)) + s.MediaRaw = (string)row["Media"]; return s; } @@ -1743,6 +1746,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Texture", s.TextureEntry); cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); cmd.Parameters.AddWithValue("State", s.State); + cmd.Parameters.AddWithValue("Media", s.MediaRaw); } public void StorePrimInventory(UUID primID, ICollection items) diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 3f644f9..1369704 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -1,4 +1,4 @@ - + :VERSION 1 #--------------------- BEGIN; @@ -800,3 +800,10 @@ BEGIN; ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` FLOAT(4,2) NOT NULL DEFAULT '0.20' AFTER `cloud_detail_density`, CHANGE COLUMN `cloud_scroll_y` `cloud_scroll_y` FLOAT(4,2) NOT NULL DEFAULT '0.01' AFTER `cloud_scroll_x_lock`; COMMIT; +:VERSION 35 #--------------------- +-- Added post 0.7 + +BEGIN; +ALTER TABLE prims ADD COLUMN MediaURL varchar(255); +ALTER TABLE primshapes ADD COLUMN Media TEXT; +COMMIT; \ No newline at end of file -- cgit v1.1 From 9d8a67fe1348419c41374d1be77737bfa048106c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Aug 2010 16:26:27 +0100 Subject: get rid of PrimitiveBaseShape.MediaRaw staging post using an OSD serialization rather than auto forces serialization code to be placed in OpenSim.Framework this makes the media texture raw data staging post in PrimitiveBaseShape redundant, now we just directly call the code in PrimitiveBaseShape.MediaList itself --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index f17e8ae..50fcd96 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -1701,8 +1701,8 @@ namespace OpenSim.Data.MySQL s.State = (byte)(int)row["State"]; - if (!(row["Media"] is System.DBNull)) - s.MediaRaw = (string)row["Media"]; + if (!(row["Media"] is System.DBNull)) + s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); return s; } @@ -1746,7 +1746,9 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Texture", s.TextureEntry); cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); cmd.Parameters.AddWithValue("State", s.State); - cmd.Parameters.AddWithValue("Media", s.MediaRaw); + + if (s.Media != null) + cmd.Parameters.AddWithValue("Media", s.Media.ToXml()); } public void StorePrimInventory(UUID primID, ICollection items) -- cgit v1.1 From 2a0254f2da3b92f22289815c05bcd03a4032dd40 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Aug 2010 17:54:40 +0100 Subject: Implement MediaUrl persistence for MySQL and MsSQL Not sure how I forgot this. This may resolve problems with media textures not persisting over restart for these databases. --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 50fcd96..9c67e3a 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -174,7 +174,7 @@ namespace OpenSim.Data.MySQL "ParticleSystem, ClickAction, Material, " + "CollisionSound, CollisionSoundVolume, " + "PassTouches, " + - "LinkNumber) values (" + "?UUID, " + + "LinkNumber, MediaURL) values (" + "?UUID, " + "?CreationDate, ?Name, ?Text, " + "?Description, ?SitName, ?TouchName, " + "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + @@ -205,7 +205,7 @@ namespace OpenSim.Data.MySQL "?SaleType, ?ColorR, ?ColorG, " + "?ColorB, ?ColorA, ?ParticleSystem, " + "?ClickAction, ?Material, ?CollisionSound, " + - "?CollisionSoundVolume, ?PassTouches, ?LinkNumber)"; + "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; FillPrimCommand(cmd, prim, obj.UUID, regionUUID); @@ -1184,6 +1184,9 @@ namespace OpenSim.Data.MySQL prim.PassTouches = ((sbyte)row["PassTouches"] != 0); prim.LinkNum = (int)row["LinkNumber"]; + + if (!(row["MediaURL"] is System.DBNull)) + prim.MediaUrl = (string)row["MediaURL"]; return prim; } @@ -1521,6 +1524,9 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("PassTouches", 0); cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); + + if (prim.MediaUrl != null) + cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); } /// -- cgit v1.1 From 7f3f1bfe885a373d4a74fc13d49236113a69f727 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Aug 2010 20:23:18 +0100 Subject: fix mysql/mssql prim serialization problem --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 9c67e3a..d8debc5 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -1524,9 +1524,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("PassTouches", 0); cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); - - if (prim.MediaUrl != null) - cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); + cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); } /// @@ -1752,9 +1750,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Texture", s.TextureEntry); cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); cmd.Parameters.AddWithValue("State", s.State); - - if (s.Media != null) - cmd.Parameters.AddWithValue("Media", s.Media.ToXml()); + cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); } public void StorePrimInventory(UUID primID, ICollection items) -- cgit v1.1