aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Data/MySQL/MySQLSimulationData.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs805
1 files changed, 420 insertions, 385 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index d562783..bb0ab75 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -48,8 +48,18 @@ namespace OpenSim.Data.MySQL
48 public class MySQLSimulationData : ISimulationDataStore 48 public class MySQLSimulationData : ISimulationDataStore
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[REGION DB MYSQL]";
51 52
52 private string m_connectionString; 53 private string m_connectionString;
54
55 /// <summary>
56 /// This lock was being used to serialize database operations when the connection was shared, but this has
57 /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead.
58 /// FIXME: However, the locks remain in many places since they are effectively providing a level of
59 /// transactionality. This should be replaced by more efficient database transactions which would not require
60 /// unrelated operations to block each other or unrelated operations on the same tables from blocking each
61 /// other.
62 /// </summary>
53 private object m_dbLock = new object(); 63 private object m_dbLock = new object();
54 64
55 protected virtual Assembly Assembly 65 protected virtual Assembly Assembly
@@ -91,7 +101,7 @@ namespace OpenSim.Data.MySQL
91 } 101 }
92 catch (Exception e) 102 catch (Exception e)
93 { 103 {
94 m_log.Error("[REGION DB]: MySQL error in ExecuteReader: " + e.Message); 104 m_log.ErrorFormat("{0} MySQL error in ExecuteReader: {1}", LogHeader, e);
95 throw; 105 throw;
96 } 106 }
97 107
@@ -119,8 +129,10 @@ namespace OpenSim.Data.MySQL
119 129
120 // Eligibility check 130 // Eligibility check
121 // 131 //
122 if ((flags & (uint)PrimFlags.Temporary) != 0) 132 // PrimFlags.Temporary is not used in OpenSim code and cannot
123 return; 133 // be guaranteed to always be clear. Don't check it.
134// if ((flags & (uint)PrimFlags.Temporary) != 0)
135// return;
124 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) 136 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
125 return; 137 return;
126 138
@@ -135,7 +147,7 @@ namespace OpenSim.Data.MySQL
135 foreach (SceneObjectPart prim in obj.Parts) 147 foreach (SceneObjectPart prim in obj.Parts)
136 { 148 {
137 cmd.Parameters.Clear(); 149 cmd.Parameters.Clear();
138 150
139 cmd.CommandText = "replace into prims (" + 151 cmd.CommandText = "replace into prims (" +
140 "UUID, CreationDate, " + 152 "UUID, CreationDate, " +
141 "Name, Text, Description, " + 153 "Name, Text, Description, " +
@@ -171,7 +183,11 @@ namespace OpenSim.Data.MySQL
171 "ParticleSystem, ClickAction, Material, " + 183 "ParticleSystem, ClickAction, Material, " +
172 "CollisionSound, CollisionSoundVolume, " + 184 "CollisionSound, CollisionSoundVolume, " +
173 "PassTouches, " + 185 "PassTouches, " +
174 "LinkNumber, MediaURL) values (" + "?UUID, " + 186 "LinkNumber, MediaURL, AttachedPosX, " +
187 "AttachedPosY, AttachedPosZ, KeyframeMotion, " +
188 "PhysicsShapeType, Density, GravityModifier, " +
189 "Friction, Restitution, DynAttrs " +
190 ") values (" + "?UUID, " +
175 "?CreationDate, ?Name, ?Text, " + 191 "?CreationDate, ?Name, ?Text, " +
176 "?Description, ?SitName, ?TouchName, " + 192 "?Description, ?SitName, ?TouchName, " +
177 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + 193 "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@@ -202,14 +218,18 @@ namespace OpenSim.Data.MySQL
202 "?SaleType, ?ColorR, ?ColorG, " + 218 "?SaleType, ?ColorR, ?ColorG, " +
203 "?ColorB, ?ColorA, ?ParticleSystem, " + 219 "?ColorB, ?ColorA, ?ParticleSystem, " +
204 "?ClickAction, ?Material, ?CollisionSound, " + 220 "?ClickAction, ?Material, ?CollisionSound, " +
205 "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; 221 "?CollisionSoundVolume, ?PassTouches, " +
206 222 "?LinkNumber, ?MediaURL, ?AttachedPosX, " +
223 "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " +
224 "?PhysicsShapeType, ?Density, ?GravityModifier, " +
225 "?Friction, ?Restitution, ?DynAttrs)";
226
207 FillPrimCommand(cmd, prim, obj.UUID, regionUUID); 227 FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
208 228
209 ExecuteNonQuery(cmd); 229 ExecuteNonQuery(cmd);
210 230
211 cmd.Parameters.Clear(); 231 cmd.Parameters.Clear();
212 232
213 cmd.CommandText = "replace into primshapes (" + 233 cmd.CommandText = "replace into primshapes (" +
214 "UUID, Shape, ScaleX, ScaleY, " + 234 "UUID, Shape, ScaleX, ScaleY, " +
215 "ScaleZ, PCode, PathBegin, PathEnd, " + 235 "ScaleZ, PCode, PathBegin, PathEnd, " +
@@ -219,7 +239,8 @@ namespace OpenSim.Data.MySQL
219 "PathTaperX, PathTaperY, PathTwist, " + 239 "PathTaperX, PathTaperY, PathTwist, " +
220 "PathTwistBegin, ProfileBegin, ProfileEnd, " + 240 "PathTwistBegin, ProfileBegin, ProfileEnd, " +
221 "ProfileCurve, ProfileHollow, Texture, " + 241 "ProfileCurve, ProfileHollow, Texture, " +
222 "ExtraParams, State, Media) values (?UUID, " + 242 "ExtraParams, State, LastAttachPoint, Media) " +
243 "values (?UUID, " +
223 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + 244 "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
224 "?PCode, ?PathBegin, ?PathEnd, " + 245 "?PCode, ?PathBegin, ?PathEnd, " +
225 "?PathScaleX, ?PathScaleY, " + 246 "?PathScaleX, ?PathScaleY, " +
@@ -230,10 +251,10 @@ namespace OpenSim.Data.MySQL
230 "?PathTwistBegin, ?ProfileBegin, " + 251 "?PathTwistBegin, ?ProfileBegin, " +
231 "?ProfileEnd, ?ProfileCurve, " + 252 "?ProfileEnd, ?ProfileCurve, " +
232 "?ProfileHollow, ?Texture, ?ExtraParams, " + 253 "?ProfileHollow, ?Texture, ?ExtraParams, " +
233 "?State, ?Media)"; 254 "?State, ?LastAttachPoint, ?Media)";
234 255
235 FillShapeCommand(cmd, prim); 256 FillShapeCommand(cmd, prim);
236 257
237 ExecuteNonQuery(cmd); 258 ExecuteNonQuery(cmd);
238 } 259 }
239 } 260 }
@@ -446,7 +467,9 @@ namespace OpenSim.Data.MySQL
446 foreach (SceneObjectPart prim in prims.Values) 467 foreach (SceneObjectPart prim in prims.Values)
447 { 468 {
448 if (prim.ParentUUID == UUID.Zero) 469 if (prim.ParentUUID == UUID.Zero)
470 {
449 objects[prim.UUID] = new SceneObjectGroup(prim); 471 objects[prim.UUID] = new SceneObjectGroup(prim);
472 }
450 } 473 }
451 474
452 // Add all of the children objects to the SOGs 475 // Add all of the children objects to the SOGs
@@ -559,10 +582,14 @@ namespace OpenSim.Data.MySQL
559 } 582 }
560 } 583 }
561 584
585 // Legacy entry point for when terrain was always a 256x256 hieghtmap
562 public void StoreTerrain(double[,] ter, UUID regionID) 586 public void StoreTerrain(double[,] ter, UUID regionID)
563 { 587 {
564 m_log.Info("[REGION DB]: Storing terrain"); 588 StoreTerrain(new HeightmapTerrainData(ter), regionID);
589 }
565 590
591 public void StoreTerrain(TerrainData terrData, UUID regionID)
592 {
566 lock (m_dbLock) 593 lock (m_dbLock)
567 { 594 {
568 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 595 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@@ -576,11 +603,18 @@ namespace OpenSim.Data.MySQL
576 603
577 ExecuteNonQuery(cmd); 604 ExecuteNonQuery(cmd);
578 605
579 cmd.CommandText = "insert into terrain (RegionUUID, " + 606 int terrainDBRevision;
580 "Revision, Heightfield) values (?RegionUUID, " + 607 Array terrainDBblob;
581 "1, ?Heightfield)"; 608 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
609
610 m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}",
611 LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision);
582 612
583 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 613 cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)"
614 + "values (?RegionUUID, ?Revision, ?Heightfield)";
615
616 cmd.Parameters.AddWithValue("Revision", terrainDBRevision);
617 cmd.Parameters.AddWithValue("Heightfield", terrainDBblob);
584 618
585 ExecuteNonQuery(cmd); 619 ExecuteNonQuery(cmd);
586 } 620 }
@@ -588,9 +622,20 @@ namespace OpenSim.Data.MySQL
588 } 622 }
589 } 623 }
590 624
625 // Legacy region loading
591 public double[,] LoadTerrain(UUID regionID) 626 public double[,] LoadTerrain(UUID regionID)
592 { 627 {
593 double[,] terrain = null; 628 double[,] ret = null;
629 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
630 if (terrData != null)
631 ret = terrData.GetDoubles();
632 return ret;
633 }
634
635 // Returns 'null' if region not found
636 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
637 {
638 TerrainData terrData = null;
594 639
595 lock (m_dbLock) 640 lock (m_dbLock)
596 { 641 {
@@ -610,32 +655,15 @@ namespace OpenSim.Data.MySQL
610 while (reader.Read()) 655 while (reader.Read())
611 { 656 {
612 int rev = Convert.ToInt32(reader["Revision"]); 657 int rev = Convert.ToInt32(reader["Revision"]);
613 658 byte[] blob = (byte[])reader["Heightfield"];
614 terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; 659 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
615 terrain.Initialize();
616
617 using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"]))
618 {
619 using (BinaryReader br = new BinaryReader(mstr))
620 {
621 for (int x = 0; x < (int)Constants.RegionSize; x++)
622 {
623 for (int y = 0; y < (int)Constants.RegionSize; y++)
624 {
625 terrain[x, y] = br.ReadDouble();
626 }
627 }
628 }
629
630 m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev);
631 }
632 } 660 }
633 } 661 }
634 } 662 }
635 } 663 }
636 } 664 }
637 665
638 return terrain; 666 return terrData;
639 } 667 }
640 668
641 public void RemoveLandObject(UUID globalID) 669 public void RemoveLandObject(UUID globalID)
@@ -676,7 +704,7 @@ namespace OpenSim.Data.MySQL
676 "MusicURL, PassHours, PassPrice, SnapshotUUID, " + 704 "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
677 "UserLocationX, UserLocationY, UserLocationZ, " + 705 "UserLocationX, UserLocationY, UserLocationZ, " +
678 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 706 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
679 "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + 707 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
680 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 708 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
681 "?UUID, ?RegionUUID, " + 709 "?UUID, ?RegionUUID, " +
682 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 710 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@@ -687,7 +715,7 @@ namespace OpenSim.Data.MySQL
687 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + 715 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
688 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 716 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
689 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 717 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
690 "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ 718 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
691 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 719 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
692 720
693 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 721 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@@ -719,95 +747,92 @@ namespace OpenSim.Data.MySQL
719 RegionLightShareData nWP = new RegionLightShareData(); 747 RegionLightShareData nWP = new RegionLightShareData();
720 nWP.OnSave += StoreRegionWindlightSettings; 748 nWP.OnSave += StoreRegionWindlightSettings;
721 749
722 lock (m_dbLock) 750 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
723 { 751 {
724 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 752 dbcon.Open();
753
754 string command = "select * from `regionwindlight` where region_id = ?regionID";
755
756 using (MySqlCommand cmd = new MySqlCommand(command))
725 { 757 {
726 dbcon.Open(); 758 cmd.Connection = dbcon;
727 759
728 string command = "select * from `regionwindlight` where region_id = ?regionID"; 760 cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
729 761
730 using (MySqlCommand cmd = new MySqlCommand(command)) 762 IDataReader result = ExecuteReader(cmd);
763 if (!result.Read())
731 { 764 {
732 cmd.Connection = dbcon; 765 //No result, so store our default windlight profile and return it
733 766 nWP.regionID = regionUUID;
734 cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); 767// StoreRegionWindlightSettings(nWP);
735 768 return nWP;
736 IDataReader result = ExecuteReader(cmd); 769 }
737 if (!result.Read()) 770 else
738 { 771 {
739 //No result, so store our default windlight profile and return it 772 nWP.regionID = DBGuid.FromDB(result["region_id"]);
740 nWP.regionID = regionUUID; 773 nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
741 StoreRegionWindlightSettings(nWP); 774 nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
742 return nWP; 775 nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
743 } 776 nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
744 else 777 nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
745 { 778 nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
746 nWP.regionID = DBGuid.FromDB(result["region_id"]); 779 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
747 nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); 780 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
748 nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); 781 nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
749 nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); 782 nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
750 nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); 783 nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
751 nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); 784 nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
752 nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); 785 nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
753 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); 786 nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
754 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); 787 nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
755 nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); 788 nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
756 nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); 789 nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
757 nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); 790 UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
758 nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); 791 nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
759 nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); 792 nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
760 nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); 793 nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
761 nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); 794 nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
762 nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); 795 nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
763 nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); 796 nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
764 UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); 797 nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
765 nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); 798 nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
766 nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); 799 nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
767 nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); 800 nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
768 nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); 801 nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
769 nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); 802 nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
770 nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); 803 nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
771 nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); 804 nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
772 nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); 805 nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
773 nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); 806 nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
774 nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); 807 nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
775 nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); 808 nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
776 nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); 809 nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
777 nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); 810 nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
778 nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); 811 nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
779 nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); 812 nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
780 nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); 813 nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
781 nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); 814 nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
782 nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); 815 nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
783 nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); 816 nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
784 nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); 817 nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
785 nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); 818 nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
786 nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); 819 nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
787 nWP.eastAngle = Convert.ToSingle(result["east_angle"]); 820 nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
788 nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); 821 nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
789 nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); 822 nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
790 nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); 823 nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
791 nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); 824 nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
792 nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); 825 nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
793 nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); 826 nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
794 nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); 827 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
795 nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); 828 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
796 nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); 829 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
797 nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); 830 nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
798 nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); 831 nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
799 nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); 832 nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
800 nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); 833 nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
801 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); 834 nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
802 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); 835 nWP.valid = true;
803 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
804 nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
805 nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
806 nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
807 nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
808 nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
809 nWP.valid = true;
810 }
811 } 836 }
812 } 837 }
813 } 838 }
@@ -857,124 +882,118 @@ namespace OpenSim.Data.MySQL
857 882
858 public void StoreRegionWindlightSettings(RegionLightShareData wl) 883 public void StoreRegionWindlightSettings(RegionLightShareData wl)
859 { 884 {
860 lock (m_dbLock) 885 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
861 { 886 {
862 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 887 dbcon.Open();
888
889 using (MySqlCommand cmd = dbcon.CreateCommand())
863 { 890 {
864 dbcon.Open(); 891 cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
865 892 cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
866 using (MySqlCommand cmd = dbcon.CreateCommand()) 893 cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
867 { 894 cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
868 cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; 895 cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
869 cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; 896 cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
870 cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; 897 cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
871 cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; 898 cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
872 cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; 899 cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
873 cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; 900 cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
874 cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; 901 cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
875 cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; 902 cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
876 cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; 903 cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
877 cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; 904 cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
878 cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; 905 cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
879 cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; 906 cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
880 cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; 907 cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
881 cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; 908 cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
882 cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; 909 cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
883 cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; 910 cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
884 cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; 911 cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
885 cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; 912 cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
886 cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; 913 cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
887 cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; 914 cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
888 cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; 915 cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
889 cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; 916
890 cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; 917 cmd.Parameters.AddWithValue("region_id", wl.regionID);
891 cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; 918 cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
892 cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; 919 cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
893 920 cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
894 cmd.Parameters.AddWithValue("region_id", wl.regionID); 921 cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
895 cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); 922 cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
896 cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); 923 cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
897 cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); 924 cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
898 cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); 925 cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
899 cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); 926 cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
900 cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); 927 cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
901 cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); 928 cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
902 cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); 929 cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
903 cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); 930 cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
904 cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); 931 cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
905 cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); 932 cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
906 cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); 933 cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
907 cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); 934 cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
908 cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); 935 cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
909 cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); 936 cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
910 cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); 937 cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
911 cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); 938 cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
912 cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); 939 cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
913 cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); 940 cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
914 cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); 941 cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
915 cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); 942 cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
916 cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); 943 cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
917 cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); 944 cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
918 cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); 945 cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
919 cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); 946 cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
920 cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); 947 cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
921 cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); 948 cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
922 cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); 949 cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
923 cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); 950 cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
924 cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); 951 cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
925 cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); 952 cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
926 cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); 953 cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
927 cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); 954 cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
928 cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); 955 cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
929 cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); 956 cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
930 cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); 957 cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
931 cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); 958 cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
932 cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); 959 cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
933 cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); 960 cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
934 cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); 961 cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
935 cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); 962 cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
936 cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); 963 cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
937 cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); 964 cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
938 cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); 965 cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
939 cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); 966 cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
940 cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); 967 cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
941 cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); 968 cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
942 cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); 969 cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
943 cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); 970 cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
944 cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); 971 cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
945 cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); 972 cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
946 cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); 973 cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
947 cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); 974 cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
948 cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); 975 cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
949 cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); 976 cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
950 cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); 977 cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
951 cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); 978 cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
952 cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); 979 cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
953 cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); 980
954 cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); 981 ExecuteNonQuery(cmd);
955 cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
956 cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
957
958 ExecuteNonQuery(cmd);
959 }
960 } 982 }
961 } 983 }
962 } 984 }
963 985
964 public void RemoveRegionWindlightSettings(UUID regionID) 986 public void RemoveRegionWindlightSettings(UUID regionID)
965 { 987 {
966 lock (m_dbLock) 988 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
967 { 989 {
968 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 990 dbcon.Open();
991
992 using (MySqlCommand cmd = dbcon.CreateCommand())
969 { 993 {
970 dbcon.Open(); 994 cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
971 995 cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
972 using (MySqlCommand cmd = dbcon.CreateCommand()) 996 ExecuteNonQuery(cmd);
973 {
974 cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
975 cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
976 ExecuteNonQuery(cmd);
977 }
978 } 997 }
979 } 998 }
980 } 999 }
@@ -982,29 +1001,26 @@ namespace OpenSim.Data.MySQL
982 #region RegionEnvironmentSettings 1001 #region RegionEnvironmentSettings
983 public string LoadRegionEnvironmentSettings(UUID regionUUID) 1002 public string LoadRegionEnvironmentSettings(UUID regionUUID)
984 { 1003 {
985 lock (m_dbLock) 1004 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
986 { 1005 {
987 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1006 dbcon.Open();
1007
1008 string command = "select * from `regionenvironment` where region_id = ?region_id";
1009
1010 using (MySqlCommand cmd = new MySqlCommand(command))
988 { 1011 {
989 dbcon.Open(); 1012 cmd.Connection = dbcon;
990 1013
991 string command = "select * from `regionenvironment` where region_id = ?region_id"; 1014 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
992 1015
993 using (MySqlCommand cmd = new MySqlCommand(command)) 1016 IDataReader result = ExecuteReader(cmd);
1017 if (!result.Read())
994 { 1018 {
995 cmd.Connection = dbcon; 1019 return String.Empty;
996 1020 }
997 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); 1021 else
998 1022 {
999 IDataReader result = ExecuteReader(cmd); 1023 return Convert.ToString(result["llsd_settings"]);
1000 if (!result.Read())
1001 {
1002 return String.Empty;
1003 }
1004 else
1005 {
1006 return Convert.ToString(result["llsd_settings"]);
1007 }
1008 } 1024 }
1009 } 1025 }
1010 } 1026 }
@@ -1012,39 +1028,33 @@ namespace OpenSim.Data.MySQL
1012 1028
1013 public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) 1029 public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
1014 { 1030 {
1015 lock (m_dbLock) 1031 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1016 { 1032 {
1017 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1033 dbcon.Open();
1034
1035 using (MySqlCommand cmd = dbcon.CreateCommand())
1018 { 1036 {
1019 dbcon.Open(); 1037 cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
1020 1038
1021 using (MySqlCommand cmd = dbcon.CreateCommand()) 1039 cmd.Parameters.AddWithValue("region_id", regionUUID);
1022 { 1040 cmd.Parameters.AddWithValue("llsd_settings", settings);
1023 cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; 1041
1024 1042 ExecuteNonQuery(cmd);
1025 cmd.Parameters.AddWithValue("region_id", regionUUID);
1026 cmd.Parameters.AddWithValue("llsd_settings", settings);
1027
1028 ExecuteNonQuery(cmd);
1029 }
1030 } 1043 }
1031 } 1044 }
1032 } 1045 }
1033 1046
1034 public void RemoveRegionEnvironmentSettings(UUID regionUUID) 1047 public void RemoveRegionEnvironmentSettings(UUID regionUUID)
1035 { 1048 {
1036 lock (m_dbLock) 1049 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1037 { 1050 {
1038 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1051 dbcon.Open();
1052
1053 using (MySqlCommand cmd = dbcon.CreateCommand())
1039 { 1054 {
1040 dbcon.Open(); 1055 cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
1041 1056 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
1042 using (MySqlCommand cmd = dbcon.CreateCommand()) 1057 ExecuteNonQuery(cmd);
1043 {
1044 cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
1045 cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
1046 ExecuteNonQuery(cmd);
1047 }
1048 } 1058 }
1049 } 1059 }
1050 } 1060 }
@@ -1052,56 +1062,55 @@ namespace OpenSim.Data.MySQL
1052 1062
1053 public void StoreRegionSettings(RegionSettings rs) 1063 public void StoreRegionSettings(RegionSettings rs)
1054 { 1064 {
1055 lock (m_dbLock) 1065 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1056 { 1066 {
1057 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 1067 dbcon.Open();
1058 {
1059 dbcon.Open();
1060
1061 using (MySqlCommand cmd = dbcon.CreateCommand())
1062 {
1063 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1064 "block_terraform, block_fly, allow_damage, " +
1065 "restrict_pushing, allow_land_resell, " +
1066 "allow_land_join_divide, block_show_in_search, " +
1067 "agent_limit, object_bonus, maturity, " +
1068 "disable_scripts, disable_collisions, " +
1069 "disable_physics, terrain_texture_1, " +
1070 "terrain_texture_2, terrain_texture_3, " +
1071 "terrain_texture_4, elevation_1_nw, " +
1072 "elevation_2_nw, elevation_1_ne, " +
1073 "elevation_2_ne, elevation_1_se, " +
1074 "elevation_2_se, elevation_1_sw, " +
1075 "elevation_2_sw, water_height, " +
1076 "terrain_raise_limit, terrain_lower_limit, " +
1077 "use_estate_sun, fixed_sun, sun_position, " +
1078 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1079 "sunvectorz, loaded_creation_datetime, " +
1080 "loaded_creation_id, map_tile_ID, " +
1081 "TelehubObject, parcel_tile_ID) " +
1082 "values (?RegionUUID, ?BlockTerraform, " +
1083 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1084 "?AllowLandResell, ?AllowLandJoinDivide, " +
1085 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1086 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1087 "?DisablePhysics, ?TerrainTexture1, " +
1088 "?TerrainTexture2, ?TerrainTexture3, " +
1089 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1090 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1091 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1092 "?WaterHeight, ?TerrainRaiseLimit, " +
1093 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1094 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1095 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1096 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1097 "?TerrainImageID, ?TelehubObject, ?ParcelImageID) ";
1098
1099 FillRegionSettingsCommand(cmd, rs);
1100 1068
1101 ExecuteNonQuery(cmd); 1069 using (MySqlCommand cmd = dbcon.CreateCommand())
1102 } 1070 {
1071 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1072 "block_terraform, block_fly, allow_damage, " +
1073 "restrict_pushing, allow_land_resell, " +
1074 "allow_land_join_divide, block_show_in_search, " +
1075 "agent_limit, object_bonus, maturity, " +
1076 "disable_scripts, disable_collisions, " +
1077 "disable_physics, terrain_texture_1, " +
1078 "terrain_texture_2, terrain_texture_3, " +
1079 "terrain_texture_4, elevation_1_nw, " +
1080 "elevation_2_nw, elevation_1_ne, " +
1081 "elevation_2_ne, elevation_1_se, " +
1082 "elevation_2_se, elevation_1_sw, " +
1083 "elevation_2_sw, water_height, " +
1084 "terrain_raise_limit, terrain_lower_limit, " +
1085 "use_estate_sun, fixed_sun, sun_position, " +
1086 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1087 "sunvectorz, loaded_creation_datetime, " +
1088 "loaded_creation_id, map_tile_ID, " +
1089 "TelehubObject, parcel_tile_ID) " +
1090 "values (?RegionUUID, ?BlockTerraform, " +
1091 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1092 "?AllowLandResell, ?AllowLandJoinDivide, " +
1093 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1094 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1095 "?DisablePhysics, ?TerrainTexture1, " +
1096 "?TerrainTexture2, ?TerrainTexture3, " +
1097 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1098 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1099 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1100 "?WaterHeight, ?TerrainRaiseLimit, " +
1101 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1102 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1103 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1104 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1105 "?TerrainImageID, " +
1106 "?TelehubObject, ?ParcelImageID)";
1107
1108 FillRegionSettingsCommand(cmd, rs);
1109
1110 ExecuteNonQuery(cmd);
1103 } 1111 }
1104 } 1112 }
1113
1105 SaveSpawnPoints(rs); 1114 SaveSpawnPoints(rs);
1106 } 1115 }
1107 1116
@@ -1292,6 +1301,39 @@ namespace OpenSim.Data.MySQL
1292 if (!(row["MediaURL"] is System.DBNull)) 1301 if (!(row["MediaURL"] is System.DBNull))
1293 prim.MediaUrl = (string)row["MediaURL"]; 1302 prim.MediaUrl = (string)row["MediaURL"];
1294 1303
1304 if (!(row["AttachedPosX"] is System.DBNull))
1305 {
1306 prim.AttachedPos = new Vector3(
1307 (float)(double)row["AttachedPosX"],
1308 (float)(double)row["AttachedPosY"],
1309 (float)(double)row["AttachedPosZ"]
1310 );
1311 }
1312
1313 if (!(row["DynAttrs"] is System.DBNull))
1314 prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
1315 else
1316 prim.DynAttrs = new DAMap();
1317
1318 if (!(row["KeyframeMotion"] is DBNull))
1319 {
1320 Byte[] data = (byte[])row["KeyframeMotion"];
1321 if (data.Length > 0)
1322 prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
1323 else
1324 prim.KeyframeMotion = null;
1325 }
1326 else
1327 {
1328 prim.KeyframeMotion = null;
1329 }
1330
1331 prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
1332 prim.Density = (float)(double)row["Density"];
1333 prim.GravityModifier = (float)(double)row["GravityModifier"];
1334 prim.Friction = (float)(double)row["Friction"];
1335 prim.Restitution = (float)(double)row["Restitution"];
1336
1295 return prim; 1337 return prim;
1296 } 1338 }
1297 1339
@@ -1431,6 +1473,7 @@ namespace OpenSim.Data.MySQL
1431 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); 1473 UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
1432 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); 1474 UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
1433 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1475 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1476 newData.Dwell = Convert.ToSingle(row["Dwell"]);
1434 1477
1435 newData.AuthBuyerID = authedbuyer; 1478 newData.AuthBuyerID = authedbuyer;
1436 newData.SnapshotID = snapshotID; 1479 newData.SnapshotID = snapshotID;
@@ -1478,30 +1521,6 @@ namespace OpenSim.Data.MySQL
1478 } 1521 }
1479 1522
1480 /// <summary> 1523 /// <summary>
1481 ///
1482 /// </summary>
1483 /// <param name="val"></param>
1484 /// <returns></returns>
1485 private static Array SerializeTerrain(double[,] val)
1486 {
1487 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
1488 BinaryWriter bw = new BinaryWriter(str);
1489
1490 // TODO: COMPATIBILITY - Add byte-order conversions
1491 for (int x = 0; x < (int)Constants.RegionSize; x++)
1492 for (int y = 0; y < (int)Constants.RegionSize; y++)
1493 {
1494 double height = val[x, y];
1495 if (height == 0.0)
1496 height = double.Epsilon;
1497
1498 bw.Write(height);
1499 }
1500
1501 return str.ToArray();
1502 }
1503
1504 /// <summary>
1505 /// Fill the prim command with prim values 1524 /// Fill the prim command with prim values
1506 /// </summary> 1525 /// </summary>
1507 /// <param name="row"></param> 1526 /// <param name="row"></param>
@@ -1637,6 +1656,28 @@ namespace OpenSim.Data.MySQL
1637 1656
1638 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); 1657 cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
1639 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); 1658 cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
1659 if (prim.AttachedPos != null)
1660 {
1661 cmd.Parameters.AddWithValue("AttachedPosX", (double)prim.AttachedPos.X);
1662 cmd.Parameters.AddWithValue("AttachedPosY", (double)prim.AttachedPos.Y);
1663 cmd.Parameters.AddWithValue("AttachedPosZ", (double)prim.AttachedPos.Z);
1664 }
1665
1666 if (prim.KeyframeMotion != null)
1667 cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
1668 else
1669 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1670
1671 if (prim.DynAttrs.CountNamespaces > 0)
1672 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1673 else
1674 cmd.Parameters.AddWithValue("DynAttrs", null);
1675
1676 cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
1677 cmd.Parameters.AddWithValue("Density", (double)prim.Density);
1678 cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
1679 cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
1680 cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
1640 } 1681 }
1641 1682
1642 /// <summary> 1683 /// <summary>
@@ -1715,6 +1756,7 @@ namespace OpenSim.Data.MySQL
1715 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); 1756 cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
1716 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); 1757 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1717 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); 1758 cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);
1759
1718 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); 1760 cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
1719 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); 1761 cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
1720 } 1762 }
@@ -1763,6 +1805,7 @@ namespace OpenSim.Data.MySQL
1763 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); 1805 cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
1764 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); 1806 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
1765 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); 1807 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
1808 cmd.Parameters.AddWithValue("Dwell", land.Dwell);
1766 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); 1809 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
1767 cmd.Parameters.AddWithValue("MediaType", land.MediaType); 1810 cmd.Parameters.AddWithValue("MediaType", land.MediaType);
1768 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); 1811 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
@@ -1770,7 +1813,6 @@ namespace OpenSim.Data.MySQL
1770 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); 1813 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
1771 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); 1814 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
1772 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); 1815 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
1773
1774 } 1816 }
1775 1817
1776 /// <summary> 1818 /// <summary>
@@ -1826,6 +1868,7 @@ namespace OpenSim.Data.MySQL
1826 s.ExtraParams = (byte[])row["ExtraParams"]; 1868 s.ExtraParams = (byte[])row["ExtraParams"];
1827 1869
1828 s.State = (byte)(int)row["State"]; 1870 s.State = (byte)(int)row["State"];
1871 s.LastAttachPoint = (byte)(int)row["LastAttachPoint"];
1829 1872
1830 if (!(row["Media"] is System.DBNull)) 1873 if (!(row["Media"] is System.DBNull))
1831 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 1874 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
@@ -1872,6 +1915,7 @@ namespace OpenSim.Data.MySQL
1872 cmd.Parameters.AddWithValue("Texture", s.TextureEntry); 1915 cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
1873 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); 1916 cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
1874 cmd.Parameters.AddWithValue("State", s.State); 1917 cmd.Parameters.AddWithValue("State", s.State);
1918 cmd.Parameters.AddWithValue("LastAttachPoint", s.LastAttachPoint);
1875 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); 1919 cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
1876 } 1920 }
1877 1921
@@ -1988,41 +2032,35 @@ namespace OpenSim.Data.MySQL
1988 2032
1989 public void SaveExtra(UUID regionID, string name, string val) 2033 public void SaveExtra(UUID regionID, string name, string val)
1990 { 2034 {
1991 lock (m_dbLock) 2035 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1992 { 2036 {
1993 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 2037 dbcon.Open();
1994 {
1995 dbcon.Open();
1996 2038
1997 using (MySqlCommand cmd = dbcon.CreateCommand()) 2039 using (MySqlCommand cmd = dbcon.CreateCommand())
1998 { 2040 {
1999 cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)"; 2041 cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)";
2000 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); 2042 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2001 cmd.Parameters.AddWithValue("?Name", name); 2043 cmd.Parameters.AddWithValue("?Name", name);
2002 cmd.Parameters.AddWithValue("?value", val); 2044 cmd.Parameters.AddWithValue("?value", val);
2003 2045
2004 cmd.ExecuteNonQuery(); 2046 cmd.ExecuteNonQuery();
2005 }
2006 } 2047 }
2007 } 2048 }
2008 } 2049 }
2009 2050
2010 public void RemoveExtra(UUID regionID, string name) 2051 public void RemoveExtra(UUID regionID, string name)
2011 { 2052 {
2012 lock (m_dbLock) 2053 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2013 { 2054 {
2014 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 2055 dbcon.Open();
2015 {
2016 dbcon.Open();
2017 2056
2018 using (MySqlCommand cmd = dbcon.CreateCommand()) 2057 using (MySqlCommand cmd = dbcon.CreateCommand())
2019 { 2058 {
2020 cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name"; 2059 cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name";
2021 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); 2060 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2022 cmd.Parameters.AddWithValue("?Name", name); 2061 cmd.Parameters.AddWithValue("?Name", name);
2023 2062
2024 cmd.ExecuteNonQuery(); 2063 cmd.ExecuteNonQuery();
2025 }
2026 } 2064 }
2027 } 2065 }
2028 } 2066 }
@@ -2031,22 +2069,19 @@ namespace OpenSim.Data.MySQL
2031 { 2069 {
2032 Dictionary<string, string> ret = new Dictionary<string, string>(); 2070 Dictionary<string, string> ret = new Dictionary<string, string>();
2033 2071
2034 lock (m_dbLock) 2072 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2035 { 2073 {
2036 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 2074 dbcon.Open();
2037 {
2038 dbcon.Open();
2039 2075
2040 using (MySqlCommand cmd = dbcon.CreateCommand()) 2076 using (MySqlCommand cmd = dbcon.CreateCommand())
2077 {
2078 cmd.CommandText = "select * from regionextra where RegionID=?RegionID";
2079 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2080 using (IDataReader r = cmd.ExecuteReader())
2041 { 2081 {
2042 cmd.CommandText = "select * from regionextra where RegionID=?RegionID"; 2082 while (r.Read())
2043 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2044 using (IDataReader r = cmd.ExecuteReader())
2045 { 2083 {
2046 while (r.Read()) 2084 ret[r["Name"].ToString()] = r["value"].ToString();
2047 {
2048 ret[r["Name"].ToString()] = r["value"].ToString();
2049 }
2050 } 2085 }
2051 } 2086 }
2052 } 2087 }