diff options
author | Justin Clark-Casey (justincc) | 2012-04-30 15:54:35 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-04-30 15:54:35 +0100 |
commit | 522eff61383e9a8acfdf34289cd64a8fdc27bb19 (patch) | |
tree | 3e9d6428bf6832caafd69d45c3a377a9f643dcae /OpenSim/Data/MySQL/MySQLSimulationData.cs | |
parent | Comment out debug [ASYNC DELETER] messages for now. (diff) | |
download | opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.zip opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.gz opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.bz2 opensim-SC-522eff61383e9a8acfdf34289cd64a8fdc27bb19.tar.xz |
Consistently use using() to make sure we dispose of used MySqlCommands where this is not already being done.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 267 |
1 files changed, 133 insertions, 134 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 381a514..b36ff5a 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -129,114 +129,114 @@ 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) |
137 | 136 | { | |
138 | cmd.CommandText = "replace into prims (" + | 137 | cmd.Parameters.Clear(); |
139 | "UUID, CreationDate, " + | 138 | |
140 | "Name, Text, Description, " + | 139 | cmd.CommandText = "replace into prims (" + |
141 | "SitName, TouchName, ObjectFlags, " + | 140 | "UUID, CreationDate, " + |
142 | "OwnerMask, NextOwnerMask, GroupMask, " + | 141 | "Name, Text, Description, " + |
143 | "EveryoneMask, BaseMask, PositionX, " + | 142 | "SitName, TouchName, ObjectFlags, " + |
144 | "PositionY, PositionZ, GroupPositionX, " + | 143 | "OwnerMask, NextOwnerMask, GroupMask, " + |
145 | "GroupPositionY, GroupPositionZ, VelocityX, " + | 144 | "EveryoneMask, BaseMask, PositionX, " + |
146 | "VelocityY, VelocityZ, AngularVelocityX, " + | 145 | "PositionY, PositionZ, GroupPositionX, " + |
147 | "AngularVelocityY, AngularVelocityZ, " + | 146 | "GroupPositionY, GroupPositionZ, VelocityX, " + |
148 | "AccelerationX, AccelerationY, " + | 147 | "VelocityY, VelocityZ, AngularVelocityX, " + |
149 | "AccelerationZ, RotationX, " + | 148 | "AngularVelocityY, AngularVelocityZ, " + |
150 | "RotationY, RotationZ, " + | 149 | "AccelerationX, AccelerationY, " + |
151 | "RotationW, SitTargetOffsetX, " + | 150 | "AccelerationZ, RotationX, " + |
152 | "SitTargetOffsetY, SitTargetOffsetZ, " + | 151 | "RotationY, RotationZ, " + |
153 | "SitTargetOrientW, SitTargetOrientX, " + | 152 | "RotationW, SitTargetOffsetX, " + |
154 | "SitTargetOrientY, SitTargetOrientZ, " + | 153 | "SitTargetOffsetY, SitTargetOffsetZ, " + |
155 | "RegionUUID, CreatorID, " + | 154 | "SitTargetOrientW, SitTargetOrientX, " + |
156 | "OwnerID, GroupID, " + | 155 | "SitTargetOrientY, SitTargetOrientZ, " + |
157 | "LastOwnerID, SceneGroupID, " + | 156 | "RegionUUID, CreatorID, " + |
158 | "PayPrice, PayButton1, " + | 157 | "OwnerID, GroupID, " + |
159 | "PayButton2, PayButton3, " + | 158 | "LastOwnerID, SceneGroupID, " + |
160 | "PayButton4, LoopedSound, " + | 159 | "PayPrice, PayButton1, " + |
161 | "LoopedSoundGain, TextureAnimation, " + | 160 | "PayButton2, PayButton3, " + |
162 | "OmegaX, OmegaY, OmegaZ, " + | 161 | "PayButton4, LoopedSound, " + |
163 | "CameraEyeOffsetX, CameraEyeOffsetY, " + | 162 | "LoopedSoundGain, TextureAnimation, " + |
164 | "CameraEyeOffsetZ, CameraAtOffsetX, " + | 163 | "OmegaX, OmegaY, OmegaZ, " + |
165 | "CameraAtOffsetY, CameraAtOffsetZ, " + | 164 | "CameraEyeOffsetX, CameraEyeOffsetY, " + |
166 | "ForceMouselook, ScriptAccessPin, " + | 165 | "CameraEyeOffsetZ, CameraAtOffsetX, " + |
167 | "AllowedDrop, DieAtEdge, " + | 166 | "CameraAtOffsetY, CameraAtOffsetZ, " + |
168 | "SalePrice, SaleType, " + | 167 | "ForceMouselook, ScriptAccessPin, " + |
169 | "ColorR, ColorG, ColorB, ColorA, " + | 168 | "AllowedDrop, DieAtEdge, " + |
170 | "ParticleSystem, ClickAction, Material, " + | 169 | "SalePrice, SaleType, " + |
171 | "CollisionSound, CollisionSoundVolume, " + | 170 | "ColorR, ColorG, ColorB, ColorA, " + |
172 | "PassTouches, " + | 171 | "ParticleSystem, ClickAction, Material, " + |
173 | "LinkNumber, MediaURL) values (" + "?UUID, " + | 172 | "CollisionSound, CollisionSoundVolume, " + |
174 | "?CreationDate, ?Name, ?Text, " + | 173 | "PassTouches, " + |
175 | "?Description, ?SitName, ?TouchName, " + | 174 | "LinkNumber, MediaURL) values (" + "?UUID, " + |
176 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + | 175 | "?CreationDate, ?Name, ?Text, " + |
177 | "?GroupMask, ?EveryoneMask, ?BaseMask, " + | 176 | "?Description, ?SitName, ?TouchName, " + |
178 | "?PositionX, ?PositionY, ?PositionZ, " + | 177 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + |
179 | "?GroupPositionX, ?GroupPositionY, " + | 178 | "?GroupMask, ?EveryoneMask, ?BaseMask, " + |
180 | "?GroupPositionZ, ?VelocityX, " + | 179 | "?PositionX, ?PositionY, ?PositionZ, " + |
181 | "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + | 180 | "?GroupPositionX, ?GroupPositionY, " + |
182 | "?AngularVelocityY, ?AngularVelocityZ, " + | 181 | "?GroupPositionZ, ?VelocityX, " + |
183 | "?AccelerationX, ?AccelerationY, " + | 182 | "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + |
184 | "?AccelerationZ, ?RotationX, " + | 183 | "?AngularVelocityY, ?AngularVelocityZ, " + |
185 | "?RotationY, ?RotationZ, " + | 184 | "?AccelerationX, ?AccelerationY, " + |
186 | "?RotationW, ?SitTargetOffsetX, " + | 185 | "?AccelerationZ, ?RotationX, " + |
187 | "?SitTargetOffsetY, ?SitTargetOffsetZ, " + | 186 | "?RotationY, ?RotationZ, " + |
188 | "?SitTargetOrientW, ?SitTargetOrientX, " + | 187 | "?RotationW, ?SitTargetOffsetX, " + |
189 | "?SitTargetOrientY, ?SitTargetOrientZ, " + | 188 | "?SitTargetOffsetY, ?SitTargetOffsetZ, " + |
190 | "?RegionUUID, ?CreatorID, ?OwnerID, " + | 189 | "?SitTargetOrientW, ?SitTargetOrientX, " + |
191 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + | 190 | "?SitTargetOrientY, ?SitTargetOrientZ, " + |
192 | "?PayPrice, ?PayButton1, ?PayButton2, " + | 191 | "?RegionUUID, ?CreatorID, ?OwnerID, " + |
193 | "?PayButton3, ?PayButton4, ?LoopedSound, " + | 192 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + |
194 | "?LoopedSoundGain, ?TextureAnimation, " + | 193 | "?PayPrice, ?PayButton1, ?PayButton2, " + |
195 | "?OmegaX, ?OmegaY, ?OmegaZ, " + | 194 | "?PayButton3, ?PayButton4, ?LoopedSound, " + |
196 | "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + | 195 | "?LoopedSoundGain, ?TextureAnimation, " + |
197 | "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + | 196 | "?OmegaX, ?OmegaY, ?OmegaZ, " + |
198 | "?CameraAtOffsetY, ?CameraAtOffsetZ, " + | 197 | "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + |
199 | "?ForceMouselook, ?ScriptAccessPin, " + | 198 | "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + |
200 | "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + | 199 | "?CameraAtOffsetY, ?CameraAtOffsetZ, " + |
201 | "?SaleType, ?ColorR, ?ColorG, " + | 200 | "?ForceMouselook, ?ScriptAccessPin, " + |
202 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 201 | "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + |
203 | "?ClickAction, ?Material, ?CollisionSound, " + | 202 | "?SaleType, ?ColorR, ?ColorG, " + |
204 | "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; | 203 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
205 | 204 | "?ClickAction, ?Material, ?CollisionSound, " + | |
206 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 205 | "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; |
207 | 206 | ||
208 | ExecuteNonQuery(cmd); | 207 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
209 | 208 | ||
210 | cmd.Parameters.Clear(); | 209 | ExecuteNonQuery(cmd); |
211 | 210 | ||
212 | cmd.CommandText = "replace into primshapes (" + | 211 | cmd.Parameters.Clear(); |
213 | "UUID, Shape, ScaleX, ScaleY, " + | 212 | |
214 | "ScaleZ, PCode, PathBegin, PathEnd, " + | 213 | cmd.CommandText = "replace into primshapes (" + |
215 | "PathScaleX, PathScaleY, PathShearX, " + | 214 | "UUID, Shape, ScaleX, ScaleY, " + |
216 | "PathShearY, PathSkew, PathCurve, " + | 215 | "ScaleZ, PCode, PathBegin, PathEnd, " + |
217 | "PathRadiusOffset, PathRevolutions, " + | 216 | "PathScaleX, PathScaleY, PathShearX, " + |
218 | "PathTaperX, PathTaperY, PathTwist, " + | 217 | "PathShearY, PathSkew, PathCurve, " + |
219 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + | 218 | "PathRadiusOffset, PathRevolutions, " + |
220 | "ProfileCurve, ProfileHollow, Texture, " + | 219 | "PathTaperX, PathTaperY, PathTwist, " + |
221 | "ExtraParams, State, Media) values (?UUID, " + | 220 | "PathTwistBegin, ProfileBegin, ProfileEnd, " + |
222 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + | 221 | "ProfileCurve, ProfileHollow, Texture, " + |
223 | "?PCode, ?PathBegin, ?PathEnd, " + | 222 | "ExtraParams, State, Media) values (?UUID, " + |
224 | "?PathScaleX, ?PathScaleY, " + | 223 | "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + |
225 | "?PathShearX, ?PathShearY, " + | 224 | "?PCode, ?PathBegin, ?PathEnd, " + |
226 | "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + | 225 | "?PathScaleX, ?PathScaleY, " + |
227 | "?PathRevolutions, ?PathTaperX, " + | 226 | "?PathShearX, ?PathShearY, " + |
228 | "?PathTaperY, ?PathTwist, " + | 227 | "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + |
229 | "?PathTwistBegin, ?ProfileBegin, " + | 228 | "?PathRevolutions, ?PathTaperX, " + |
230 | "?ProfileEnd, ?ProfileCurve, " + | 229 | "?PathTaperY, ?PathTwist, " + |
231 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | 230 | "?PathTwistBegin, ?ProfileBegin, " + |
232 | "?State, ?Media)"; | 231 | "?ProfileEnd, ?ProfileCurve, " + |
233 | 232 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | |
234 | FillShapeCommand(cmd, prim); | 233 | "?State, ?Media)"; |
235 | 234 | ||
236 | ExecuteNonQuery(cmd); | 235 | FillShapeCommand(cmd, prim); |
236 | |||
237 | ExecuteNonQuery(cmd); | ||
238 | } | ||
237 | } | 239 | } |
238 | |||
239 | cmd.Dispose(); | ||
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
@@ -1804,37 +1804,36 @@ namespace OpenSim.Data.MySQL | |||
1804 | { | 1804 | { |
1805 | dbcon.Open(); | 1805 | dbcon.Open(); |
1806 | 1806 | ||
1807 | MySqlCommand cmd = dbcon.CreateCommand(); | 1807 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1808 | |||
1809 | if (items.Count == 0) | ||
1810 | return; | ||
1811 | |||
1812 | cmd.CommandText = "insert into primitems (" + | ||
1813 | "invType, assetType, name, " + | ||
1814 | "description, creationDate, nextPermissions, " + | ||
1815 | "currentPermissions, basePermissions, " + | ||
1816 | "everyonePermissions, groupPermissions, " + | ||
1817 | "flags, itemID, primID, assetID, " + | ||
1818 | "parentFolderID, creatorID, ownerID, " + | ||
1819 | "groupID, lastOwnerID) values (?invType, " + | ||
1820 | "?assetType, ?name, ?description, " + | ||
1821 | "?creationDate, ?nextPermissions, " + | ||
1822 | "?currentPermissions, ?basePermissions, " + | ||
1823 | "?everyonePermissions, ?groupPermissions, " + | ||
1824 | "?flags, ?itemID, ?primID, ?assetID, " + | ||
1825 | "?parentFolderID, ?creatorID, ?ownerID, " + | ||
1826 | "?groupID, ?lastOwnerID)"; | ||
1827 | |||
1828 | foreach (TaskInventoryItem item in items) | ||
1829 | { | 1808 | { |
1830 | cmd.Parameters.Clear(); | 1809 | if (items.Count == 0) |
1831 | 1810 | return; | |
1832 | FillItemCommand(cmd, item); | 1811 | |
1833 | 1812 | cmd.CommandText = "insert into primitems (" + | |
1834 | ExecuteNonQuery(cmd); | 1813 | "invType, assetType, name, " + |
1814 | "description, creationDate, nextPermissions, " + | ||
1815 | "currentPermissions, basePermissions, " + | ||
1816 | "everyonePermissions, groupPermissions, " + | ||
1817 | "flags, itemID, primID, assetID, " + | ||
1818 | "parentFolderID, creatorID, ownerID, " + | ||
1819 | "groupID, lastOwnerID) values (?invType, " + | ||
1820 | "?assetType, ?name, ?description, " + | ||
1821 | "?creationDate, ?nextPermissions, " + | ||
1822 | "?currentPermissions, ?basePermissions, " + | ||
1823 | "?everyonePermissions, ?groupPermissions, " + | ||
1824 | "?flags, ?itemID, ?primID, ?assetID, " + | ||
1825 | "?parentFolderID, ?creatorID, ?ownerID, " + | ||
1826 | "?groupID, ?lastOwnerID)"; | ||
1827 | |||
1828 | foreach (TaskInventoryItem item in items) | ||
1829 | { | ||
1830 | cmd.Parameters.Clear(); | ||
1831 | |||
1832 | FillItemCommand(cmd, item); | ||
1833 | |||
1834 | ExecuteNonQuery(cmd); | ||
1835 | } | ||
1835 | } | 1836 | } |
1836 | |||
1837 | cmd.Dispose(); | ||
1838 | } | 1837 | } |
1839 | } | 1838 | } |
1840 | } | 1839 | } |