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