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