aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs333
1 files changed, 197 insertions, 136 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 7df5a81..29bd6b6 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -131,121 +131,121 @@ namespace OpenSim.Data.MySQL
131 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 131 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
132 { 132 {
133 dbcon.Open(); 133 dbcon.Open();
134 MySqlCommand cmd = dbcon.CreateCommand();
135 134
136 foreach (SceneObjectPart prim in obj.Parts) 135 using (MySqlCommand cmd = dbcon.CreateCommand())
137 { 136 {
138 cmd.Parameters.Clear(); 137 foreach (SceneObjectPart prim in obj.Parts)
138 {
139 cmd.Parameters.Clear();
139 140
140 cmd.CommandText = "replace into prims (" + 141 cmd.CommandText = "replace into prims (" +
141 "UUID, CreationDate, " + 142 "UUID, CreationDate, " +
142 "Name, Text, Description, " + 143 "Name, Text, Description, " +
143 "SitName, TouchName, ObjectFlags, " + 144 "SitName, TouchName, ObjectFlags, " +
144 "OwnerMask, NextOwnerMask, GroupMask, " + 145 "OwnerMask, NextOwnerMask, GroupMask, " +
145 "EveryoneMask, BaseMask, PositionX, " + 146 "EveryoneMask, BaseMask, PositionX, " +
146 "PositionY, PositionZ, GroupPositionX, " + 147 "PositionY, PositionZ, GroupPositionX, " +
147 "GroupPositionY, GroupPositionZ, VelocityX, " + 148 "GroupPositionY, GroupPositionZ, VelocityX, " +
148 "VelocityY, VelocityZ, AngularVelocityX, " + 149 "VelocityY, VelocityZ, AngularVelocityX, " +
149 "AngularVelocityY, AngularVelocityZ, " + 150 "AngularVelocityY, AngularVelocityZ, " +
150 "AccelerationX, AccelerationY, " + 151 "AccelerationX, AccelerationY, " +
151 "AccelerationZ, RotationX, " + 152 "AccelerationZ, RotationX, " +
152 "RotationY, RotationZ, " + 153 "RotationY, RotationZ, " +
153 "RotationW, SitTargetOffsetX, " + 154 "RotationW, SitTargetOffsetX, " +
154 "SitTargetOffsetY, SitTargetOffsetZ, " + 155 "SitTargetOffsetY, SitTargetOffsetZ, " +
155 "SitTargetOrientW, SitTargetOrientX, " + 156 "SitTargetOrientW, SitTargetOrientX, " +
156 "SitTargetOrientY, SitTargetOrientZ, " + 157 "SitTargetOrientY, SitTargetOrientZ, " +
157 "RegionUUID, CreatorID, " + 158 "RegionUUID, CreatorID, " +
158 "OwnerID, GroupID, " + 159 "OwnerID, GroupID, " +
159 "LastOwnerID, SceneGroupID, " + 160 "LastOwnerID, SceneGroupID, " +
160 "PayPrice, PayButton1, " + 161 "PayPrice, PayButton1, " +
161 "PayButton2, PayButton3, " + 162 "PayButton2, PayButton3, " +
162 "PayButton4, LoopedSound, " + 163 "PayButton4, LoopedSound, " +
163 "LoopedSoundGain, TextureAnimation, " + 164 "LoopedSoundGain, TextureAnimation, " +
164 "OmegaX, OmegaY, OmegaZ, " + 165 "OmegaX, OmegaY, OmegaZ, " +
165 "CameraEyeOffsetX, CameraEyeOffsetY, " + 166 "CameraEyeOffsetX, CameraEyeOffsetY, " +
166 "CameraEyeOffsetZ, CameraAtOffsetX, " + 167 "CameraEyeOffsetZ, CameraAtOffsetX, " +
167 "CameraAtOffsetY, CameraAtOffsetZ, " + 168 "CameraAtOffsetY, CameraAtOffsetZ, " +
168 "ForceMouselook, ScriptAccessPin, " + 169 "ForceMouselook, ScriptAccessPin, " +
169 "AllowedDrop, DieAtEdge, " + 170 "AllowedDrop, DieAtEdge, " +
170 "SalePrice, SaleType, " + 171 "SalePrice, SaleType, " +
171 "ColorR, ColorG, ColorB, ColorA, " + 172 "ColorR, ColorG, ColorB, ColorA, " +
172 "ParticleSystem, ClickAction, Material, " + 173 "ParticleSystem, ClickAction, Material, " +
173 "CollisionSound, CollisionSoundVolume, " + 174 "CollisionSound, CollisionSoundVolume, " +
174 "PassTouches, " + 175 "PassTouches, " +
175 "PassCollisions, " + 176 "PassCollisions, " +
176 "LinkNumber, MediaURL, KeyframeMotion, " + 177 "LinkNumber, MediaURL, KeyframeMotion, " +
177 "PhysicsShapeType, Density, GravityModifier, " + 178 "PhysicsShapeType, Density, GravityModifier, " +
178 "Friction, Restitution, Vehicle " + 179 "Friction, Restitution, Vehicle " +
179 ") values (" + "?UUID, " + 180 ") values (" + "?UUID, " +
180 "?CreationDate, ?Name, ?Text, " + 181 "?CreationDate, ?Name, ?Text, " +
181 "?Description, ?SitName, ?TouchName, " + 182 "?Description, ?SitName, ?TouchName, " +
182 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 183 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
183 "?GroupMask, ?EveryoneMask, ?BaseMask, " + 184 "?GroupMask, ?EveryoneMask, ?BaseMask, " +
184 "?PositionX, ?PositionY, ?PositionZ, " + 185 "?PositionX, ?PositionY, ?PositionZ, " +
185 "?GroupPositionX, ?GroupPositionY, " + 186 "?GroupPositionX, ?GroupPositionY, " +
186 "?GroupPositionZ, ?VelocityX, " + 187 "?GroupPositionZ, ?VelocityX, " +
187 "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + 188 "?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
188 "?AngularVelocityY, ?AngularVelocityZ, " + 189 "?AngularVelocityY, ?AngularVelocityZ, " +
189 "?AccelerationX, ?AccelerationY, " + 190 "?AccelerationX, ?AccelerationY, " +
190 "?AccelerationZ, ?RotationX, " + 191 "?AccelerationZ, ?RotationX, " +
191 "?RotationY, ?RotationZ, " + 192 "?RotationY, ?RotationZ, " +
192 "?RotationW, ?SitTargetOffsetX, " + 193 "?RotationW, ?SitTargetOffsetX, " +
193 "?SitTargetOffsetY, ?SitTargetOffsetZ, " + 194 "?SitTargetOffsetY, ?SitTargetOffsetZ, " +
194 "?SitTargetOrientW, ?SitTargetOrientX, " + 195 "?SitTargetOrientW, ?SitTargetOrientX, " +
195 "?SitTargetOrientY, ?SitTargetOrientZ, " + 196 "?SitTargetOrientY, ?SitTargetOrientZ, " +
196 "?RegionUUID, ?CreatorID, ?OwnerID, " + 197 "?RegionUUID, ?CreatorID, ?OwnerID, " +
197 "?GroupID, ?LastOwnerID, ?SceneGroupID, " + 198 "?GroupID, ?LastOwnerID, ?SceneGroupID, " +
198 "?PayPrice, ?PayButton1, ?PayButton2, " + 199 "?PayPrice, ?PayButton1, ?PayButton2, " +
199 "?PayButton3, ?PayButton4, ?LoopedSound, " + 200 "?PayButton3, ?PayButton4, ?LoopedSound, " +
200 "?LoopedSoundGain, ?TextureAnimation, " + 201 "?LoopedSoundGain, ?TextureAnimation, " +
201 "?OmegaX, ?OmegaY, ?OmegaZ, " + 202 "?OmegaX, ?OmegaY, ?OmegaZ, " +
202 "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + 203 "?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
203 "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + 204 "?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
204 "?CameraAtOffsetY, ?CameraAtOffsetZ, " + 205 "?CameraAtOffsetY, ?CameraAtOffsetZ, " +
205 "?ForceMouselook, ?ScriptAccessPin, " + 206 "?ForceMouselook, ?ScriptAccessPin, " +
206 "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + 207 "?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
207 "?SaleType, ?ColorR, ?ColorG, " + 208 "?SaleType, ?ColorR, ?ColorG, " +
208 "?ColorB, ?ColorA, ?ParticleSystem, " + 209 "?ColorB, ?ColorA, ?ParticleSystem, " +
209 "?ClickAction, ?Material, ?CollisionSound, " + 210 "?ClickAction, ?Material, ?CollisionSound, " +
210 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + 211 "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " +
211 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + 212 "?LinkNumber, ?MediaURL, ?KeyframeMotion, " +
212 "?PhysicsShapeType, ?Density, ?GravityModifier, " + 213 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
213 "?Friction, ?Restitution, ?Vehicle)"; 214 "?Friction, ?Restitution, ?Vehicle)";
214 215
215 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 216 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
216 217
217 ExecuteNonQuery(cmd); 218 ExecuteNonQuery(cmd);
218 219
219 cmd.Parameters.Clear(); 220 cmd.Parameters.Clear();
220 221
221 cmd.CommandText = "replace into primshapes (" + 222 cmd.CommandText = "replace into primshapes (" +
222 "UUID, Shape, ScaleX, ScaleY, " + 223 "UUID, Shape, ScaleX, ScaleY, " +
223 "ScaleZ, PCode, PathBegin, PathEnd, " + 224 "ScaleZ, PCode, PathBegin, PathEnd, " +
224 "PathScaleX, PathScaleY, PathShearX, " + 225 "PathScaleX, PathScaleY, PathShearX, " +
225 "PathShearY, PathSkew, PathCurve, " + 226 "PathShearY, PathSkew, PathCurve, " +
226 "PathRadiusOffset, PathRevolutions, " + 227 "PathRadiusOffset, PathRevolutions, " +
227 "PathTaperX, PathTaperY, PathTwist, " + 228 "PathTaperX, PathTaperY, PathTwist, " +
228 "PathTwistBegin, ProfileBegin, ProfileEnd, " + 229 "PathTwistBegin, ProfileBegin, ProfileEnd, " +
229 "ProfileCurve, ProfileHollow, Texture, " + 230 "ProfileCurve, ProfileHollow, Texture, " +
230 "ExtraParams, State, Media) values (?UUID, " + 231 "ExtraParams, State, Media) values (?UUID, " +
231 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + 232 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
232 "?PCode, ?PathBegin, ?PathEnd, " + 233 "?PCode, ?PathBegin, ?PathEnd, " +
233 "?PathScaleX, ?PathScaleY, " + 234 "?PathScaleX, ?PathScaleY, " +
234 "?PathShearX, ?PathShearY, " + 235 "?PathShearX, ?PathShearY, " +
235 "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + 236 "?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
236 "?PathRevolutions, ?PathTaperX, " + 237 "?PathRevolutions, ?PathTaperX, " +
237 "?PathTaperY, ?PathTwist, " + 238 "?PathTaperY, ?PathTwist, " +
238 "?PathTwistBegin, ?ProfileBegin, " + 239 "?PathTwistBegin, ?ProfileBegin, " +
239 "?ProfileEnd, ?ProfileCurve, " + 240 "?ProfileEnd, ?ProfileCurve, " +
240 "?ProfileHollow, ?Texture, ?ExtraParams, " + 241 "?ProfileHollow, ?Texture, ?ExtraParams, " +
241 "?State, ?Media)"; 242 "?State, ?Media)";
242 243
243 FillShapeCommand(cmd, prim); 244 FillShapeCommand(cmd, prim);
244 245
245 ExecuteNonQuery(cmd); 246 ExecuteNonQuery(cmd);
247 }
246 } 248 }
247
248 cmd.Dispose();
249 } 249 }
250 } 250 }
251 } 251 }
@@ -997,6 +997,68 @@ namespace OpenSim.Data.MySQL
997 } 997 }
998 } 998 }
999 999
1000 #region RegionEnvironmentSettings
1001 public string LoadRegionEnvironmentSettings(UUID regionUUID)
1002 {
1003 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1004 {
1005 dbcon.Open();
1006
1007 string command = "select * from `regionenvironment` where region_id = ?region_id";
1008
1009 using (MySqlCommand cmd = new MySqlCommand(command))
1010 {
1011 cmd.Connection = dbcon;
1012
1013 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
1014
1015 IDataReader result = ExecuteReader(cmd);
1016 if (!result.Read())
1017 {
1018 return String.Empty;
1019 }
1020 else
1021 {
1022 return Convert.ToString(result["llsd_settings"]);
1023 }
1024 }
1025 }
1026 }
1027
1028 public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
1029 {
1030 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1031 {
1032 dbcon.Open();
1033
1034 using (MySqlCommand cmd = dbcon.CreateCommand())
1035 {
1036 cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
1037
1038 cmd.Parameters.AddWithValue("region_id", regionUUID);
1039 cmd.Parameters.AddWithValue("llsd_settings", settings);
1040
1041 ExecuteNonQuery(cmd);
1042 }
1043 }
1044 }
1045
1046 public void RemoveRegionEnvironmentSettings(UUID regionUUID)
1047 {
1048 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1049 {
1050 dbcon.Open();
1051
1052 using (MySqlCommand cmd = dbcon.CreateCommand())
1053 {
1054 cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
1055 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
1056 ExecuteNonQuery(cmd);
1057 }
1058 }
1059 }
1060 #endregion
1061
1000 public virtual void StoreRegionSettings(RegionSettings rs) 1062 public virtual void StoreRegionSettings(RegionSettings rs)
1001 { 1063 {
1002 lock (m_dbLock) 1064 lock (m_dbLock)
@@ -1897,41 +1959,40 @@ namespace OpenSim.Data.MySQL
1897 { 1959 {
1898 RemoveItems(primID); 1960 RemoveItems(primID);
1899 1961
1962 if (items.Count == 0)
1963 return;
1964
1900 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1965 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1901 { 1966 {
1902 dbcon.Open(); 1967 dbcon.Open();
1903 1968
1904 MySqlCommand cmd = dbcon.CreateCommand(); 1969 using (MySqlCommand cmd = dbcon.CreateCommand())
1905
1906 if (items.Count == 0)
1907 return;
1908
1909 cmd.CommandText = "insert into primitems (" +
1910 "invType, assetType, name, " +
1911 "description, creationDate, nextPermissions, " +
1912 "currentPermissions, basePermissions, " +
1913 "everyonePermissions, groupPermissions, " +
1914 "flags, itemID, primID, assetID, " +
1915 "parentFolderID, creatorID, ownerID, " +
1916 "groupID, lastOwnerID) values (?invType, " +
1917 "?assetType, ?name, ?description, " +
1918 "?creationDate, ?nextPermissions, " +
1919 "?currentPermissions, ?basePermissions, " +
1920 "?everyonePermissions, ?groupPermissions, " +
1921 "?flags, ?itemID, ?primID, ?assetID, " +
1922 "?parentFolderID, ?creatorID, ?ownerID, " +
1923 "?groupID, ?lastOwnerID)";
1924
1925 foreach (TaskInventoryItem item in items)
1926 { 1970 {
1927 cmd.Parameters.Clear(); 1971 cmd.CommandText = "insert into primitems (" +
1928 1972 "invType, assetType, name, " +
1929 FillItemCommand(cmd, item); 1973 "description, creationDate, nextPermissions, " +
1930 1974 "currentPermissions, basePermissions, " +
1931 ExecuteNonQuery(cmd); 1975 "everyonePermissions, groupPermissions, " +
1976 "flags, itemID, primID, assetID, " +
1977 "parentFolderID, creatorID, ownerID, " +
1978 "groupID, lastOwnerID) values (?invType, " +
1979 "?assetType, ?name, ?description, " +
1980 "?creationDate, ?nextPermissions, " +
1981 "?currentPermissions, ?basePermissions, " +
1982 "?everyonePermissions, ?groupPermissions, " +
1983 "?flags, ?itemID, ?primID, ?assetID, " +
1984 "?parentFolderID, ?creatorID, ?ownerID, " +
1985 "?groupID, ?lastOwnerID)";
1986
1987 foreach (TaskInventoryItem item in items)
1988 {
1989 cmd.Parameters.Clear();
1990
1991 FillItemCommand(cmd, item);
1992
1993 ExecuteNonQuery(cmd);
1994 }
1932 } 1995 }
1933
1934 cmd.Dispose();
1935 } 1996 }
1936 } 1997 }
1937 } 1998 }