Implement dynamic attribute persistence on mysql and mssql

mssql is untested
user_profiles
Justin Clark-Casey (justincc) 2010-08-16 21:57:08 +01:00
parent d3095e2649
commit a3e1e6dd61
4 changed files with 49 additions and 8 deletions

View File

@ -351,7 +351,7 @@ IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
LinkNumber = @LinkNumber, MediaURL = @MediaURL
LinkNumber = @LinkNumber, MediaURL = @MediaURL, DynAttrs = @DynAttrs
WHERE UUID = @UUID
END
ELSE
@ -366,7 +366,7 @@ ELSE
PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL
ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL, DynAttrs
) VALUES (
@UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
@EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX,
@ -376,7 +376,7 @@ ELSE
@PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
@OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
@ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
@ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL
@ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL, @DynAttrs
)
END";
@ -409,7 +409,7 @@ IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID)
PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions,
PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin,
ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow,
Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media
Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media, DynAttrs = @DynAttrs
WHERE UUID = @UUID
END
ELSE
@ -418,11 +418,11 @@ ELSE
primshapes (
UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY,
PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin,
ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media
ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media, DynAttrs
) VALUES (
@UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY,
@PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin,
@ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media
@ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media, @DynAttrs
)
END";
@ -1691,6 +1691,11 @@ VALUES
if (!(primRow["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)primRow["MediaURL"];
if (!(primRow["DynAttrs"] is System.DBNull))
prim.DynAttrs = DynAttrsOSDMap.FromXml((string)primRow["DynAttrs"]);
else
prim.DynAttrs = new DynAttrsOSDMap();
return prim;
}
@ -1749,6 +1754,10 @@ VALUES
baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
}
if (!(shapeRow["DynAttrs"] is System.DBNull))
baseShape.DynAttrs = DynAttrsOSDMap.FromXml((string)shapeRow["DynAttrs"]);
else
baseShape.DynAttrs = new DynAttrsOSDMap();
return baseShape;
}
@ -2086,6 +2095,7 @@ VALUES
parameters.Add(_Database.CreateParameter("PassTouches", 0));
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
return parameters.ToArray();
}
@ -2143,6 +2153,7 @@ VALUES
parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml()));
}
parameters.Add(_Database.CreateParameter("DynAttrs", s.DynAttrs.ToXml()));
return parameters.ToArray();
}

View File

@ -1148,3 +1148,12 @@ CREATE TABLE [dbo].[regionenvironment](
) ON [PRIMARY]
COMMIT
:VERSION 38 #---------------- Dynamic attributes
BEGIN TRANSACTION
ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
ALTER TABLE primshapes ADD COLUMN DynAttrs TEXT;
COMMIT

View File

@ -202,7 +202,7 @@ namespace OpenSim.Data.MySQL
"?SaleType, ?ColorR, ?ColorG, " +
"?ColorB, ?ColorA, ?ParticleSystem, " +
"?ClickAction, ?Material, ?CollisionSound, " +
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL, ?DynAttrs)";
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
@ -230,7 +230,7 @@ namespace OpenSim.Data.MySQL
"?PathTwistBegin, ?ProfileBegin, " +
"?ProfileEnd, ?ProfileCurve, " +
"?ProfileHollow, ?Texture, ?ExtraParams, " +
"?State, ?Media)";
"?State, ?Media, ?DynAttrs)";
FillShapeCommand(cmd, prim);
@ -1291,6 +1291,11 @@ namespace OpenSim.Data.MySQL
if (!(row["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)row["MediaURL"];
if (!(row["DynAttrs"] is System.DBNull))
prim.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]);
else
prim.DynAttrs = new DynAttrsOSDMap();
return prim;
}
@ -1637,6 +1642,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
}
/// <summary>
@ -1829,6 +1835,11 @@ namespace OpenSim.Data.MySQL
if (!(row["Media"] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
if (!(row["DynAttrs"] is System.DBNull))
s.DynAttrs = DynAttrsOSDMap.FromXml((string)row["DynAttrs"]);
else
s.DynAttrs = new DynAttrsOSDMap();
return s;
}
@ -1873,6 +1884,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
cmd.Parameters.AddWithValue("State", s.State);
cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
cmd.Parameters.AddWithValue("DynAttrs", s.DynAttrs.ToXml());
}
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)

View File

@ -902,3 +902,12 @@ BEGIN;
CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`));
COMMIT;
:VERSION 46 #---------------- Dynamic attributes
BEGIN;
ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
ALTER TABLE primshapes ADD COLUMN DynAttrs TEXT;
COMMIT;