diff options
author | Justin Clark-Casey (justincc) | 2014-08-22 20:23:48 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-22 20:23:48 +0100 |
commit | 709038aa2adfe5a668c2452ec7acde517125c4e8 (patch) | |
tree | c0e078c2eea6a58a1f1eea3a932d5439ea830cba | |
parent | Remove lock in MySQLFramework. This is not necessary as the connection is no... (diff) | |
download | opensim-SC-709038aa2adfe5a668c2452ec7acde517125c4e8.zip opensim-SC-709038aa2adfe5a668c2452ec7acde517125c4e8.tar.gz opensim-SC-709038aa2adfe5a668c2452ec7acde517125c4e8.tar.bz2 opensim-SC-709038aa2adfe5a668c2452ec7acde517125c4e8.tar.xz |
Remove some use of database connection locking from MySQLSimulationData - this has not been necessary for some time as database connections are not shared.
However, many locks remain since they may effectively be providing transactionality in some operations (e.g. prim updates across multiple tables).
These are candidates for being replaced with proper database transactions, since this would not block unrelated operations (e.g. land save and object save)
or unrelated operations on the same tables (e.g. storage of one linkset whilst another is being removed).
In practice, any performance deg due to contention is probably rare and short lived as the major prim operations are performed in memory and only persisted some time afterwards.
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 616 |
1 files changed, 298 insertions, 318 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 8937b64..bb0ab75 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -51,6 +51,15 @@ namespace OpenSim.Data.MySQL | |||
51 | private static string LogHeader = "[REGION DB MYSQL]"; | 51 | private static string LogHeader = "[REGION DB MYSQL]"; |
52 | 52 | ||
53 | 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> | ||
54 | private object m_dbLock = new object(); | 63 | private object m_dbLock = new object(); |
55 | 64 | ||
56 | protected virtual Assembly Assembly | 65 | protected virtual Assembly Assembly |
@@ -738,95 +747,92 @@ namespace OpenSim.Data.MySQL | |||
738 | RegionLightShareData nWP = new RegionLightShareData(); | 747 | RegionLightShareData nWP = new RegionLightShareData(); |
739 | nWP.OnSave += StoreRegionWindlightSettings; | 748 | nWP.OnSave += StoreRegionWindlightSettings; |
740 | 749 | ||
741 | lock (m_dbLock) | 750 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
742 | { | 751 | { |
743 | 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)) | ||
744 | { | 757 | { |
745 | dbcon.Open(); | 758 | cmd.Connection = dbcon; |
746 | 759 | ||
747 | string command = "select * from `regionwindlight` where region_id = ?regionID"; | 760 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
748 | 761 | ||
749 | using (MySqlCommand cmd = new MySqlCommand(command)) | 762 | IDataReader result = ExecuteReader(cmd); |
763 | if (!result.Read()) | ||
750 | { | 764 | { |
751 | cmd.Connection = dbcon; | 765 | //No result, so store our default windlight profile and return it |
752 | 766 | nWP.regionID = regionUUID; | |
753 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | ||
754 | |||
755 | IDataReader result = ExecuteReader(cmd); | ||
756 | if (!result.Read()) | ||
757 | { | ||
758 | //No result, so store our default windlight profile and return it | ||
759 | nWP.regionID = regionUUID; | ||
760 | // StoreRegionWindlightSettings(nWP); | 767 | // StoreRegionWindlightSettings(nWP); |
761 | return nWP; | 768 | return nWP; |
762 | } | 769 | } |
763 | else | 770 | else |
764 | { | 771 | { |
765 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | 772 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
766 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 773 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
767 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 774 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
768 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 775 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
769 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 776 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
770 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 777 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
771 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 778 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
772 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 779 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
773 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 780 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
774 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 781 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
775 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 782 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
776 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 783 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
777 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 784 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
778 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 785 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
779 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 786 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
780 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 787 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
781 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 788 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
782 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 789 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
783 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 790 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); |
784 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 791 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
785 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 792 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
786 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 793 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
787 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 794 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
788 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 795 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
789 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 796 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
790 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 797 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
791 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 798 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
792 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 799 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
793 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 800 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
794 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 801 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
795 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 802 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
796 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 803 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
797 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 804 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
798 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 805 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
799 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 806 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
800 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 807 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
801 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 808 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
802 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 809 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
803 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 810 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
804 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 811 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
805 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 812 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
806 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 813 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
807 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 814 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
808 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 815 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
809 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 816 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
810 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 817 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
811 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 818 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
812 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 819 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
813 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 820 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
814 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 821 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
815 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 822 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); |
816 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 823 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); |
817 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 824 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); |
818 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 825 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); |
819 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 826 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); |
820 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 827 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); |
821 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 828 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); |
822 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 829 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); |
823 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 830 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); |
824 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 831 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); |
825 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 832 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); |
826 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 833 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); |
827 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 834 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); |
828 | nWP.valid = true; | 835 | nWP.valid = true; |
829 | } | ||
830 | } | 836 | } |
831 | } | 837 | } |
832 | } | 838 | } |
@@ -876,124 +882,118 @@ namespace OpenSim.Data.MySQL | |||
876 | 882 | ||
877 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 883 | public void StoreRegionWindlightSettings(RegionLightShareData wl) |
878 | { | 884 | { |
879 | lock (m_dbLock) | 885 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
880 | { | 886 | { |
881 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 887 | dbcon.Open(); |
888 | |||
889 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
882 | { | 890 | { |
883 | dbcon.Open(); | 891 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; |
884 | 892 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | |
885 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 893 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; |
886 | { | 894 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; |
887 | 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`, "; |
888 | 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`, "; |
889 | 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`, "; |
890 | 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`, "; |
891 | 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`, "; |
892 | 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`, "; |
893 | 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`, "; |
894 | 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`, "; |
895 | 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`, "; |
896 | 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, "; |
897 | 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, "; |
898 | 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, "; |
899 | 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, "; |
900 | 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, "; |
901 | 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, "; |
902 | 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, "; |
903 | 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, "; |
904 | 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, "; |
905 | 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, "; |
906 | 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, "; |
907 | 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)"; |
908 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 916 | |
909 | 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); |
910 | 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); |
911 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 919 | cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); |
912 | 920 | cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); | |
913 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 921 | cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); |
914 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 922 | cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); |
915 | cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); | 923 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); |
916 | cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); | 924 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); |
917 | cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); | 925 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); |
918 | cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); | 926 | cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); |
919 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); | 927 | cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); |
920 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); | 928 | cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); |
921 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); | 929 | cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); |
922 | cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); | 930 | cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); |
923 | cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); | 931 | cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); |
924 | cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); | 932 | cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); |
925 | cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); | 933 | cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); |
926 | cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); | 934 | cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); |
927 | cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); | 935 | cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); |
928 | cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); | 936 | cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); |
929 | cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); | 937 | cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); |
930 | cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); | 938 | cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); |
931 | cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); | 939 | cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); |
932 | cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); | 940 | cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); |
933 | cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); | 941 | cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); |
934 | cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); | 942 | cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); |
935 | cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); | 943 | cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); |
936 | cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); | 944 | cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); |
937 | cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); | 945 | cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); |
938 | cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); | 946 | cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); |
939 | cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); | 947 | cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); |
940 | cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); | 948 | cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); |
941 | cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); | 949 | cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); |
942 | cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); | 950 | cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); |
943 | cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); | 951 | cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); |
944 | cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); | 952 | cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); |
945 | cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); | 953 | cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); |
946 | cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); | 954 | cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); |
947 | cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); | 955 | cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); |
948 | cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); | 956 | cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); |
949 | cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); | 957 | cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); |
950 | cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); | 958 | cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); |
951 | cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); | 959 | cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); |
952 | cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); | 960 | cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); |
953 | cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); | 961 | cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); |
954 | cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); | 962 | cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); |
955 | cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); | 963 | cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); |
956 | cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); | 964 | cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); |
957 | cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); | 965 | cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); |
958 | cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); | 966 | cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); |
959 | cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); | 967 | cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); |
960 | cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); | 968 | cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); |
961 | cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); | 969 | cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); |
962 | cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); | 970 | cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); |
963 | cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); | 971 | cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); |
964 | cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); | 972 | cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); |
965 | cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); | 973 | cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); |
966 | cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); | 974 | cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); |
967 | cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); | 975 | cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); |
968 | cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); | 976 | cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); |
969 | cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); | 977 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); |
970 | cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); | 978 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); |
971 | cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); | 979 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); |
972 | cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); | 980 | |
973 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | 981 | ExecuteNonQuery(cmd); |
974 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | ||
975 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | ||
976 | |||
977 | ExecuteNonQuery(cmd); | ||
978 | } | ||
979 | } | 982 | } |
980 | } | 983 | } |
981 | } | 984 | } |
982 | 985 | ||
983 | public void RemoveRegionWindlightSettings(UUID regionID) | 986 | public void RemoveRegionWindlightSettings(UUID regionID) |
984 | { | 987 | { |
985 | lock (m_dbLock) | 988 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
986 | { | 989 | { |
987 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 990 | dbcon.Open(); |
991 | |||
992 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
988 | { | 993 | { |
989 | dbcon.Open(); | 994 | cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; |
990 | 995 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | |
991 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 996 | ExecuteNonQuery(cmd); |
992 | { | ||
993 | cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; | ||
994 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | ||
995 | ExecuteNonQuery(cmd); | ||
996 | } | ||
997 | } | 997 | } |
998 | } | 998 | } |
999 | } | 999 | } |
@@ -1001,29 +1001,26 @@ namespace OpenSim.Data.MySQL | |||
1001 | #region RegionEnvironmentSettings | 1001 | #region RegionEnvironmentSettings |
1002 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | 1002 | public string LoadRegionEnvironmentSettings(UUID regionUUID) |
1003 | { | 1003 | { |
1004 | lock (m_dbLock) | 1004 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1005 | { | 1005 | { |
1006 | 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)) | ||
1007 | { | 1011 | { |
1008 | dbcon.Open(); | 1012 | cmd.Connection = dbcon; |
1009 | 1013 | ||
1010 | string command = "select * from `regionenvironment` where region_id = ?region_id"; | 1014 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1011 | 1015 | ||
1012 | using (MySqlCommand cmd = new MySqlCommand(command)) | 1016 | IDataReader result = ExecuteReader(cmd); |
1017 | if (!result.Read()) | ||
1013 | { | 1018 | { |
1014 | cmd.Connection = dbcon; | 1019 | return String.Empty; |
1015 | 1020 | } | |
1016 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1021 | else |
1017 | 1022 | { | |
1018 | IDataReader result = ExecuteReader(cmd); | 1023 | return Convert.ToString(result["llsd_settings"]); |
1019 | if (!result.Read()) | ||
1020 | { | ||
1021 | return String.Empty; | ||
1022 | } | ||
1023 | else | ||
1024 | { | ||
1025 | return Convert.ToString(result["llsd_settings"]); | ||
1026 | } | ||
1027 | } | 1024 | } |
1028 | } | 1025 | } |
1029 | } | 1026 | } |
@@ -1031,39 +1028,33 @@ namespace OpenSim.Data.MySQL | |||
1031 | 1028 | ||
1032 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | 1029 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) |
1033 | { | 1030 | { |
1034 | lock (m_dbLock) | 1031 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1035 | { | 1032 | { |
1036 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1033 | dbcon.Open(); |
1034 | |||
1035 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1037 | { | 1036 | { |
1038 | dbcon.Open(); | 1037 | cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; |
1039 | 1038 | ||
1040 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1039 | cmd.Parameters.AddWithValue("region_id", regionUUID); |
1041 | { | 1040 | cmd.Parameters.AddWithValue("llsd_settings", settings); |
1042 | cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; | 1041 | |
1043 | 1042 | ExecuteNonQuery(cmd); | |
1044 | cmd.Parameters.AddWithValue("region_id", regionUUID); | ||
1045 | cmd.Parameters.AddWithValue("llsd_settings", settings); | ||
1046 | |||
1047 | ExecuteNonQuery(cmd); | ||
1048 | } | ||
1049 | } | 1043 | } |
1050 | } | 1044 | } |
1051 | } | 1045 | } |
1052 | 1046 | ||
1053 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | 1047 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) |
1054 | { | 1048 | { |
1055 | lock (m_dbLock) | 1049 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1056 | { | 1050 | { |
1057 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1051 | dbcon.Open(); |
1052 | |||
1053 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1058 | { | 1054 | { |
1059 | dbcon.Open(); | 1055 | cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id"; |
1060 | 1056 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | |
1061 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1057 | ExecuteNonQuery(cmd); |
1062 | { | ||
1063 | cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id"; | ||
1064 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | ||
1065 | ExecuteNonQuery(cmd); | ||
1066 | } | ||
1067 | } | 1058 | } |
1068 | } | 1059 | } |
1069 | } | 1060 | } |
@@ -1071,57 +1062,55 @@ namespace OpenSim.Data.MySQL | |||
1071 | 1062 | ||
1072 | public void StoreRegionSettings(RegionSettings rs) | 1063 | public void StoreRegionSettings(RegionSettings rs) |
1073 | { | 1064 | { |
1074 | lock (m_dbLock) | 1065 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1075 | { | 1066 | { |
1076 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1067 | dbcon.Open(); |
1077 | { | ||
1078 | dbcon.Open(); | ||
1079 | |||
1080 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1081 | { | ||
1082 | cmd.CommandText = "replace into regionsettings (regionUUID, " + | ||
1083 | "block_terraform, block_fly, allow_damage, " + | ||
1084 | "restrict_pushing, allow_land_resell, " + | ||
1085 | "allow_land_join_divide, block_show_in_search, " + | ||
1086 | "agent_limit, object_bonus, maturity, " + | ||
1087 | "disable_scripts, disable_collisions, " + | ||
1088 | "disable_physics, terrain_texture_1, " + | ||
1089 | "terrain_texture_2, terrain_texture_3, " + | ||
1090 | "terrain_texture_4, elevation_1_nw, " + | ||
1091 | "elevation_2_nw, elevation_1_ne, " + | ||
1092 | "elevation_2_ne, elevation_1_se, " + | ||
1093 | "elevation_2_se, elevation_1_sw, " + | ||
1094 | "elevation_2_sw, water_height, " + | ||
1095 | "terrain_raise_limit, terrain_lower_limit, " + | ||
1096 | "use_estate_sun, fixed_sun, sun_position, " + | ||
1097 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | ||
1098 | "sunvectorz, loaded_creation_datetime, " + | ||
1099 | "loaded_creation_id, map_tile_ID, " + | ||
1100 | "TelehubObject, parcel_tile_ID) " + | ||
1101 | "values (?RegionUUID, ?BlockTerraform, " + | ||
1102 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | ||
1103 | "?AllowLandResell, ?AllowLandJoinDivide, " + | ||
1104 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | ||
1105 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + | ||
1106 | "?DisablePhysics, ?TerrainTexture1, " + | ||
1107 | "?TerrainTexture2, ?TerrainTexture3, " + | ||
1108 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + | ||
1109 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + | ||
1110 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + | ||
1111 | "?WaterHeight, ?TerrainRaiseLimit, " + | ||
1112 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + | ||
1113 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | ||
1114 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | ||
1115 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | ||
1116 | "?TerrainImageID, " + | ||
1117 | "?TelehubObject, ?ParcelImageID)"; | ||
1118 | |||
1119 | FillRegionSettingsCommand(cmd, rs); | ||
1120 | 1068 | ||
1121 | ExecuteNonQuery(cmd); | 1069 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1122 | } | 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); | ||
1123 | } | 1111 | } |
1124 | } | 1112 | } |
1113 | |||
1125 | SaveSpawnPoints(rs); | 1114 | SaveSpawnPoints(rs); |
1126 | } | 1115 | } |
1127 | 1116 | ||
@@ -2043,41 +2032,35 @@ namespace OpenSim.Data.MySQL | |||
2043 | 2032 | ||
2044 | public void SaveExtra(UUID regionID, string name, string val) | 2033 | public void SaveExtra(UUID regionID, string name, string val) |
2045 | { | 2034 | { |
2046 | lock (m_dbLock) | 2035 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
2047 | { | 2036 | { |
2048 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 2037 | dbcon.Open(); |
2049 | { | ||
2050 | dbcon.Open(); | ||
2051 | 2038 | ||
2052 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 2039 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
2053 | { | 2040 | { |
2054 | cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)"; | 2041 | cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)"; |
2055 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 2042 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
2056 | cmd.Parameters.AddWithValue("?Name", name); | 2043 | cmd.Parameters.AddWithValue("?Name", name); |
2057 | cmd.Parameters.AddWithValue("?value", val); | 2044 | cmd.Parameters.AddWithValue("?value", val); |
2058 | 2045 | ||
2059 | cmd.ExecuteNonQuery(); | 2046 | cmd.ExecuteNonQuery(); |
2060 | } | ||
2061 | } | 2047 | } |
2062 | } | 2048 | } |
2063 | } | 2049 | } |
2064 | 2050 | ||
2065 | public void RemoveExtra(UUID regionID, string name) | 2051 | public void RemoveExtra(UUID regionID, string name) |
2066 | { | 2052 | { |
2067 | lock (m_dbLock) | 2053 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
2068 | { | 2054 | { |
2069 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 2055 | dbcon.Open(); |
2070 | { | ||
2071 | dbcon.Open(); | ||
2072 | 2056 | ||
2073 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 2057 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
2074 | { | 2058 | { |
2075 | cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name"; | 2059 | cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name"; |
2076 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 2060 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
2077 | cmd.Parameters.AddWithValue("?Name", name); | 2061 | cmd.Parameters.AddWithValue("?Name", name); |
2078 | 2062 | ||
2079 | cmd.ExecuteNonQuery(); | 2063 | cmd.ExecuteNonQuery(); |
2080 | } | ||
2081 | } | 2064 | } |
2082 | } | 2065 | } |
2083 | } | 2066 | } |
@@ -2086,22 +2069,19 @@ namespace OpenSim.Data.MySQL | |||
2086 | { | 2069 | { |
2087 | Dictionary<string, string> ret = new Dictionary<string, string>(); | 2070 | Dictionary<string, string> ret = new Dictionary<string, string>(); |
2088 | 2071 | ||
2089 | lock (m_dbLock) | 2072 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
2090 | { | 2073 | { |
2091 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 2074 | dbcon.Open(); |
2092 | { | ||
2093 | dbcon.Open(); | ||
2094 | 2075 | ||
2095 | 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()) | ||
2096 | { | 2081 | { |
2097 | cmd.CommandText = "select * from regionextra where RegionID=?RegionID"; | 2082 | while (r.Read()) |
2098 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
2099 | using (IDataReader r = cmd.ExecuteReader()) | ||
2100 | { | 2083 | { |
2101 | while (r.Read()) | 2084 | ret[r["Name"].ToString()] = r["value"].ToString(); |
2102 | { | ||
2103 | ret[r["Name"].ToString()] = r["value"].ToString(); | ||
2104 | } | ||
2105 | } | 2085 | } |
2106 | } | 2086 | } |
2107 | } | 2087 | } |