diff options
Diffstat (limited to 'OpenSim/Data')
35 files changed, 1557 insertions, 149 deletions
diff --git a/OpenSim/Data/IGroupsData.cs b/OpenSim/Data/IGroupsData.cs new file mode 100644 index 0000000..c11e649 --- /dev/null +++ b/OpenSim/Data/IGroupsData.cs | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Data; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Data | ||
33 | { | ||
34 | public class GroupData | ||
35 | { | ||
36 | public UUID GroupID; | ||
37 | public Dictionary<string, string> Data; | ||
38 | } | ||
39 | |||
40 | public class MembershipData | ||
41 | { | ||
42 | public UUID GroupID; | ||
43 | public string PrincipalID; | ||
44 | public Dictionary<string, string> Data; | ||
45 | } | ||
46 | |||
47 | public class RoleData | ||
48 | { | ||
49 | public UUID GroupID; | ||
50 | public UUID RoleID; | ||
51 | public Dictionary<string, string> Data; | ||
52 | } | ||
53 | |||
54 | public class RoleMembershipData | ||
55 | { | ||
56 | public UUID GroupID; | ||
57 | public UUID RoleID; | ||
58 | public string PrincipalID; | ||
59 | } | ||
60 | |||
61 | public class PrincipalData | ||
62 | { | ||
63 | public string PrincipalID; | ||
64 | public UUID ActiveGroupID; | ||
65 | } | ||
66 | |||
67 | public class InvitationData | ||
68 | { | ||
69 | public UUID InviteID; | ||
70 | public UUID GroupID; | ||
71 | public UUID RoleID; | ||
72 | public string PrincipalID; | ||
73 | public Dictionary<string, string> Data; | ||
74 | } | ||
75 | |||
76 | public class NoticeData | ||
77 | { | ||
78 | public UUID GroupID; | ||
79 | public UUID NoticeID; | ||
80 | public Dictionary<string, string> Data; | ||
81 | } | ||
82 | |||
83 | |||
84 | public interface IGroupsData | ||
85 | { | ||
86 | // groups table | ||
87 | bool StoreGroup(GroupData data); | ||
88 | GroupData RetrieveGroup(UUID groupID); | ||
89 | GroupData RetrieveGroup(string name); | ||
90 | GroupData[] RetrieveGroups(string pattern); | ||
91 | bool DeleteGroup(UUID groupID); | ||
92 | int GroupsCount(); | ||
93 | |||
94 | // membership table | ||
95 | MembershipData RetrieveMember(UUID groupID, string pricipalID); | ||
96 | MembershipData[] RetrieveMembers(UUID groupID); | ||
97 | MembershipData[] RetrieveMemberships(string pricipalID); | ||
98 | bool StoreMember(MembershipData data); | ||
99 | bool DeleteMember(UUID groupID, string pricipalID); | ||
100 | int MemberCount(UUID groupID); | ||
101 | |||
102 | // roles table | ||
103 | bool StoreRole(RoleData data); | ||
104 | RoleData RetrieveRole(UUID groupID, UUID roleID); | ||
105 | RoleData[] RetrieveRoles(UUID groupID); | ||
106 | bool DeleteRole(UUID groupID, UUID roleID); | ||
107 | int RoleCount(UUID groupID); | ||
108 | |||
109 | // rolememberhip table | ||
110 | RoleMembershipData[] RetrieveRolesMembers(UUID groupID); | ||
111 | RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID); | ||
112 | RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID); | ||
113 | RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID); | ||
114 | int RoleMemberCount(UUID groupID, UUID roleID); | ||
115 | bool StoreRoleMember(RoleMembershipData data); | ||
116 | bool DeleteRoleMember(RoleMembershipData data); | ||
117 | bool DeleteMemberAllRoles(UUID groupID, string principalID); | ||
118 | |||
119 | // principals table | ||
120 | bool StorePrincipal(PrincipalData data); | ||
121 | PrincipalData RetrievePrincipal(string principalID); | ||
122 | bool DeletePrincipal(string principalID); | ||
123 | |||
124 | // invites table | ||
125 | bool StoreInvitation(InvitationData data); | ||
126 | InvitationData RetrieveInvitation(UUID inviteID); | ||
127 | InvitationData RetrieveInvitation(UUID groupID, string principalID); | ||
128 | bool DeleteInvite(UUID inviteID); | ||
129 | void DeleteOldInvites(); | ||
130 | |||
131 | // notices table | ||
132 | bool StoreNotice(NoticeData data); | ||
133 | NoticeData RetrieveNotice(UUID noticeID); | ||
134 | NoticeData[] RetrieveNotices(UUID groupID); | ||
135 | bool DeleteNotice(UUID noticeID); | ||
136 | void DeleteOldNotices(); | ||
137 | |||
138 | // combinations | ||
139 | MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID); | ||
140 | MembershipData[] RetrievePrincipalGroupMemberships(string principalID); | ||
141 | |||
142 | // Misc | ||
143 | } | ||
144 | } | ||
diff --git a/OpenSim/Data/IOfflineIMData.cs b/OpenSim/Data/IOfflineIMData.cs new file mode 100644 index 0000000..e780304 --- /dev/null +++ b/OpenSim/Data/IOfflineIMData.cs | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Data; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Data | ||
33 | { | ||
34 | public class OfflineIMData | ||
35 | { | ||
36 | public UUID PrincipalID; | ||
37 | public Dictionary<string, string> Data; | ||
38 | } | ||
39 | |||
40 | |||
41 | public interface IOfflineIMData | ||
42 | { | ||
43 | OfflineIMData[] Get(string field, string val); | ||
44 | long GetCount(string field, string key); | ||
45 | bool Store(OfflineIMData data); | ||
46 | bool Delete(string field, string val); | ||
47 | void DeleteOld(); | ||
48 | } | ||
49 | } | ||
diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index b871f56..9ec48b0 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs | |||
@@ -53,5 +53,6 @@ namespace OpenSim.Data | |||
53 | bool ReportAgent(UUID sessionID, UUID regionID); | 53 | bool ReportAgent(UUID sessionID, UUID regionID); |
54 | PresenceData[] Get(string field, string data); | 54 | PresenceData[] Get(string field, string data); |
55 | bool Delete(string field, string val); | 55 | bool Delete(string field, string val); |
56 | bool VerifyAgent(UUID agentId, UUID secureSessionID); | ||
56 | } | 57 | } |
57 | } | 58 | } |
diff --git a/OpenSim/Data/IXGroupData.cs b/OpenSim/Data/IXGroupData.cs new file mode 100644 index 0000000..2965e8c --- /dev/null +++ b/OpenSim/Data/IXGroupData.cs | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | |||
33 | namespace OpenSim.Data | ||
34 | { | ||
35 | public class XGroup | ||
36 | { | ||
37 | public UUID groupID; | ||
38 | public UUID ownerRoleID; | ||
39 | public string name; | ||
40 | public string charter; | ||
41 | public bool showInList; | ||
42 | public UUID insigniaID; | ||
43 | public int membershipFee; | ||
44 | public bool openEnrollment; | ||
45 | public bool allowPublish; | ||
46 | public bool maturePublish; | ||
47 | public UUID founderID; | ||
48 | public ulong everyonePowers; | ||
49 | public ulong ownersPowers; | ||
50 | |||
51 | public XGroup Clone() | ||
52 | { | ||
53 | return (XGroup)MemberwiseClone(); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// Early stub interface for groups data, not final. | ||
59 | /// </summary> | ||
60 | /// <remarks> | ||
61 | /// Currently in-use only for regression test purposes. Needs to be filled out over time. | ||
62 | /// </remarks> | ||
63 | public interface IXGroupData | ||
64 | { | ||
65 | bool StoreGroup(XGroup group); | ||
66 | XGroup[] GetGroups(string field, string val); | ||
67 | XGroup[] GetGroups(string[] fields, string[] vals); | ||
68 | bool DeleteGroups(string field, string val); | ||
69 | bool DeleteGroups(string[] fields, string[] vals); | ||
70 | } | ||
71 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index c882555..12f2477 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -163,14 +163,18 @@ namespace OpenSim.Data.MSSQL | |||
163 | if (asset.Name.Length > 64) | 163 | if (asset.Name.Length > 64) |
164 | { | 164 | { |
165 | assetName = asset.Name.Substring(0, 64); | 165 | assetName = asset.Name.Substring(0, 64); |
166 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 166 | m_log.WarnFormat( |
167 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
168 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
167 | } | 169 | } |
168 | 170 | ||
169 | string assetDescription = asset.Description; | 171 | string assetDescription = asset.Description; |
170 | if (asset.Description.Length > 64) | 172 | if (asset.Description.Length > 64) |
171 | { | 173 | { |
172 | assetDescription = asset.Description.Substring(0, 64); | 174 | assetDescription = asset.Description.Substring(0, 64); |
173 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 175 | m_log.WarnFormat( |
176 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
177 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
174 | } | 178 | } |
175 | 179 | ||
176 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 180 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs index e7b3d9c..deff2ed 100644 --- a/OpenSim/Data/MSSQL/MSSQLPresenceData.cs +++ b/OpenSim/Data/MSSQL/MSSQLPresenceData.cs | |||
@@ -100,5 +100,18 @@ namespace OpenSim.Data.MSSQL | |||
100 | return true; | 100 | return true; |
101 | } | 101 | } |
102 | 102 | ||
103 | public bool VerifyAgent(UUID agentId, UUID secureSessionID) | ||
104 | { | ||
105 | PresenceData[] ret = Get("SecureSessionID", | ||
106 | secureSessionID.ToString()); | ||
107 | |||
108 | if (ret.Length == 0) | ||
109 | return false; | ||
110 | |||
111 | if(ret[0].UserID != agentId.ToString()) | ||
112 | return false; | ||
113 | |||
114 | return true; | ||
115 | } | ||
103 | } | 116 | } |
104 | } | 117 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 5bb6ec9..00af3a0 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -351,7 +351,8 @@ IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID) | |||
351 | ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, | 351 | ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, |
352 | SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, | 352 | SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, |
353 | ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, | 353 | ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, |
354 | LinkNumber = @LinkNumber, MediaURL = @MediaURL | 354 | LinkNumber = @LinkNumber, MediaURL = @MediaURL, DynAttrs = @DynAttrs, |
355 | PhysicsShapeType = @PhysicsShapeType, Density = @Density, GravityModifier = @GravityModifier, Friction = @Friction, Restitution = @Restitution | ||
355 | WHERE UUID = @UUID | 356 | WHERE UUID = @UUID |
356 | END | 357 | END |
357 | ELSE | 358 | ELSE |
@@ -366,7 +367,8 @@ ELSE | |||
366 | PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, | 367 | PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, |
367 | OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, | 368 | OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, |
368 | ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, | 369 | ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, |
369 | ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL | 370 | ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL, DynAttrs, |
371 | PhysicsShapeType, Density, GravityModifier, Friction, Restitution | ||
370 | ) VALUES ( | 372 | ) VALUES ( |
371 | @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, | 373 | @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, |
372 | @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, | 374 | @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, |
@@ -376,7 +378,8 @@ ELSE | |||
376 | @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, | 378 | @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, |
377 | @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, | 379 | @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, |
378 | @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, | 380 | @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, |
379 | @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL | 381 | @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL, @DynAttrs, |
382 | @PhysicsShapeType, @Density, @GravityModifier, @Friction, @Restitution | ||
380 | ) | 383 | ) |
381 | END"; | 384 | END"; |
382 | 385 | ||
@@ -1691,6 +1694,17 @@ VALUES | |||
1691 | 1694 | ||
1692 | if (!(primRow["MediaURL"] is System.DBNull)) | 1695 | if (!(primRow["MediaURL"] is System.DBNull)) |
1693 | prim.MediaUrl = (string)primRow["MediaURL"]; | 1696 | prim.MediaUrl = (string)primRow["MediaURL"]; |
1697 | |||
1698 | if (!(primRow["DynAttrs"] is System.DBNull)) | ||
1699 | prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); | ||
1700 | else | ||
1701 | prim.DynAttrs = new DAMap(); | ||
1702 | |||
1703 | prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]); | ||
1704 | prim.Density = Convert.ToSingle(primRow["Density"]); | ||
1705 | prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]); | ||
1706 | prim.Friction = Convert.ToSingle(primRow["Friction"]); | ||
1707 | prim.Restitution = Convert.ToSingle(primRow["Restitution"]); | ||
1694 | 1708 | ||
1695 | return prim; | 1709 | return prim; |
1696 | } | 1710 | } |
@@ -1749,7 +1763,6 @@ VALUES | |||
1749 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); | 1763 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); |
1750 | } | 1764 | } |
1751 | 1765 | ||
1752 | |||
1753 | return baseShape; | 1766 | return baseShape; |
1754 | } | 1767 | } |
1755 | 1768 | ||
@@ -2086,6 +2099,17 @@ VALUES | |||
2086 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | 2099 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); |
2087 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); | 2100 | parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); |
2088 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); | 2101 | parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); |
2102 | |||
2103 | if (prim.DynAttrs.Count > 0) | ||
2104 | parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); | ||
2105 | else | ||
2106 | parameters.Add(_Database.CreateParameter("DynAttrs", null)); | ||
2107 | |||
2108 | parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType)); | ||
2109 | parameters.Add(_Database.CreateParameter("Density", (double)prim.Density)); | ||
2110 | parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); | ||
2111 | parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction)); | ||
2112 | parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution)); | ||
2089 | 2113 | ||
2090 | return parameters.ToArray(); | 2114 | return parameters.ToArray(); |
2091 | } | 2115 | } |
@@ -2143,7 +2167,6 @@ VALUES | |||
2143 | parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); | 2167 | parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); |
2144 | } | 2168 | } |
2145 | 2169 | ||
2146 | |||
2147 | return parameters.ToArray(); | 2170 | return parameters.ToArray(); |
2148 | } | 2171 | } |
2149 | 2172 | ||
diff --git a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs index 1a67e70..9bc580e 100644 --- a/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.7.5.*")] | 64 | [assembly : AssemblyVersion("0.7.6.*")] |
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | 65 | |
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations index 350e548..b84c2a4 100644 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations | |||
@@ -1148,3 +1148,23 @@ CREATE TABLE [dbo].[regionenvironment]( | |||
1148 | ) ON [PRIMARY] | 1148 | ) ON [PRIMARY] |
1149 | 1149 | ||
1150 | COMMIT | 1150 | COMMIT |
1151 | |||
1152 | :VERSION 38 #---------------- Dynamic attributes | ||
1153 | |||
1154 | BEGIN TRANSACTION | ||
1155 | |||
1156 | ALTER TABLE prims ADD COLUMN DynAttrs TEXT; | ||
1157 | |||
1158 | COMMIT | ||
1159 | |||
1160 | :VERSION 39 #---------------- Extra physics params | ||
1161 | |||
1162 | BEGIN TRANSACTION | ||
1163 | |||
1164 | ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0'; | ||
1165 | ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000'; | ||
1166 | ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1'; | ||
1167 | ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | ||
1168 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | ||
1169 | |||
1170 | COMMIT | ||
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 20df234..21dd5aa 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -173,14 +173,18 @@ namespace OpenSim.Data.MySQL | |||
173 | if (asset.Name.Length > 64) | 173 | if (asset.Name.Length > 64) |
174 | { | 174 | { |
175 | assetName = asset.Name.Substring(0, 64); | 175 | assetName = asset.Name.Substring(0, 64); |
176 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 176 | m_log.WarnFormat( |
177 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
178 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
177 | } | 179 | } |
178 | 180 | ||
179 | string assetDescription = asset.Description; | 181 | string assetDescription = asset.Description; |
180 | if (asset.Description.Length > 64) | 182 | if (asset.Description.Length > 64) |
181 | { | 183 | { |
182 | assetDescription = asset.Description.Substring(0, 64); | 184 | assetDescription = asset.Description.Substring(0, 64); |
183 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 185 | m_log.WarnFormat( |
186 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
187 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
184 | } | 188 | } |
185 | 189 | ||
186 | try | 190 | try |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index f6731c0..dc657c8 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -306,5 +306,65 @@ namespace OpenSim.Data.MySQL | |||
306 | return ExecuteNonQuery(cmd) > 0; | 306 | return ExecuteNonQuery(cmd) > 0; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | |||
310 | public long GetCount(string field, string key) | ||
311 | { | ||
312 | return GetCount(new string[] { field }, new string[] { key }); | ||
313 | } | ||
314 | |||
315 | public long GetCount(string[] fields, string[] keys) | ||
316 | { | ||
317 | if (fields.Length != keys.Length) | ||
318 | return 0; | ||
319 | |||
320 | List<string> terms = new List<string>(); | ||
321 | |||
322 | using (MySqlCommand cmd = new MySqlCommand()) | ||
323 | { | ||
324 | for (int i = 0; i < fields.Length; i++) | ||
325 | { | ||
326 | cmd.Parameters.AddWithValue(fields[i], keys[i]); | ||
327 | terms.Add("`" + fields[i] + "` = ?" + fields[i]); | ||
328 | } | ||
329 | |||
330 | string where = String.Join(" and ", terms.ToArray()); | ||
331 | |||
332 | string query = String.Format("select count(*) from {0} where {1}", | ||
333 | m_Realm, where); | ||
334 | |||
335 | cmd.CommandText = query; | ||
336 | |||
337 | Object result = DoQueryScalar(cmd); | ||
338 | |||
339 | return Convert.ToInt64(result); | ||
340 | } | ||
341 | } | ||
342 | |||
343 | public long GetCount(string where) | ||
344 | { | ||
345 | using (MySqlCommand cmd = new MySqlCommand()) | ||
346 | { | ||
347 | string query = String.Format("select count(*) from {0} where {1}", | ||
348 | m_Realm, where); | ||
349 | |||
350 | cmd.CommandText = query; | ||
351 | |||
352 | object result = DoQueryScalar(cmd); | ||
353 | |||
354 | return Convert.ToInt64(result); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | public object DoQueryScalar(MySqlCommand cmd) | ||
359 | { | ||
360 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
361 | { | ||
362 | dbcon.Open(); | ||
363 | cmd.Connection = dbcon; | ||
364 | |||
365 | return cmd.ExecuteScalar(); | ||
366 | } | ||
367 | } | ||
368 | |||
309 | } | 369 | } |
310 | } | 370 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs new file mode 100644 index 0000000..2a1bd6c --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLGroupsData.cs | |||
@@ -0,0 +1,484 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Data.MySQL; | ||
35 | |||
36 | using OpenMetaverse; | ||
37 | using MySql.Data.MySqlClient; | ||
38 | |||
39 | namespace OpenSim.Data.MySQL | ||
40 | { | ||
41 | public class MySQLGroupsData : IGroupsData | ||
42 | { | ||
43 | private MySqlGroupsGroupsHandler m_Groups; | ||
44 | private MySqlGroupsMembershipHandler m_Membership; | ||
45 | private MySqlGroupsRolesHandler m_Roles; | ||
46 | private MySqlGroupsRoleMembershipHandler m_RoleMembership; | ||
47 | private MySqlGroupsInvitesHandler m_Invites; | ||
48 | private MySqlGroupsNoticesHandler m_Notices; | ||
49 | private MySqlGroupsPrincipalsHandler m_Principals; | ||
50 | |||
51 | public MySQLGroupsData(string connectionString, string realm) | ||
52 | { | ||
53 | m_Groups = new MySqlGroupsGroupsHandler(connectionString, realm + "_groups", realm + "_Store"); | ||
54 | m_Membership = new MySqlGroupsMembershipHandler(connectionString, realm + "_membership"); | ||
55 | m_Roles = new MySqlGroupsRolesHandler(connectionString, realm + "_roles"); | ||
56 | m_RoleMembership = new MySqlGroupsRoleMembershipHandler(connectionString, realm + "_rolemembership"); | ||
57 | m_Invites = new MySqlGroupsInvitesHandler(connectionString, realm + "_invites"); | ||
58 | m_Notices = new MySqlGroupsNoticesHandler(connectionString, realm + "_notices"); | ||
59 | m_Principals = new MySqlGroupsPrincipalsHandler(connectionString, realm + "_principals"); | ||
60 | } | ||
61 | |||
62 | #region groups table | ||
63 | public bool StoreGroup(GroupData data) | ||
64 | { | ||
65 | return m_Groups.Store(data); | ||
66 | } | ||
67 | |||
68 | public GroupData RetrieveGroup(UUID groupID) | ||
69 | { | ||
70 | GroupData[] groups = m_Groups.Get("GroupID", groupID.ToString()); | ||
71 | if (groups.Length > 0) | ||
72 | return groups[0]; | ||
73 | |||
74 | return null; | ||
75 | } | ||
76 | |||
77 | public GroupData RetrieveGroup(string name) | ||
78 | { | ||
79 | GroupData[] groups = m_Groups.Get("Name", name); | ||
80 | if (groups.Length > 0) | ||
81 | return groups[0]; | ||
82 | |||
83 | return null; | ||
84 | } | ||
85 | |||
86 | public GroupData[] RetrieveGroups(string pattern) | ||
87 | { | ||
88 | if (string.IsNullOrEmpty(pattern)) | ||
89 | pattern = "1 ORDER BY Name LIMIT 100"; | ||
90 | else | ||
91 | pattern = string.Format("Name LIKE %{0}% ORDER BY Name LIMIT 100", pattern); | ||
92 | |||
93 | return m_Groups.Get(pattern); | ||
94 | } | ||
95 | |||
96 | public bool DeleteGroup(UUID groupID) | ||
97 | { | ||
98 | return m_Groups.Delete("GroupID", groupID.ToString()); | ||
99 | } | ||
100 | |||
101 | public int GroupsCount() | ||
102 | { | ||
103 | return (int)m_Groups.GetCount("Location=\"\""); | ||
104 | } | ||
105 | |||
106 | #endregion | ||
107 | |||
108 | #region membership table | ||
109 | public MembershipData[] RetrieveMembers(UUID groupID) | ||
110 | { | ||
111 | return m_Membership.Get("GroupID", groupID.ToString()); | ||
112 | } | ||
113 | |||
114 | public MembershipData RetrieveMember(UUID groupID, string pricipalID) | ||
115 | { | ||
116 | MembershipData[] m = m_Membership.Get(new string[] { "GroupID", "PrincipalID" }, | ||
117 | new string[] { groupID.ToString(), pricipalID }); | ||
118 | if (m != null && m.Length > 0) | ||
119 | return m[0]; | ||
120 | |||
121 | return null; | ||
122 | } | ||
123 | |||
124 | public MembershipData[] RetrieveMemberships(string pricipalID) | ||
125 | { | ||
126 | return m_Membership.Get("PrincipalID", pricipalID.ToString()); | ||
127 | } | ||
128 | |||
129 | public bool StoreMember(MembershipData data) | ||
130 | { | ||
131 | return m_Membership.Store(data); | ||
132 | } | ||
133 | |||
134 | public bool DeleteMember(UUID groupID, string pricipalID) | ||
135 | { | ||
136 | return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" }, | ||
137 | new string[] { groupID.ToString(), pricipalID }); | ||
138 | } | ||
139 | |||
140 | public int MemberCount(UUID groupID) | ||
141 | { | ||
142 | return (int)m_Membership.GetCount("GroupID", groupID.ToString()); | ||
143 | } | ||
144 | #endregion | ||
145 | |||
146 | #region roles table | ||
147 | public bool StoreRole(RoleData data) | ||
148 | { | ||
149 | return m_Roles.Store(data); | ||
150 | } | ||
151 | |||
152 | public RoleData RetrieveRole(UUID groupID, UUID roleID) | ||
153 | { | ||
154 | RoleData[] data = m_Roles.Get(new string[] { "GroupID", "RoleID" }, | ||
155 | new string[] { groupID.ToString(), roleID.ToString() }); | ||
156 | |||
157 | if (data != null && data.Length > 0) | ||
158 | return data[0]; | ||
159 | |||
160 | return null; | ||
161 | } | ||
162 | |||
163 | public RoleData[] RetrieveRoles(UUID groupID) | ||
164 | { | ||
165 | //return m_Roles.RetrieveRoles(groupID); | ||
166 | return m_Roles.Get("GroupID", groupID.ToString()); | ||
167 | } | ||
168 | |||
169 | public bool DeleteRole(UUID groupID, UUID roleID) | ||
170 | { | ||
171 | return m_Roles.Delete(new string[] { "GroupID", "RoleID" }, | ||
172 | new string[] { groupID.ToString(), roleID.ToString() }); | ||
173 | } | ||
174 | |||
175 | public int RoleCount(UUID groupID) | ||
176 | { | ||
177 | return (int)m_Roles.GetCount("GroupID", groupID.ToString()); | ||
178 | } | ||
179 | |||
180 | |||
181 | #endregion | ||
182 | |||
183 | #region rolememberhip table | ||
184 | public RoleMembershipData[] RetrieveRolesMembers(UUID groupID) | ||
185 | { | ||
186 | RoleMembershipData[] data = m_RoleMembership.Get("GroupID", groupID.ToString()); | ||
187 | |||
188 | return data; | ||
189 | } | ||
190 | |||
191 | public RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID) | ||
192 | { | ||
193 | RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "RoleID" }, | ||
194 | new string[] { groupID.ToString(), roleID.ToString() }); | ||
195 | |||
196 | return data; | ||
197 | } | ||
198 | |||
199 | public RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID) | ||
200 | { | ||
201 | RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "PrincipalID" }, | ||
202 | new string[] { groupID.ToString(), principalID.ToString() }); | ||
203 | |||
204 | return data; | ||
205 | } | ||
206 | |||
207 | public RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID) | ||
208 | { | ||
209 | RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "RoleID", "PrincipalID" }, | ||
210 | new string[] { groupID.ToString(), roleID.ToString(), principalID.ToString() }); | ||
211 | |||
212 | if (data != null && data.Length > 0) | ||
213 | return data[0]; | ||
214 | |||
215 | return null; | ||
216 | } | ||
217 | |||
218 | public int RoleMemberCount(UUID groupID, UUID roleID) | ||
219 | { | ||
220 | return (int)m_RoleMembership.GetCount(new string[] { "GroupID", "RoleID" }, | ||
221 | new string[] { groupID.ToString(), roleID.ToString() }); | ||
222 | } | ||
223 | |||
224 | public bool StoreRoleMember(RoleMembershipData data) | ||
225 | { | ||
226 | return m_RoleMembership.Store(data); | ||
227 | } | ||
228 | |||
229 | public bool DeleteRoleMember(RoleMembershipData data) | ||
230 | { | ||
231 | return m_RoleMembership.Delete(new string[] { "GroupID", "RoleID", "PrincipalID"}, | ||
232 | new string[] { data.GroupID.ToString(), data.RoleID.ToString(), data.PrincipalID }); | ||
233 | } | ||
234 | |||
235 | public bool DeleteMemberAllRoles(UUID groupID, string principalID) | ||
236 | { | ||
237 | return m_RoleMembership.Delete(new string[] { "GroupID", "PrincipalID" }, | ||
238 | new string[] { groupID.ToString(), principalID }); | ||
239 | } | ||
240 | |||
241 | #endregion | ||
242 | |||
243 | #region principals table | ||
244 | public bool StorePrincipal(PrincipalData data) | ||
245 | { | ||
246 | return m_Principals.Store(data); | ||
247 | } | ||
248 | |||
249 | public PrincipalData RetrievePrincipal(string principalID) | ||
250 | { | ||
251 | PrincipalData[] p = m_Principals.Get("PrincipalID", principalID); | ||
252 | if (p != null && p.Length > 0) | ||
253 | return p[0]; | ||
254 | |||
255 | return null; | ||
256 | } | ||
257 | |||
258 | public bool DeletePrincipal(string principalID) | ||
259 | { | ||
260 | return m_Principals.Delete("PrincipalID", principalID); | ||
261 | } | ||
262 | #endregion | ||
263 | |||
264 | #region invites table | ||
265 | |||
266 | public bool StoreInvitation(InvitationData data) | ||
267 | { | ||
268 | return m_Invites.Store(data); | ||
269 | } | ||
270 | |||
271 | public InvitationData RetrieveInvitation(UUID inviteID) | ||
272 | { | ||
273 | InvitationData[] invites = m_Invites.Get("InviteID", inviteID.ToString()); | ||
274 | |||
275 | if (invites != null && invites.Length > 0) | ||
276 | return invites[0]; | ||
277 | |||
278 | return null; | ||
279 | } | ||
280 | |||
281 | public InvitationData RetrieveInvitation(UUID groupID, string principalID) | ||
282 | { | ||
283 | InvitationData[] invites = m_Invites.Get(new string[] { "GroupID", "PrincipalID" }, | ||
284 | new string[] { groupID.ToString(), principalID }); | ||
285 | |||
286 | if (invites != null && invites.Length > 0) | ||
287 | return invites[0]; | ||
288 | |||
289 | return null; | ||
290 | } | ||
291 | |||
292 | public bool DeleteInvite(UUID inviteID) | ||
293 | { | ||
294 | return m_Invites.Delete("InviteID", inviteID.ToString()); | ||
295 | } | ||
296 | |||
297 | public void DeleteOldInvites() | ||
298 | { | ||
299 | m_Invites.DeleteOld(); | ||
300 | } | ||
301 | |||
302 | #endregion | ||
303 | |||
304 | #region notices table | ||
305 | |||
306 | public bool StoreNotice(NoticeData data) | ||
307 | { | ||
308 | return m_Notices.Store(data); | ||
309 | } | ||
310 | |||
311 | public NoticeData RetrieveNotice(UUID noticeID) | ||
312 | { | ||
313 | NoticeData[] notices = m_Notices.Get("NoticeID", noticeID.ToString()); | ||
314 | |||
315 | if (notices != null && notices.Length > 0) | ||
316 | return notices[0]; | ||
317 | |||
318 | return null; | ||
319 | } | ||
320 | |||
321 | public NoticeData[] RetrieveNotices(UUID groupID) | ||
322 | { | ||
323 | NoticeData[] notices = m_Notices.Get("GroupID", groupID.ToString()); | ||
324 | |||
325 | return notices; | ||
326 | } | ||
327 | |||
328 | public bool DeleteNotice(UUID noticeID) | ||
329 | { | ||
330 | return m_Notices.Delete("NoticeID", noticeID.ToString()); | ||
331 | } | ||
332 | |||
333 | public void DeleteOldNotices() | ||
334 | { | ||
335 | m_Notices.DeleteOld(); | ||
336 | } | ||
337 | |||
338 | #endregion | ||
339 | |||
340 | #region combinations | ||
341 | public MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID) | ||
342 | { | ||
343 | // TODO | ||
344 | return null; | ||
345 | } | ||
346 | public MembershipData[] RetrievePrincipalGroupMemberships(string principalID) | ||
347 | { | ||
348 | // TODO | ||
349 | return null; | ||
350 | } | ||
351 | |||
352 | #endregion | ||
353 | } | ||
354 | |||
355 | public class MySqlGroupsGroupsHandler : MySQLGenericTableHandler<GroupData> | ||
356 | { | ||
357 | protected override Assembly Assembly | ||
358 | { | ||
359 | // WARNING! Moving migrations to this assembly!!! | ||
360 | get { return GetType().Assembly; } | ||
361 | } | ||
362 | |||
363 | public MySqlGroupsGroupsHandler(string connectionString, string realm, string store) | ||
364 | : base(connectionString, realm, store) | ||
365 | { | ||
366 | } | ||
367 | |||
368 | } | ||
369 | |||
370 | public class MySqlGroupsMembershipHandler : MySQLGenericTableHandler<MembershipData> | ||
371 | { | ||
372 | protected override Assembly Assembly | ||
373 | { | ||
374 | // WARNING! Moving migrations to this assembly!!! | ||
375 | get { return GetType().Assembly; } | ||
376 | } | ||
377 | |||
378 | public MySqlGroupsMembershipHandler(string connectionString, string realm) | ||
379 | : base(connectionString, realm, string.Empty) | ||
380 | { | ||
381 | } | ||
382 | |||
383 | } | ||
384 | |||
385 | public class MySqlGroupsRolesHandler : MySQLGenericTableHandler<RoleData> | ||
386 | { | ||
387 | protected override Assembly Assembly | ||
388 | { | ||
389 | // WARNING! Moving migrations to this assembly!!! | ||
390 | get { return GetType().Assembly; } | ||
391 | } | ||
392 | |||
393 | public MySqlGroupsRolesHandler(string connectionString, string realm) | ||
394 | : base(connectionString, realm, string.Empty) | ||
395 | { | ||
396 | } | ||
397 | |||
398 | } | ||
399 | |||
400 | public class MySqlGroupsRoleMembershipHandler : MySQLGenericTableHandler<RoleMembershipData> | ||
401 | { | ||
402 | protected override Assembly Assembly | ||
403 | { | ||
404 | // WARNING! Moving migrations to this assembly!!! | ||
405 | get { return GetType().Assembly; } | ||
406 | } | ||
407 | |||
408 | public MySqlGroupsRoleMembershipHandler(string connectionString, string realm) | ||
409 | : base(connectionString, realm, string.Empty) | ||
410 | { | ||
411 | } | ||
412 | |||
413 | } | ||
414 | |||
415 | public class MySqlGroupsInvitesHandler : MySQLGenericTableHandler<InvitationData> | ||
416 | { | ||
417 | protected override Assembly Assembly | ||
418 | { | ||
419 | // WARNING! Moving migrations to this assembly!!! | ||
420 | get { return GetType().Assembly; } | ||
421 | } | ||
422 | |||
423 | public MySqlGroupsInvitesHandler(string connectionString, string realm) | ||
424 | : base(connectionString, realm, string.Empty) | ||
425 | { | ||
426 | } | ||
427 | |||
428 | public void DeleteOld() | ||
429 | { | ||
430 | uint now = (uint)Util.UnixTimeSinceEpoch(); | ||
431 | |||
432 | using (MySqlCommand cmd = new MySqlCommand()) | ||
433 | { | ||
434 | cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm); | ||
435 | cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old | ||
436 | |||
437 | ExecuteNonQuery(cmd); | ||
438 | } | ||
439 | |||
440 | } | ||
441 | } | ||
442 | |||
443 | public class MySqlGroupsNoticesHandler : MySQLGenericTableHandler<NoticeData> | ||
444 | { | ||
445 | protected override Assembly Assembly | ||
446 | { | ||
447 | // WARNING! Moving migrations to this assembly!!! | ||
448 | get { return GetType().Assembly; } | ||
449 | } | ||
450 | |||
451 | public MySqlGroupsNoticesHandler(string connectionString, string realm) | ||
452 | : base(connectionString, realm, string.Empty) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | public void DeleteOld() | ||
457 | { | ||
458 | uint now = (uint)Util.UnixTimeSinceEpoch(); | ||
459 | |||
460 | using (MySqlCommand cmd = new MySqlCommand()) | ||
461 | { | ||
462 | cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm); | ||
463 | cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old | ||
464 | |||
465 | ExecuteNonQuery(cmd); | ||
466 | } | ||
467 | |||
468 | } | ||
469 | } | ||
470 | |||
471 | public class MySqlGroupsPrincipalsHandler : MySQLGenericTableHandler<PrincipalData> | ||
472 | { | ||
473 | protected override Assembly Assembly | ||
474 | { | ||
475 | // WARNING! Moving migrations to this assembly!!! | ||
476 | get { return GetType().Assembly; } | ||
477 | } | ||
478 | |||
479 | public MySqlGroupsPrincipalsHandler(string connectionString, string realm) | ||
480 | : base(connectionString, realm, string.Empty) | ||
481 | { | ||
482 | } | ||
483 | } | ||
484 | } | ||
diff --git a/OpenSim/Data/MySQL/MySQLOfflineIMData.cs b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs new file mode 100644 index 0000000..252f358 --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLOfflineIMData.cs | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Data.MySQL; | ||
35 | |||
36 | using OpenMetaverse; | ||
37 | using MySql.Data.MySqlClient; | ||
38 | |||
39 | namespace OpenSim.Data.MySQL | ||
40 | { | ||
41 | public class MySQLOfflineIMData : MySQLGenericTableHandler<OfflineIMData>, IOfflineIMData | ||
42 | { | ||
43 | public MySQLOfflineIMData(string connectionString, string realm) | ||
44 | : base(connectionString, realm, "IM_Store") | ||
45 | { | ||
46 | } | ||
47 | |||
48 | public void DeleteOld() | ||
49 | { | ||
50 | uint now = (uint)Util.UnixTimeSinceEpoch(); | ||
51 | |||
52 | using (MySqlCommand cmd = new MySqlCommand()) | ||
53 | { | ||
54 | cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm); | ||
55 | cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old | ||
56 | |||
57 | ExecuteNonQuery(cmd); | ||
58 | } | ||
59 | |||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index 7808060..3f90639 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs | |||
@@ -95,5 +95,19 @@ namespace OpenSim.Data.MySQL | |||
95 | 95 | ||
96 | return true; | 96 | return true; |
97 | } | 97 | } |
98 | |||
99 | public bool VerifyAgent(UUID agentId, UUID secureSessionID) | ||
100 | { | ||
101 | PresenceData[] ret = Get("SecureSessionID", | ||
102 | secureSessionID.ToString()); | ||
103 | |||
104 | if (ret.Length == 0) | ||
105 | return false; | ||
106 | |||
107 | if(ret[0].UserID != agentId.ToString()) | ||
108 | return false; | ||
109 | |||
110 | return true; | ||
111 | } | ||
98 | } | 112 | } |
99 | } \ No newline at end of file | 113 | } \ No newline at end of file |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index d5a4f46..5320543 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -176,7 +176,7 @@ namespace OpenSim.Data.MySQL | |||
176 | "PassCollisions, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | 177 | "LinkNumber, MediaURL, KeyframeMotion, " + |
178 | "PhysicsShapeType, Density, GravityModifier, " + | 178 | "PhysicsShapeType, Density, GravityModifier, " + |
179 | "Friction, Restitution, Vehicle " + | 179 | "Friction, Restitution, Vehicle, DynAttrs " + |
180 | ") values (" + "?UUID, " + | 180 | ") values (" + "?UUID, " + |
181 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
182 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
@@ -211,7 +211,7 @@ namespace OpenSim.Data.MySQL | |||
211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + |
213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
214 | "?Friction, ?Restitution, ?Vehicle)"; | 214 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs)"; |
215 | 215 | ||
216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
217 | 217 | ||
@@ -228,7 +228,8 @@ namespace OpenSim.Data.MySQL | |||
228 | "PathTaperX, PathTaperY, PathTwist, " + | 228 | "PathTaperX, PathTaperY, PathTwist, " + |
229 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + | 229 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + |
230 | "ProfileCurve, ProfileHollow, Texture, " + | 230 | "ProfileCurve, ProfileHollow, Texture, " + |
231 | "ExtraParams, State, Media) values (?UUID, " + | 231 | "ExtraParams, State, Media) " + |
232 | "values (?UUID, " + | ||
232 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + | 233 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + |
233 | "?PCode, ?PathBegin, ?PathEnd, " + | 234 | "?PCode, ?PathBegin, ?PathEnd, " + |
234 | "?PathScaleX, ?PathScaleY, " + | 235 | "?PathScaleX, ?PathScaleY, " + |
@@ -1321,6 +1322,11 @@ namespace OpenSim.Data.MySQL | |||
1321 | 1322 | ||
1322 | if (!(row["MediaURL"] is System.DBNull)) | 1323 | if (!(row["MediaURL"] is System.DBNull)) |
1323 | prim.MediaUrl = (string)row["MediaURL"]; | 1324 | prim.MediaUrl = (string)row["MediaURL"]; |
1325 | |||
1326 | if (!(row["DynAttrs"] is System.DBNull)) | ||
1327 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); | ||
1328 | else | ||
1329 | prim.DynAttrs = new DAMap(); | ||
1324 | 1330 | ||
1325 | if (!(row["KeyframeMotion"] is DBNull)) | 1331 | if (!(row["KeyframeMotion"] is DBNull)) |
1326 | { | 1332 | { |
@@ -1721,16 +1727,21 @@ namespace OpenSim.Data.MySQL | |||
1721 | else | 1727 | else |
1722 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1728 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1723 | 1729 | ||
1730 | if (prim.VehicleParams != null) | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1732 | else | ||
1733 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1734 | |||
1735 | if (prim.DynAttrs.Count > 0) | ||
1736 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | ||
1737 | else | ||
1738 | cmd.Parameters.AddWithValue("DynAttrs", null); | ||
1739 | |||
1724 | cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType); | 1740 | cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType); |
1725 | cmd.Parameters.AddWithValue("Density", (double)prim.Density); | 1741 | cmd.Parameters.AddWithValue("Density", (double)prim.Density); |
1726 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | 1742 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); |
1727 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | 1743 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); |
1728 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); | 1744 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); |
1729 | |||
1730 | if (prim.VehicleParams != null) | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1732 | else | ||
1733 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1734 | } | 1745 | } |
1735 | 1746 | ||
1736 | /// <summary> | 1747 | /// <summary> |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 9a50373..15ac921 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -50,6 +50,11 @@ namespace OpenSim.Data.MySQL | |||
50 | get { return GetType().Assembly; } | 50 | get { return GetType().Assembly; } |
51 | } | 51 | } |
52 | 52 | ||
53 | /// <summary> | ||
54 | /// Number of days that must pass before we update the access time on an asset when it has been fetched. | ||
55 | /// </summary> | ||
56 | private const int DaysBetweenAccessTimeUpdates = 30; | ||
57 | |||
53 | private bool m_enableCompression = false; | 58 | private bool m_enableCompression = false; |
54 | private string m_connectionString; | 59 | private string m_connectionString; |
55 | private object m_dbLock = new object(); | 60 | private object m_dbLock = new object(); |
@@ -133,10 +138,10 @@ namespace OpenSim.Data.MySQL | |||
133 | dbcon.Open(); | 138 | dbcon.Open(); |
134 | 139 | ||
135 | using (MySqlCommand cmd = new MySqlCommand( | 140 | using (MySqlCommand cmd = new MySqlCommand( |
136 | "SELECT name, description, asset_type, local, temporary, asset_flags, creator_id, data FROM xassetsmeta JOIN xassetsdata ON xassetsmeta.hash = xassetsdata.hash WHERE id=?id", | 141 | "SELECT Name, Description, AccessTime, AssetType, Local, Temporary, AssetFlags, CreatorID, Data FROM XAssetsMeta JOIN XAssetsData ON XAssetsMeta.Hash = XAssetsData.Hash WHERE ID=?ID", |
137 | dbcon)) | 142 | dbcon)) |
138 | { | 143 | { |
139 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); | 144 | cmd.Parameters.AddWithValue("?ID", assetID.ToString()); |
140 | 145 | ||
141 | try | 146 | try |
142 | { | 147 | { |
@@ -144,18 +149,18 @@ namespace OpenSim.Data.MySQL | |||
144 | { | 149 | { |
145 | if (dbReader.Read()) | 150 | if (dbReader.Read()) |
146 | { | 151 | { |
147 | asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["asset_type"], dbReader["creator_id"].ToString()); | 152 | asset = new AssetBase(assetID, (string)dbReader["Name"], (sbyte)dbReader["AssetType"], dbReader["CreatorID"].ToString()); |
148 | asset.Data = (byte[])dbReader["data"]; | 153 | asset.Data = (byte[])dbReader["Data"]; |
149 | asset.Description = (string)dbReader["description"]; | 154 | asset.Description = (string)dbReader["Description"]; |
150 | 155 | ||
151 | string local = dbReader["local"].ToString(); | 156 | string local = dbReader["Local"].ToString(); |
152 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) | 157 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) |
153 | asset.Local = true; | 158 | asset.Local = true; |
154 | else | 159 | else |
155 | asset.Local = false; | 160 | asset.Local = false; |
156 | 161 | ||
157 | asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); | 162 | asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]); |
158 | asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 163 | asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); |
159 | 164 | ||
160 | if (m_enableCompression) | 165 | if (m_enableCompression) |
161 | { | 166 | { |
@@ -171,12 +176,14 @@ namespace OpenSim.Data.MySQL | |||
171 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); | 176 | // asset.ID, asset.Name, asset.Data.Length, compressedLength); |
172 | } | 177 | } |
173 | } | 178 | } |
179 | |||
180 | UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]); | ||
174 | } | 181 | } |
175 | } | 182 | } |
176 | } | 183 | } |
177 | catch (Exception e) | 184 | catch (Exception e) |
178 | { | 185 | { |
179 | m_log.Error("[MYSQL XASSET DATA]: MySql failure fetching asset " + assetID + ": " + e.Message); | 186 | m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e); |
180 | } | 187 | } |
181 | } | 188 | } |
182 | } | 189 | } |
@@ -204,14 +211,18 @@ namespace OpenSim.Data.MySQL | |||
204 | if (asset.Name.Length > 64) | 211 | if (asset.Name.Length > 64) |
205 | { | 212 | { |
206 | assetName = asset.Name.Substring(0, 64); | 213 | assetName = asset.Name.Substring(0, 64); |
207 | m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 214 | m_log.WarnFormat( |
215 | "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
216 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
208 | } | 217 | } |
209 | 218 | ||
210 | string assetDescription = asset.Description; | 219 | string assetDescription = asset.Description; |
211 | if (asset.Description.Length > 64) | 220 | if (asset.Description.Length > 64) |
212 | { | 221 | { |
213 | assetDescription = asset.Description.Substring(0, 64); | 222 | assetDescription = asset.Description.Substring(0, 64); |
214 | m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 223 | m_log.WarnFormat( |
224 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
225 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
215 | } | 226 | } |
216 | 227 | ||
217 | if (m_enableCompression) | 228 | if (m_enableCompression) |
@@ -238,23 +249,23 @@ namespace OpenSim.Data.MySQL | |||
238 | { | 249 | { |
239 | using (MySqlCommand cmd = | 250 | using (MySqlCommand cmd = |
240 | new MySqlCommand( | 251 | new MySqlCommand( |
241 | "replace INTO xassetsmeta(id, hash, name, description, asset_type, local, temporary, create_time, access_time, asset_flags, creator_id)" + | 252 | "replace INTO XAssetsMeta(ID, Hash, Name, Description, AssetType, Local, Temporary, CreateTime, AccessTime, AssetFlags, CreatorID)" + |
242 | "VALUES(?id, ?hash, ?name, ?description, ?asset_type, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?creator_id)", | 253 | "VALUES(?ID, ?Hash, ?Name, ?Description, ?AssetType, ?Local, ?Temporary, ?CreateTime, ?AccessTime, ?AssetFlags, ?CreatorID)", |
243 | dbcon)) | 254 | dbcon)) |
244 | { | 255 | { |
245 | // create unix epoch time | 256 | // create unix epoch time |
246 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 257 | int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); |
247 | cmd.Parameters.AddWithValue("?id", asset.ID); | 258 | cmd.Parameters.AddWithValue("?ID", asset.ID); |
248 | cmd.Parameters.AddWithValue("?hash", hash); | 259 | cmd.Parameters.AddWithValue("?Hash", hash); |
249 | cmd.Parameters.AddWithValue("?name", assetName); | 260 | cmd.Parameters.AddWithValue("?Name", assetName); |
250 | cmd.Parameters.AddWithValue("?description", assetDescription); | 261 | cmd.Parameters.AddWithValue("?Description", assetDescription); |
251 | cmd.Parameters.AddWithValue("?asset_type", asset.Type); | 262 | cmd.Parameters.AddWithValue("?AssetType", asset.Type); |
252 | cmd.Parameters.AddWithValue("?local", asset.Local); | 263 | cmd.Parameters.AddWithValue("?Local", asset.Local); |
253 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 264 | cmd.Parameters.AddWithValue("?Temporary", asset.Temporary); |
254 | cmd.Parameters.AddWithValue("?create_time", now); | 265 | cmd.Parameters.AddWithValue("?CreateTime", now); |
255 | cmd.Parameters.AddWithValue("?access_time", now); | 266 | cmd.Parameters.AddWithValue("?AccessTime", now); |
256 | cmd.Parameters.AddWithValue("?creator_id", asset.Metadata.CreatorID); | 267 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); |
257 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 268 | cmd.Parameters.AddWithValue("?AssetFlags", (int)asset.Flags); |
258 | cmd.ExecuteNonQuery(); | 269 | cmd.ExecuteNonQuery(); |
259 | } | 270 | } |
260 | } | 271 | } |
@@ -274,11 +285,11 @@ namespace OpenSim.Data.MySQL | |||
274 | { | 285 | { |
275 | using (MySqlCommand cmd = | 286 | using (MySqlCommand cmd = |
276 | new MySqlCommand( | 287 | new MySqlCommand( |
277 | "INSERT INTO xassetsdata(hash, data) VALUES(?hash, ?data)", | 288 | "INSERT INTO XAssetsData(Hash, Data) VALUES(?Hash, ?Data)", |
278 | dbcon)) | 289 | dbcon)) |
279 | { | 290 | { |
280 | cmd.Parameters.AddWithValue("?hash", hash); | 291 | cmd.Parameters.AddWithValue("?Hash", hash); |
281 | cmd.Parameters.AddWithValue("?data", asset.Data); | 292 | cmd.Parameters.AddWithValue("?Data", asset.Data); |
282 | cmd.ExecuteNonQuery(); | 293 | cmd.ExecuteNonQuery(); |
283 | } | 294 | } |
284 | } | 295 | } |
@@ -299,41 +310,49 @@ namespace OpenSim.Data.MySQL | |||
299 | } | 310 | } |
300 | } | 311 | } |
301 | 312 | ||
302 | // private void UpdateAccessTime(AssetBase asset) | 313 | /// <summary> |
303 | // { | 314 | /// Updates the access time of the asset if it was accessed above a given threshhold amount of time. |
304 | // lock (m_dbLock) | 315 | /// </summary> |
305 | // { | 316 | /// <remarks> |
306 | // using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 317 | /// This gives us some insight into assets which haven't ben accessed for a long period. This is only done |
307 | // { | 318 | /// over the threshold time to avoid excessive database writes as assets are fetched. |
308 | // dbcon.Open(); | 319 | /// </remarks> |
309 | // MySqlCommand cmd = | 320 | /// <param name='asset'></param> |
310 | // new MySqlCommand("update assets set access_time=?access_time where id=?id", | 321 | /// <param name='accessTime'></param> |
311 | // dbcon); | 322 | private void UpdateAccessTime(AssetMetadata assetMetadata, int accessTime) |
312 | // | 323 | { |
313 | // // need to ensure we dispose | 324 | DateTime now = DateTime.UtcNow; |
314 | // try | 325 | |
315 | // { | 326 | if ((now - Utils.UnixTimeToDateTime(accessTime)).TotalDays < DaysBetweenAccessTimeUpdates) |
316 | // using (cmd) | 327 | return; |
317 | // { | 328 | |
318 | // // create unix epoch time | 329 | lock (m_dbLock) |
319 | // int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow); | 330 | { |
320 | // cmd.Parameters.AddWithValue("?id", asset.ID); | 331 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
321 | // cmd.Parameters.AddWithValue("?access_time", now); | 332 | { |
322 | // cmd.ExecuteNonQuery(); | 333 | dbcon.Open(); |
323 | // cmd.Dispose(); | 334 | MySqlCommand cmd = |
324 | // } | 335 | new MySqlCommand("update XAssetsMeta set AccessTime=?AccessTime where ID=?ID", dbcon); |
325 | // } | 336 | |
326 | // catch (Exception e) | 337 | try |
327 | // { | 338 | { |
328 | // m_log.ErrorFormat( | 339 | using (cmd) |
329 | // "[ASSETS DB]: " + | 340 | { |
330 | // "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() | 341 | // create unix epoch time |
331 | // + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); | 342 | cmd.Parameters.AddWithValue("?ID", assetMetadata.ID); |
332 | // } | 343 | cmd.Parameters.AddWithValue("?AccessTime", (int)Utils.DateTimeToUnixTime(now)); |
333 | // } | 344 | cmd.ExecuteNonQuery(); |
334 | // } | 345 | } |
335 | // | 346 | } |
336 | // } | 347 | catch (Exception e) |
348 | { | ||
349 | m_log.ErrorFormat( | ||
350 | "[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}", | ||
351 | assetMetadata.ID, assetMetadata.Name); | ||
352 | } | ||
353 | } | ||
354 | } | ||
355 | } | ||
337 | 356 | ||
338 | /// <summary> | 357 | /// <summary> |
339 | /// We assume we already have the m_dbLock. | 358 | /// We assume we already have the m_dbLock. |
@@ -349,9 +368,9 @@ namespace OpenSim.Data.MySQL | |||
349 | 368 | ||
350 | bool exists = false; | 369 | bool exists = false; |
351 | 370 | ||
352 | using (MySqlCommand cmd = new MySqlCommand("SELECT hash FROM xassetsdata WHERE hash=?hash", dbcon)) | 371 | using (MySqlCommand cmd = new MySqlCommand("SELECT Hash FROM XAssetsData WHERE Hash=?Hash", dbcon)) |
353 | { | 372 | { |
354 | cmd.Parameters.AddWithValue("?hash", hash); | 373 | cmd.Parameters.AddWithValue("?Hash", hash); |
355 | 374 | ||
356 | try | 375 | try |
357 | { | 376 | { |
@@ -391,9 +410,9 @@ namespace OpenSim.Data.MySQL | |||
391 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 410 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
392 | { | 411 | { |
393 | dbcon.Open(); | 412 | dbcon.Open(); |
394 | using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM xassetsmeta WHERE id=?id", dbcon)) | 413 | using (MySqlCommand cmd = new MySqlCommand("SELECT ID FROM XAssetsMeta WHERE ID=?ID", dbcon)) |
395 | { | 414 | { |
396 | cmd.Parameters.AddWithValue("?id", uuid.ToString()); | 415 | cmd.Parameters.AddWithValue("?ID", uuid.ToString()); |
397 | 416 | ||
398 | try | 417 | try |
399 | { | 418 | { |
@@ -408,8 +427,7 @@ namespace OpenSim.Data.MySQL | |||
408 | } | 427 | } |
409 | catch (Exception e) | 428 | catch (Exception e) |
410 | { | 429 | { |
411 | m_log.ErrorFormat( | 430 | m_log.Error(string.Format("[XASSETS DB]: MySql failure fetching asset {0}", uuid), e); |
412 | "[XASSETS DB]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString(), uuid); | ||
413 | } | 431 | } |
414 | } | 432 | } |
415 | } | 433 | } |
@@ -418,6 +436,7 @@ namespace OpenSim.Data.MySQL | |||
418 | return assetExists; | 436 | return assetExists; |
419 | } | 437 | } |
420 | 438 | ||
439 | |||
421 | /// <summary> | 440 | /// <summary> |
422 | /// Returns a list of AssetMetadata objects. The list is a subset of | 441 | /// Returns a list of AssetMetadata objects. The list is a subset of |
423 | /// the entire data set offset by <paramref name="start" /> containing | 442 | /// the entire data set offset by <paramref name="start" /> containing |
@@ -435,7 +454,7 @@ namespace OpenSim.Data.MySQL | |||
435 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 454 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
436 | { | 455 | { |
437 | dbcon.Open(); | 456 | dbcon.Open(); |
438 | MySqlCommand cmd = new MySqlCommand("SELECT name,description,asset_type,temporary,id,asset_flags,creator_id FROM xassetsmeta LIMIT ?start, ?count", dbcon); | 457 | MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon); |
439 | cmd.Parameters.AddWithValue("?start", start); | 458 | cmd.Parameters.AddWithValue("?start", start); |
440 | cmd.Parameters.AddWithValue("?count", count); | 459 | cmd.Parameters.AddWithValue("?count", count); |
441 | 460 | ||
@@ -446,17 +465,19 @@ namespace OpenSim.Data.MySQL | |||
446 | while (dbReader.Read()) | 465 | while (dbReader.Read()) |
447 | { | 466 | { |
448 | AssetMetadata metadata = new AssetMetadata(); | 467 | AssetMetadata metadata = new AssetMetadata(); |
449 | metadata.Name = (string)dbReader["name"]; | 468 | metadata.Name = (string)dbReader["Name"]; |
450 | metadata.Description = (string)dbReader["description"]; | 469 | metadata.Description = (string)dbReader["Description"]; |
451 | metadata.Type = (sbyte)dbReader["asset_type"]; | 470 | metadata.Type = (sbyte)dbReader["AssetType"]; |
452 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. | 471 | metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct. |
453 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 472 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); |
454 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | 473 | metadata.FullID = DBGuid.FromDB(dbReader["ID"]); |
455 | metadata.CreatorID = dbReader["creator_id"].ToString(); | 474 | metadata.CreatorID = dbReader["CreatorID"].ToString(); |
456 | 475 | ||
457 | // We'll ignore this for now - it appears unused! | 476 | // We'll ignore this for now - it appears unused! |
458 | // metadata.SHA1 = dbReader["hash"]); | 477 | // metadata.SHA1 = dbReader["hash"]); |
459 | 478 | ||
479 | UpdateAccessTime(metadata, (int)dbReader["AccessTime"]); | ||
480 | |||
460 | retList.Add(metadata); | 481 | retList.Add(metadata); |
461 | } | 482 | } |
462 | } | 483 | } |
@@ -481,9 +502,9 @@ namespace OpenSim.Data.MySQL | |||
481 | { | 502 | { |
482 | dbcon.Open(); | 503 | dbcon.Open(); |
483 | 504 | ||
484 | using (MySqlCommand cmd = new MySqlCommand("delete from xassetsmeta where id=?id", dbcon)) | 505 | using (MySqlCommand cmd = new MySqlCommand("delete from XAssetsMeta where ID=?ID", dbcon)) |
485 | { | 506 | { |
486 | cmd.Parameters.AddWithValue("?id", id); | 507 | cmd.Parameters.AddWithValue("?ID", id); |
487 | cmd.ExecuteNonQuery(); | 508 | cmd.ExecuteNonQuery(); |
488 | } | 509 | } |
489 | 510 | ||
diff --git a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs index ab3fe36..1146d92 100644 --- a/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/MySQL/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.7.5.*")] | 64 | [assembly : AssemblyVersion("0.7.6.*")] |
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | 65 | |
diff --git a/OpenSim/Data/MySQL/Resources/IM_Store.migrations b/OpenSim/Data/MySQL/Resources/IM_Store.migrations new file mode 100644 index 0000000..7cfcd43 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/IM_Store.migrations | |||
@@ -0,0 +1,24 @@ | |||
1 | :VERSION 1 # -------------------------- | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | CREATE TABLE `im_offline` ( | ||
6 | `ID` MEDIUMINT NOT NULL AUTO_INCREMENT, | ||
7 | `PrincipalID` char(36) NOT NULL default '', | ||
8 | `Message` text NOT NULL, | ||
9 | `TMStamp` timestamp NOT NULL, | ||
10 | PRIMARY KEY (`ID`), | ||
11 | KEY `PrincipalID` (`PrincipalID`) | ||
12 | ) ENGINE=MyISAM; | ||
13 | |||
14 | COMMIT; | ||
15 | |||
16 | :VERSION 2 # -------------------------- | ||
17 | |||
18 | BEGIN; | ||
19 | |||
20 | INSERT INTO `im_offline` SELECT * from `diva_im_offline`; | ||
21 | DROP TABLE `diva_im_offline`; | ||
22 | DELETE FROM `migrations` WHERE name='diva_im_Store'; | ||
23 | |||
24 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index c4b0832..bda1b6a 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -902,3 +902,23 @@ BEGIN; | |||
902 | CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`)); | 902 | CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`)); |
903 | 903 | ||
904 | COMMIT; | 904 | COMMIT; |
905 | |||
906 | :VERSION 46 #---------------- Dynamic attributes | ||
907 | |||
908 | BEGIN; | ||
909 | |||
910 | ALTER TABLE prims ADD COLUMN DynAttrs TEXT; | ||
911 | |||
912 | COMMIT; | ||
913 | |||
914 | :VERSION 47 #---------------- Extra physics params | ||
915 | |||
916 | BEGIN; | ||
917 | |||
918 | ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0'; | ||
919 | ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000'; | ||
920 | ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1'; | ||
921 | ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | ||
922 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | ||
923 | |||
924 | COMMIT; | ||
diff --git a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations index d3cca5e..0c49d0d 100644 --- a/OpenSim/Data/MySQL/Resources/XAssetStore.migrations +++ b/OpenSim/Data/MySQL/Resources/XAssetStore.migrations | |||
@@ -3,24 +3,24 @@ | |||
3 | 3 | ||
4 | BEGIN; | 4 | BEGIN; |
5 | 5 | ||
6 | CREATE TABLE `xassetsmeta` ( | 6 | CREATE TABLE `XAssetsMeta` ( |
7 | `id` char(36) NOT NULL, | 7 | `ID` char(36) NOT NULL, |
8 | `hash` binary(32) NOT NULL, | 8 | `Hash` binary(32) NOT NULL, |
9 | `name` varchar(64) NOT NULL, | 9 | `Name` varchar(64) NOT NULL, |
10 | `description` varchar(64) NOT NULL, | 10 | `Description` varchar(64) NOT NULL, |
11 | `asset_type` tinyint(4) NOT NULL, | 11 | `AssetType` tinyint(4) NOT NULL, |
12 | `local` tinyint(1) NOT NULL, | 12 | `Local` tinyint(1) NOT NULL, |
13 | `temporary` tinyint(1) NOT NULL, | 13 | `Temporary` tinyint(1) NOT NULL, |
14 | `create_time` int(11) NOT NULL, | 14 | `CreateTime` int(11) NOT NULL, |
15 | `access_time` int(11) NOT NULL, | 15 | `AccessTime` int(11) NOT NULL, |
16 | `asset_flags` int(11) NOT NULL, | 16 | `AssetFlags` int(11) NOT NULL, |
17 | `creator_id` varchar(128) NOT NULL, | 17 | `CreatorID` varchar(128) NOT NULL, |
18 | PRIMARY KEY (`id`) | 18 | PRIMARY KEY (`id`) |
19 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; | 19 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; |
20 | 20 | ||
21 | CREATE TABLE `xassetsdata` ( | 21 | CREATE TABLE `XAssetsData` ( |
22 | `hash` binary(32) NOT NULL, | 22 | `Hash` binary(32) NOT NULL, |
23 | `data` longblob NOT NULL, | 23 | `Data` longblob NOT NULL, |
24 | PRIMARY KEY (`hash`) | 24 | PRIMARY KEY (`hash`) |
25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; | 25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1'; |
26 | 26 | ||
diff --git a/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations new file mode 100644 index 0000000..9e6f1c1 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/os_groups_Store.migrations | |||
@@ -0,0 +1,115 @@ | |||
1 | :VERSION 1 # -------------------------- | ||
2 | |||
3 | BEGIN; | ||
4 | |||
5 | CREATE TABLE `os_groups_groups` ( | ||
6 | `GroupID` char(36) NOT NULL default '', | ||
7 | `Location` varchar(255) NOT NULL default '', | ||
8 | `Name` varchar(255) NOT NULL default '', | ||
9 | `Charter` text NOT NULL, | ||
10 | `InsigniaID` char(36) NOT NULL default '', | ||
11 | `FounderID` char(36) NOT NULL default '', | ||
12 | `MembershipFee` int(11) NOT NULL default '0', | ||
13 | `OpenEnrollment` varchar(255) NOT NULL default '', | ||
14 | `ShowInList` int(4) NOT NULL default '0', | ||
15 | `AllowPublish` int(4) NOT NULL default '0', | ||
16 | `MaturePublish` int(4) NOT NULL default '0', | ||
17 | `OwnerRoleID` char(36) NOT NULL default '', | ||
18 | PRIMARY KEY (`GroupID`), | ||
19 | UNIQUE KEY `Name` (`Name`), | ||
20 | FULLTEXT KEY `Name_2` (`Name`) | ||
21 | ) ENGINE=MyISAM; | ||
22 | |||
23 | |||
24 | CREATE TABLE `os_groups_membership` ( | ||
25 | `GroupID`char(36) NOT NULL default '', | ||
26 | `PrincipalID` VARCHAR(255) NOT NULL default '', | ||
27 | `SelectedRoleID` char(36) NOT NULL default '', | ||
28 | `Contribution` int(11) NOT NULL default '0', | ||
29 | `ListInProfile` int(4) NOT NULL default '1', | ||
30 | `AcceptNotices` int(4) NOT NULL default '1', | ||
31 | `AccessToken` char(36) NOT NULL default '', | ||
32 | PRIMARY KEY (`GroupID`,`PrincipalID`), | ||
33 | KEY `PrincipalID` (`PrincipalID`) | ||
34 | ) ENGINE=MyISAM; | ||
35 | |||
36 | |||
37 | CREATE TABLE `os_groups_roles` ( | ||
38 | `GroupID` char(36) NOT NULL default '', | ||
39 | `RoleID` char(36) NOT NULL default '', | ||
40 | `Name` varchar(255) NOT NULL default '', | ||
41 | `Description` varchar(255) NOT NULL default '', | ||
42 | `Title` varchar(255) NOT NULL default '', | ||
43 | `Powers` bigint(20) unsigned NOT NULL default '0', | ||
44 | PRIMARY KEY (`GroupID`,`RoleID`), | ||
45 | KEY `GroupID` (`GroupID`) | ||
46 | ) ENGINE=MyISAM; | ||
47 | |||
48 | |||
49 | CREATE TABLE `os_groups_rolemembership` ( | ||
50 | `GroupID` char(36) NOT NULL default '', | ||
51 | `RoleID` char(36) NOT NULL default '', | ||
52 | `PrincipalID` VARCHAR(255) NOT NULL default '', | ||
53 | PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`), | ||
54 | KEY `PrincipalID` (`PrincipalID`) | ||
55 | ) ENGINE=MyISAM; | ||
56 | |||
57 | |||
58 | CREATE TABLE `os_groups_invites` ( | ||
59 | `InviteID` char(36) NOT NULL default '', | ||
60 | `GroupID` char(36) NOT NULL default '', | ||
61 | `RoleID` char(36) NOT NULL default '', | ||
62 | `PrincipalID` VARCHAR(255) NOT NULL default '', | ||
63 | `TMStamp` timestamp NOT NULL, | ||
64 | PRIMARY KEY (`InviteID`), | ||
65 | UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`) | ||
66 | ) ENGINE=MyISAM; | ||
67 | |||
68 | |||
69 | CREATE TABLE `os_groups_notices` ( | ||
70 | `GroupID` char(36) NOT NULL default '', | ||
71 | `NoticeID` char(36) NOT NULL default '', | ||
72 | `TMStamp` int(10) unsigned NOT NULL default '0', | ||
73 | `FromName` varchar(255) NOT NULL default '', | ||
74 | `Subject` varchar(255) NOT NULL default '', | ||
75 | `Message` text NOT NULL, | ||
76 | `HasAttachment` int(4) NOT NULL default '0', | ||
77 | `AttachmentType` int(4) NOT NULL default '0', | ||
78 | `AttachmentName` varchar(128) NOT NULL default '', | ||
79 | `AttachmentItemID` char(36) NOT NULL default '', | ||
80 | `AttachmentOwnerID` varchar(255) NOT NULL default '', | ||
81 | PRIMARY KEY (`NoticeID`), | ||
82 | KEY `GroupID` (`GroupID`), | ||
83 | KEY `TMStamp` (`TMStamp`) | ||
84 | ) ENGINE=MyISAM; | ||
85 | |||
86 | CREATE TABLE `os_groups_principals` ( | ||
87 | `PrincipalID` VARCHAR(255) NOT NULL default '', | ||
88 | `ActiveGroupID` char(36) NOT NULL default '', | ||
89 | PRIMARY KEY (`PrincipalID`) | ||
90 | ) ENGINE=MyISAM; | ||
91 | |||
92 | COMMIT; | ||
93 | |||
94 | :VERSION 2 # -------------------------- | ||
95 | |||
96 | BEGIN; | ||
97 | |||
98 | INSERT INTO `os_groups_groups` SELECT * from `diva_groups_groups`; | ||
99 | DROP TABLE `diva_groups_groups`; | ||
100 | INSERT INTO `os_groups_membership` SELECT * from `diva_groups_membership`; | ||
101 | DROP TABLE `diva_groups_membership`; | ||
102 | INSERT INTO `os_groups_roles` SELECT * from `diva_groups_roles`; | ||
103 | DROP TABLE `diva_groups_roles`; | ||
104 | INSERT INTO `os_groups_rolemembership` SELECT * from `diva_groups_rolemembership`; | ||
105 | DROP TABLE `diva_groups_rolemembership`; | ||
106 | INSERT INTO `os_groups_invites` SELECT * from `diva_groups_invites`; | ||
107 | DROP TABLE `diva_groups_invites`; | ||
108 | INSERT INTO `os_groups_notices` SELECT * from `diva_groups_notices`; | ||
109 | DROP TABLE `diva_groups_notices`; | ||
110 | INSERT INTO `os_groups_principals` SELECT * from `diva_groups_principals`; | ||
111 | DROP TABLE `diva_groups_principals`; | ||
112 | |||
113 | DELETE FROM `migrations` WHERE name='diva_im_Store'; | ||
114 | |||
115 | COMMIT; \ No newline at end of file | ||
diff --git a/OpenSim/Data/Null/NullGenericDataHandler.cs b/OpenSim/Data/Null/NullGenericDataHandler.cs new file mode 100644 index 0000000..dd9d190 --- /dev/null +++ b/OpenSim/Data/Null/NullGenericDataHandler.cs | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Data; | ||
36 | |||
37 | namespace OpenSim.Data.Null | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Not a proper generic data handler yet - probably needs to actually store the data as well instead of relying | ||
41 | /// on descendent classes | ||
42 | /// </summary> | ||
43 | public class NullGenericDataHandler | ||
44 | { | ||
45 | protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities) | ||
46 | { | ||
47 | List<T> entities = inputEntities; | ||
48 | |||
49 | for (int i = 0; i < fields.Length; i++) | ||
50 | { | ||
51 | entities | ||
52 | = entities.Where( | ||
53 | e => | ||
54 | { | ||
55 | FieldInfo fi = typeof(T).GetField(fields[i]); | ||
56 | if (fi == null) | ||
57 | throw new NotImplementedException(string.Format("No field {0} for val {1}", fields[i], vals[i])); | ||
58 | |||
59 | return fi.GetValue(e).ToString() == vals[i]; | ||
60 | } | ||
61 | ).ToList(); | ||
62 | } | ||
63 | |||
64 | return entities; | ||
65 | } | ||
66 | } | ||
67 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/Null/NullPresenceData.cs b/OpenSim/Data/Null/NullPresenceData.cs index c06c223..b85b95e 100644 --- a/OpenSim/Data/Null/NullPresenceData.cs +++ b/OpenSim/Data/Null/NullPresenceData.cs | |||
@@ -222,5 +222,13 @@ namespace OpenSim.Data.Null | |||
222 | return true; | 222 | return true; |
223 | } | 223 | } |
224 | 224 | ||
225 | public bool VerifyAgent(UUID agentId, UUID secureSessionID) | ||
226 | { | ||
227 | if (Instance != this) | ||
228 | return Instance.VerifyAgent(agentId, secureSessionID); | ||
229 | |||
230 | return false; | ||
231 | } | ||
232 | |||
225 | } | 233 | } |
226 | } | 234 | } |
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index b4d701a..f707d98 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -113,11 +113,14 @@ namespace OpenSim.Data.Null | |||
113 | // Find region data | 113 | // Find region data |
114 | List<RegionData> ret = new List<RegionData>(); | 114 | List<RegionData> ret = new List<RegionData>(); |
115 | 115 | ||
116 | foreach (RegionData r in m_regionData.Values) | 116 | lock (m_regionData) |
117 | { | 117 | { |
118 | // m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); | 118 | foreach (RegionData r in m_regionData.Values) |
119 | { | ||
120 | // m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); | ||
119 | if (queryMatch(r.RegionName.ToLower())) | 121 | if (queryMatch(r.RegionName.ToLower())) |
120 | ret.Add(r); | 122 | ret.Add(r); |
123 | } | ||
121 | } | 124 | } |
122 | 125 | ||
123 | if (ret.Count > 0) | 126 | if (ret.Count > 0) |
@@ -133,10 +136,13 @@ namespace OpenSim.Data.Null | |||
133 | 136 | ||
134 | List<RegionData> ret = new List<RegionData>(); | 137 | List<RegionData> ret = new List<RegionData>(); |
135 | 138 | ||
136 | foreach (RegionData r in m_regionData.Values) | 139 | lock (m_regionData) |
137 | { | 140 | { |
138 | if (r.posX == posX && r.posY == posY) | 141 | foreach (RegionData r in m_regionData.Values) |
139 | ret.Add(r); | 142 | { |
143 | if (r.posX == posX && r.posY == posY) | ||
144 | ret.Add(r); | ||
145 | } | ||
140 | } | 146 | } |
141 | 147 | ||
142 | if (ret.Count > 0) | 148 | if (ret.Count > 0) |
@@ -150,8 +156,11 @@ namespace OpenSim.Data.Null | |||
150 | if (m_useStaticInstance && Instance != this) | 156 | if (m_useStaticInstance && Instance != this) |
151 | return Instance.Get(regionID, scopeID); | 157 | return Instance.Get(regionID, scopeID); |
152 | 158 | ||
153 | if (m_regionData.ContainsKey(regionID)) | 159 | lock (m_regionData) |
154 | return m_regionData[regionID]; | 160 | { |
161 | if (m_regionData.ContainsKey(regionID)) | ||
162 | return m_regionData[regionID]; | ||
163 | } | ||
155 | 164 | ||
156 | return null; | 165 | return null; |
157 | } | 166 | } |
@@ -163,10 +172,13 @@ namespace OpenSim.Data.Null | |||
163 | 172 | ||
164 | List<RegionData> ret = new List<RegionData>(); | 173 | List<RegionData> ret = new List<RegionData>(); |
165 | 174 | ||
166 | foreach (RegionData r in m_regionData.Values) | 175 | lock (m_regionData) |
167 | { | 176 | { |
168 | if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY) | 177 | foreach (RegionData r in m_regionData.Values) |
169 | ret.Add(r); | 178 | { |
179 | if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY) | ||
180 | ret.Add(r); | ||
181 | } | ||
170 | } | 182 | } |
171 | 183 | ||
172 | return ret; | 184 | return ret; |
@@ -180,7 +192,10 @@ namespace OpenSim.Data.Null | |||
180 | // m_log.DebugFormat( | 192 | // m_log.DebugFormat( |
181 | // "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID); | 193 | // "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID); |
182 | 194 | ||
183 | m_regionData[data.RegionID] = data; | 195 | lock (m_regionData) |
196 | { | ||
197 | m_regionData[data.RegionID] = data; | ||
198 | } | ||
184 | 199 | ||
185 | return true; | 200 | return true; |
186 | } | 201 | } |
@@ -190,10 +205,13 @@ namespace OpenSim.Data.Null | |||
190 | if (m_useStaticInstance && Instance != this) | 205 | if (m_useStaticInstance && Instance != this) |
191 | return Instance.SetDataItem(regionID, item, value); | 206 | return Instance.SetDataItem(regionID, item, value); |
192 | 207 | ||
193 | if (!m_regionData.ContainsKey(regionID)) | 208 | lock (m_regionData) |
194 | return false; | 209 | { |
210 | if (!m_regionData.ContainsKey(regionID)) | ||
211 | return false; | ||
195 | 212 | ||
196 | m_regionData[regionID].Data[item] = value; | 213 | m_regionData[regionID].Data[item] = value; |
214 | } | ||
197 | 215 | ||
198 | return true; | 216 | return true; |
199 | } | 217 | } |
@@ -205,10 +223,13 @@ namespace OpenSim.Data.Null | |||
205 | 223 | ||
206 | // m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID); | 224 | // m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID); |
207 | 225 | ||
208 | if (!m_regionData.ContainsKey(regionID)) | 226 | lock (m_regionData) |
209 | return false; | 227 | { |
228 | if (!m_regionData.ContainsKey(regionID)) | ||
229 | return false; | ||
210 | 230 | ||
211 | m_regionData.Remove(regionID); | 231 | m_regionData.Remove(regionID); |
232 | } | ||
212 | 233 | ||
213 | return true; | 234 | return true; |
214 | } | 235 | } |
@@ -238,10 +259,13 @@ namespace OpenSim.Data.Null | |||
238 | 259 | ||
239 | List<RegionData> ret = new List<RegionData>(); | 260 | List<RegionData> ret = new List<RegionData>(); |
240 | 261 | ||
241 | foreach (RegionData r in m_regionData.Values) | 262 | lock (m_regionData) |
242 | { | 263 | { |
243 | if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0) | 264 | foreach (RegionData r in m_regionData.Values) |
244 | ret.Add(r); | 265 | { |
266 | if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0) | ||
267 | ret.Add(r); | ||
268 | } | ||
245 | } | 269 | } |
246 | 270 | ||
247 | return ret; | 271 | return ret; |
diff --git a/OpenSim/Data/Null/NullXGroupData.cs b/OpenSim/Data/Null/NullXGroupData.cs new file mode 100644 index 0000000..7a86b9f --- /dev/null +++ b/OpenSim/Data/Null/NullXGroupData.cs | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Linq; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Data; | ||
38 | |||
39 | namespace OpenSim.Data.Null | ||
40 | { | ||
41 | public class NullXGroupData : NullGenericDataHandler, IXGroupData | ||
42 | { | ||
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private Dictionary<UUID, XGroup> m_groups = new Dictionary<UUID, XGroup>(); | ||
46 | |||
47 | public NullXGroupData(string connectionString, string realm) {} | ||
48 | |||
49 | public bool StoreGroup(XGroup group) | ||
50 | { | ||
51 | lock (m_groups) | ||
52 | { | ||
53 | m_groups[group.groupID] = group.Clone(); | ||
54 | } | ||
55 | |||
56 | return true; | ||
57 | } | ||
58 | |||
59 | public XGroup[] GetGroups(string field, string val) | ||
60 | { | ||
61 | return GetGroups(new string[] { field }, new string[] { val }); | ||
62 | } | ||
63 | |||
64 | public XGroup[] GetGroups(string[] fields, string[] vals) | ||
65 | { | ||
66 | lock (m_groups) | ||
67 | { | ||
68 | List<XGroup> origGroups = Get<XGroup>(fields, vals, m_groups.Values.ToList()); | ||
69 | |||
70 | return origGroups.Select(g => g.Clone()).ToArray(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | public bool DeleteGroups(string field, string val) | ||
75 | { | ||
76 | return DeleteGroups(new string[] { field }, new string[] { val }); | ||
77 | } | ||
78 | |||
79 | public bool DeleteGroups(string[] fields, string[] vals) | ||
80 | { | ||
81 | lock (m_groups) | ||
82 | { | ||
83 | XGroup[] groupsToDelete = GetGroups(fields, vals); | ||
84 | Array.ForEach(groupsToDelete, g => m_groups.Remove(g.groupID)); | ||
85 | } | ||
86 | |||
87 | return true; | ||
88 | } | ||
89 | } | ||
90 | } \ No newline at end of file | ||
diff --git a/OpenSim/Data/Null/Properties/AssemblyInfo.cs b/OpenSim/Data/Null/Properties/AssemblyInfo.cs index 43b0bb3..1e02c31 100644 --- a/OpenSim/Data/Null/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/Null/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.7.5.*")] | 64 | [assembly : AssemblyVersion("0.7.6.*")] |
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | 65 | |
diff --git a/OpenSim/Data/Properties/AssemblyInfo.cs b/OpenSim/Data/Properties/AssemblyInfo.cs index 0da1a6b..a85f473 100644 --- a/OpenSim/Data/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.7.5.*")] | 64 | [assembly : AssemblyVersion("0.7.6.*")] |
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | 65 | |
diff --git a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs index c9a8553..992982c 100644 --- a/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/SQLite/Properties/AssemblyInfo.cs | |||
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices; | |||
61 | // You can specify all the values or you can default the Revision and Build Numbers | 61 | // You can specify all the values or you can default the Revision and Build Numbers |
62 | // by using the '*' as shown below: | 62 | // by using the '*' as shown below: |
63 | 63 | ||
64 | [assembly : AssemblyVersion("0.7.5.*")] | 64 | [assembly : AssemblyVersion("0.7.6.*")] |
65 | [assembly : AssemblyFileVersion("0.6.5.0")] | 65 | |
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index e872977..c6f4b48 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations | |||
@@ -575,3 +575,20 @@ CREATE TABLE `regionenvironment` ( | |||
575 | ); | 575 | ); |
576 | 576 | ||
577 | COMMIT; | 577 | COMMIT; |
578 | |||
579 | :VERSION 27 | ||
580 | BEGIN; | ||
581 | ALTER TABLE prims ADD COLUMN DynAttrs TEXT; | ||
582 | COMMIT; | ||
583 | |||
584 | :VERSION 28 | ||
585 | |||
586 | BEGIN; | ||
587 | |||
588 | ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0'; | ||
589 | ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000'; | ||
590 | ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1'; | ||
591 | ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6'; | ||
592 | ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5'; | ||
593 | |||
594 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index b94a58c..82320ca 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Data.SQLite | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public class SQLiteAssetData : AssetDataBase | 47 | public class SQLiteAssetData : AssetDataBase |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | 51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; |
52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; | 52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; |
@@ -133,6 +133,24 @@ namespace OpenSim.Data.SQLite | |||
133 | /// <param name="asset">Asset Base</param> | 133 | /// <param name="asset">Asset Base</param> |
134 | override public bool StoreAsset(AssetBase asset) | 134 | override public bool StoreAsset(AssetBase asset) |
135 | { | 135 | { |
136 | string assetName = asset.Name; | ||
137 | if (asset.Name.Length > 64) | ||
138 | { | ||
139 | assetName = asset.Name.Substring(0, 64); | ||
140 | m_log.WarnFormat( | ||
141 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
142 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
143 | } | ||
144 | |||
145 | string assetDescription = asset.Description; | ||
146 | if (asset.Description.Length > 64) | ||
147 | { | ||
148 | assetDescription = asset.Description.Substring(0, 64); | ||
149 | m_log.WarnFormat( | ||
150 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
151 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
152 | } | ||
153 | |||
136 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
137 | if (ExistsAsset(asset.FullID)) | 155 | if (ExistsAsset(asset.FullID)) |
138 | { | 156 | { |
@@ -143,8 +161,8 @@ namespace OpenSim.Data.SQLite | |||
143 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 161 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
144 | { | 162 | { |
145 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 163 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
146 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 164 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
147 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 165 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
148 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 166 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
149 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 167 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
150 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 168 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
@@ -164,8 +182,8 @@ namespace OpenSim.Data.SQLite | |||
164 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 182 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
165 | { | 183 | { |
166 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 184 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
167 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 185 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
168 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 186 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
169 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 187 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
170 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 188 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
171 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 189 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 42cd59d..99a6598 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -1232,6 +1232,14 @@ namespace OpenSim.Data.SQLite | |||
1232 | createCol(prims, "VolumeDetect", typeof(Int16)); | 1232 | createCol(prims, "VolumeDetect", typeof(Int16)); |
1233 | 1233 | ||
1234 | createCol(prims, "MediaURL", typeof(String)); | 1234 | createCol(prims, "MediaURL", typeof(String)); |
1235 | |||
1236 | createCol(prims, "DynAttrs", typeof(String)); | ||
1237 | |||
1238 | createCol(prims, "PhysicsShapeType", typeof(Byte)); | ||
1239 | createCol(prims, "Density", typeof(Double)); | ||
1240 | createCol(prims, "GravityModifier", typeof(Double)); | ||
1241 | createCol(prims, "Friction", typeof(Double)); | ||
1242 | createCol(prims, "Restitution", typeof(Double)); | ||
1235 | 1243 | ||
1236 | // Add in contraints | 1244 | // Add in contraints |
1237 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 1245 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; |
@@ -1711,6 +1719,22 @@ namespace OpenSim.Data.SQLite | |||
1711 | // m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); | 1719 | // m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); |
1712 | prim.MediaUrl = (string)row["MediaURL"]; | 1720 | prim.MediaUrl = (string)row["MediaURL"]; |
1713 | } | 1721 | } |
1722 | |||
1723 | if (!(row["DynAttrs"] is System.DBNull)) | ||
1724 | { | ||
1725 | //m_log.DebugFormat("[SQLITE]: DynAttrs type [{0}]", row["DynAttrs"].GetType()); | ||
1726 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); | ||
1727 | } | ||
1728 | else | ||
1729 | { | ||
1730 | prim.DynAttrs = new DAMap(); | ||
1731 | } | ||
1732 | |||
1733 | prim.PhysicsShapeType = Convert.ToByte(row["PhysicsShapeType"]); | ||
1734 | prim.Density = Convert.ToSingle(row["Density"]); | ||
1735 | prim.GravityModifier = Convert.ToSingle(row["GravityModifier"]); | ||
1736 | prim.Friction = Convert.ToSingle(row["Friction"]); | ||
1737 | prim.Restitution = Convert.ToSingle(row["Restitution"]); | ||
1714 | 1738 | ||
1715 | return prim; | 1739 | return prim; |
1716 | } | 1740 | } |
@@ -2133,6 +2157,17 @@ namespace OpenSim.Data.SQLite | |||
2133 | row["VolumeDetect"] = 0; | 2157 | row["VolumeDetect"] = 0; |
2134 | 2158 | ||
2135 | row["MediaURL"] = prim.MediaUrl; | 2159 | row["MediaURL"] = prim.MediaUrl; |
2160 | |||
2161 | if (prim.DynAttrs.Count > 0) | ||
2162 | row["DynAttrs"] = prim.DynAttrs.ToXml(); | ||
2163 | else | ||
2164 | row["DynAttrs"] = null; | ||
2165 | |||
2166 | row["PhysicsShapeType"] = prim.PhysicsShapeType; | ||
2167 | row["Density"] = (double)prim.Density; | ||
2168 | row["GravityModifier"] = (double)prim.GravityModifier; | ||
2169 | row["Friction"] = (double)prim.Friction; | ||
2170 | row["Restitution"] = (double)prim.Restitution; | ||
2136 | } | 2171 | } |
2137 | 2172 | ||
2138 | /// <summary> | 2173 | /// <summary> |
@@ -2392,7 +2427,7 @@ namespace OpenSim.Data.SQLite | |||
2392 | 2427 | ||
2393 | if (!(row["Media"] is System.DBNull)) | 2428 | if (!(row["Media"] is System.DBNull)) |
2394 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 2429 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
2395 | 2430 | ||
2396 | return s; | 2431 | return s; |
2397 | } | 2432 | } |
2398 | 2433 | ||
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index 1174e2f..8cb2ee0 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs | |||
@@ -49,7 +49,7 @@ using OpenSim.Data.SQLite; | |||
49 | namespace OpenSim.Data.Tests | 49 | namespace OpenSim.Data.Tests |
50 | { | 50 | { |
51 | [TestFixture(Description = "Asset store tests (SQLite)")] | 51 | [TestFixture(Description = "Asset store tests (SQLite)")] |
52 | public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData> | 52 | public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData> |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index 7d85f0c..69b79bf 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs | |||
@@ -33,6 +33,7 @@ using NUnit.Framework; | |||
33 | using NUnit.Framework.Constraints; | 33 | using NUnit.Framework.Constraints; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Tests.Common; | ||
36 | using log4net; | 37 | using log4net; |
37 | using System.Data; | 38 | using System.Data; |
38 | using System.Data.Common; | 39 | using System.Data.Common; |
@@ -43,6 +44,12 @@ namespace OpenSim.Data.Tests | |||
43 | /// <summary>This is a base class for testing any Data service for any DBMS. | 44 | /// <summary>This is a base class for testing any Data service for any DBMS. |
44 | /// Requires NUnit 2.5 or better (to support the generics). | 45 | /// Requires NUnit 2.5 or better (to support the generics). |
45 | /// </summary> | 46 | /// </summary> |
47 | /// <remarks> | ||
48 | /// FIXME: Should extend OpenSimTestCase but compile on mono 2.4.3 currently fails with | ||
49 | /// AssetTests`2 : System.MemberAccessException : Cannot create an instance of OpenSim.Data.Tests.AssetTests`2[TConn,TAssetData] because Type.ContainsGenericParameters is true. | ||
50 | /// and similar on EstateTests, InventoryTests and RegionTests. | ||
51 | /// Runs fine with mono 2.10.8.1, so easiest thing is to wait until min Mono version uplifts. | ||
52 | /// </remarks> | ||
46 | /// <typeparam name="TConn"></typeparam> | 53 | /// <typeparam name="TConn"></typeparam> |
47 | /// <typeparam name="TService"></typeparam> | 54 | /// <typeparam name="TService"></typeparam> |
48 | public class BasicDataServiceTest<TConn, TService> | 55 | public class BasicDataServiceTest<TConn, TService> |
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs index 6c79bda..b99525a 100644 --- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs +++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs | |||
@@ -36,6 +36,7 @@ using NUnit.Framework; | |||
36 | using NUnit.Framework.Constraints; | 36 | using NUnit.Framework.Constraints; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Tests.Common; | ||
39 | 40 | ||
40 | namespace OpenSim.Data.Tests | 41 | namespace OpenSim.Data.Tests |
41 | { | 42 | { |
@@ -254,7 +255,7 @@ namespace OpenSim.Data.Tests | |||
254 | } | 255 | } |
255 | 256 | ||
256 | [TestFixture] | 257 | [TestFixture] |
257 | public class PropertyCompareConstraintTest | 258 | public class PropertyCompareConstraintTest : OpenSimTestCase |
258 | { | 259 | { |
259 | public class HasInt | 260 | public class HasInt |
260 | { | 261 | { |
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index c5d40c2..e0f5862 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs | |||
@@ -34,6 +34,7 @@ using System.Text; | |||
34 | using NUnit.Framework; | 34 | using NUnit.Framework; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Tests.Common; | ||
37 | 38 | ||
38 | namespace OpenSim.Data.Tests | 39 | namespace OpenSim.Data.Tests |
39 | { | 40 | { |
@@ -158,7 +159,7 @@ namespace OpenSim.Data.Tests | |||
158 | } | 159 | } |
159 | 160 | ||
160 | [TestFixture] | 161 | [TestFixture] |
161 | public class PropertyScramblerTests | 162 | public class PropertyScramblerTests : OpenSimTestCase |
162 | { | 163 | { |
163 | [Test] | 164 | [Test] |
164 | public void TestScramble() | 165 | public void TestScramble() |