diff options
author | UbitUmarov | 2017-05-06 21:43:22 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-06 21:43:22 +0100 |
commit | c57215687f6ab0a9585c5331edc2da89a88b8a28 (patch) | |
tree | b392c3a21531baf4c822d03db3e1d03e303e494a /OpenSim | |
parent | don't hold dbconn longer than necessart (diff) | |
download | opensim-SC-c57215687f6ab0a9585c5331edc2da89a88b8a28.zip opensim-SC-c57215687f6ab0a9585c5331edc2da89a88b8a28.tar.gz opensim-SC-c57215687f6ab0a9585c5331edc2da89a88b8a28.tar.bz2 opensim-SC-c57215687f6ab0a9585c5331edc2da89a88b8a28.tar.xz |
a few more changes on mysql
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAuthenticationData.cs | 36 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFSAssetData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 62 |
4 files changed, 60 insertions, 48 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs index 5030c1d..fef582e 100644 --- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs +++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs | |||
@@ -77,30 +77,32 @@ namespace OpenSim.Data.MySQL | |||
77 | { | 77 | { |
78 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); | 78 | cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); |
79 | 79 | ||
80 | IDataReader result = cmd.ExecuteReader(); | 80 | using(IDataReader result = cmd.ExecuteReader()) |
81 | |||
82 | if (result.Read()) | ||
83 | { | 81 | { |
84 | ret.PrincipalID = principalID; | 82 | if(result.Read()) |
83 | { | ||
84 | ret.PrincipalID = principalID; | ||
85 | 85 | ||
86 | CheckColumnNames(result); | 86 | CheckColumnNames(result); |
87 | 87 | ||
88 | foreach (string s in m_ColumnNames) | 88 | foreach(string s in m_ColumnNames) |
89 | { | 89 | { |
90 | if (s == "UUID") | 90 | if(s == "UUID") |
91 | continue; | 91 | continue; |
92 | 92 | ||
93 | ret.Data[s] = result[s].ToString(); | 93 | ret.Data[s] = result[s].ToString(); |
94 | } | 94 | } |
95 | 95 | ||
96 | return ret; | 96 | dbcon.Close(); |
97 | } | 97 | return ret; |
98 | else | 98 | } |
99 | { | 99 | else |
100 | return null; | 100 | { |
101 | dbcon.Close(); | ||
102 | return null; | ||
103 | } | ||
101 | } | 104 | } |
102 | } | 105 | } |
103 | dbcon.Close(); | ||
104 | } | 106 | } |
105 | } | 107 | } |
106 | 108 | ||
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 12593f6..eeedf02 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL | |||
82 | 82 | ||
83 | Migration m = new Migration(dbcon, Assembly, "EstateStore"); | 83 | Migration m = new Migration(dbcon, Assembly, "EstateStore"); |
84 | m.Update(); | 84 | m.Update(); |
85 | dbcon.Close(); | ||
85 | 86 | ||
86 | Type t = typeof(EstateSettings); | 87 | Type t = typeof(EstateSettings); |
87 | m_Fields = t.GetFields(BindingFlags.NonPublic | | 88 | m_Fields = t.GetFields(BindingFlags.NonPublic | |
@@ -143,7 +144,6 @@ namespace OpenSim.Data.MySQL | |||
143 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 144 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
144 | { | 145 | { |
145 | dbcon.Open(); | 146 | dbcon.Open(); |
146 | |||
147 | cmd.Connection = dbcon; | 147 | cmd.Connection = dbcon; |
148 | 148 | ||
149 | bool found = false; | 149 | bool found = false; |
@@ -171,13 +171,14 @@ namespace OpenSim.Data.MySQL | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | dbcon.Close(); | ||
175 | cmd.Connection = null; | ||
176 | |||
174 | if (!found && create) | 177 | if (!found && create) |
175 | { | 178 | { |
176 | DoCreate(es); | 179 | DoCreate(es); |
177 | LinkRegion(regionID, (int)es.EstateID); | 180 | LinkRegion(regionID, (int)es.EstateID); |
178 | } | 181 | } |
179 | cmd.Connection = null; | ||
180 | dbcon.Close(); | ||
181 | } | 182 | } |
182 | 183 | ||
183 | LoadBanList(es); | 184 | LoadBanList(es); |
diff --git a/OpenSim/Data/MySQL/MySQLFSAssetData.cs b/OpenSim/Data/MySQL/MySQLFSAssetData.cs index 0918596..6c48607 100644 --- a/OpenSim/Data/MySQL/MySQLFSAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLFSAssetData.cs | |||
@@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL | |||
78 | conn.Open(); | 78 | conn.Open(); |
79 | Migration m = new Migration(conn, Assembly, "FSAssetStore"); | 79 | Migration m = new Migration(conn, Assembly, "FSAssetStore"); |
80 | m.Update(); | 80 | m.Update(); |
81 | conn.Close(); | ||
81 | } | 82 | } |
82 | } | 83 | } |
83 | catch (MySqlException e) | 84 | catch (MySqlException e) |
@@ -126,8 +127,8 @@ namespace OpenSim.Data.MySQL | |||
126 | m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); | 127 | m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); |
127 | return false; | 128 | return false; |
128 | } | 129 | } |
129 | cmd.Connection = null; | ||
130 | conn.Close(); | 130 | conn.Close(); |
131 | cmd.Connection = null; | ||
131 | } | 132 | } |
132 | 133 | ||
133 | return true; | 134 | return true; |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 8d1a4a5..3ea5805 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -262,6 +262,7 @@ namespace OpenSim.Data.MySQL | |||
262 | ExecuteNonQuery(cmd); | 262 | ExecuteNonQuery(cmd); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | dbcon.Close(); | ||
265 | } | 266 | } |
266 | } | 267 | } |
267 | } | 268 | } |
@@ -301,6 +302,7 @@ namespace OpenSim.Data.MySQL | |||
301 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; | 302 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; |
302 | ExecuteNonQuery(cmd); | 303 | ExecuteNonQuery(cmd); |
303 | } | 304 | } |
305 | dbcon.Close(); | ||
304 | } | 306 | } |
305 | } | 307 | } |
306 | 308 | ||
@@ -961,6 +963,7 @@ namespace OpenSim.Data.MySQL | |||
961 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) | 963 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
962 | { | 964 | { |
963 | RegionSettings rs = null; | 965 | RegionSettings rs = null; |
966 | bool needStore = false; | ||
964 | 967 | ||
965 | lock (m_dbLock) | 968 | lock (m_dbLock) |
966 | { | 969 | { |
@@ -986,7 +989,7 @@ namespace OpenSim.Data.MySQL | |||
986 | rs.RegionUUID = regionUUID; | 989 | rs.RegionUUID = regionUUID; |
987 | rs.OnSave += StoreRegionSettings; | 990 | rs.OnSave += StoreRegionSettings; |
988 | 991 | ||
989 | StoreRegionSettings(rs); | 992 | needStore = true; |
990 | } | 993 | } |
991 | } | 994 | } |
992 | } | 995 | } |
@@ -994,6 +997,9 @@ namespace OpenSim.Data.MySQL | |||
994 | } | 997 | } |
995 | } | 998 | } |
996 | 999 | ||
1000 | if(needStore) | ||
1001 | StoreRegionSettings(rs); | ||
1002 | |||
997 | LoadSpawnPoints(rs); | 1003 | LoadSpawnPoints(rs); |
998 | 1004 | ||
999 | return rs; | 1005 | return rs; |
@@ -1007,31 +1013,32 @@ namespace OpenSim.Data.MySQL | |||
1007 | 1013 | ||
1008 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1014 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1009 | { | 1015 | { |
1010 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 1016 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, " |
1011 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 1017 | + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, " |
1012 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; | 1018 | + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, " |
1013 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; | 1019 | + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, " |
1014 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; | 1020 | + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, " |
1015 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; | 1021 | + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, " |
1016 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; | 1022 | + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, " |
1017 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; | 1023 | + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, " |
1018 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; | 1024 | + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, " |
1019 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; | 1025 | + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, " |
1020 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; | 1026 | + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, " |
1021 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; | 1027 | + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, " |
1022 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; | 1028 | + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, " |
1023 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; | 1029 | + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, " |
1024 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; | 1030 | + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, " |
1025 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; | 1031 | + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, " |
1026 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; | 1032 | + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, " |
1027 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; | 1033 | + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, " |
1028 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; | 1034 | + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, " |
1029 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; | 1035 | + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, " |
1030 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; | 1036 | + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, " |
1031 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 1037 | + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, " |
1032 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; | 1038 | + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, " |
1033 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; | 1039 | + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, " |
1034 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 1040 | + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)" |
1041 | ; | ||
1035 | 1042 | ||
1036 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 1043 | cmd.Parameters.AddWithValue("region_id", wl.regionID); |
1037 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 1044 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); |
@@ -1137,14 +1144,15 @@ namespace OpenSim.Data.MySQL | |||
1137 | IDataReader result = ExecuteReader(cmd); | 1144 | IDataReader result = ExecuteReader(cmd); |
1138 | if (!result.Read()) | 1145 | if (!result.Read()) |
1139 | { | 1146 | { |
1147 | dbcon.Close(); | ||
1140 | return String.Empty; | 1148 | return String.Empty; |
1141 | } | 1149 | } |
1142 | else | 1150 | else |
1143 | { | 1151 | { |
1152 | dbcon.Close(); | ||
1144 | return Convert.ToString(result["llsd_settings"]); | 1153 | return Convert.ToString(result["llsd_settings"]); |
1145 | } | 1154 | } |
1146 | } | 1155 | } |
1147 | dbcon.Close(); | ||
1148 | } | 1156 | } |
1149 | } | 1157 | } |
1150 | 1158 | ||