a few more changes on mysql

httptests
UbitUmarov 2017-05-06 21:43:22 +01:00
parent 4b2ef46de6
commit c57215687f
4 changed files with 61 additions and 49 deletions

View File

@ -77,30 +77,32 @@ namespace OpenSim.Data.MySQL
{ {
cmd.Parameters.AddWithValue("?principalID", principalID.ToString()); cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = cmd.ExecuteReader(); using(IDataReader result = cmd.ExecuteReader())
if (result.Read())
{ {
ret.PrincipalID = principalID; if(result.Read())
CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{ {
if (s == "UUID") ret.PrincipalID = principalID;
continue;
ret.Data[s] = result[s].ToString(); CheckColumnNames(result);
foreach(string s in m_ColumnNames)
{
if(s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
dbcon.Close();
return ret;
}
else
{
dbcon.Close();
return null;
} }
return ret;
}
else
{
return null;
} }
} }
dbcon.Close();
} }
} }

View File

@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "EstateStore"); Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update(); m.Update();
dbcon.Close();
Type t = typeof(EstateSettings); Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic | m_Fields = t.GetFields(BindingFlags.NonPublic |
@ -143,7 +144,6 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
dbcon.Open(); dbcon.Open();
cmd.Connection = dbcon; cmd.Connection = dbcon;
bool found = false; bool found = false;
@ -171,13 +171,14 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
dbcon.Close();
cmd.Connection = null;
if (!found && create) if (!found && create)
{ {
DoCreate(es); DoCreate(es);
LinkRegion(regionID, (int)es.EstateID); LinkRegion(regionID, (int)es.EstateID);
} }
cmd.Connection = null;
dbcon.Close();
} }
LoadBanList(es); LoadBanList(es);

View File

@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
conn.Open(); conn.Open();
Migration m = new Migration(conn, Assembly, "FSAssetStore"); Migration m = new Migration(conn, Assembly, "FSAssetStore");
m.Update(); m.Update();
conn.Close();
} }
} }
catch (MySqlException e) catch (MySqlException e)
@ -126,8 +127,8 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString()); m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
return false; return false;
} }
cmd.Connection = null;
conn.Close(); conn.Close();
cmd.Connection = null;
} }
return true; return true;

View File

@ -262,6 +262,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
} }
dbcon.Close();
} }
} }
} }
@ -301,6 +302,7 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
dbcon.Close();
} }
} }
@ -961,6 +963,7 @@ namespace OpenSim.Data.MySQL
public virtual RegionSettings LoadRegionSettings(UUID regionUUID) public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
{ {
RegionSettings rs = null; RegionSettings rs = null;
bool needStore = false;
lock (m_dbLock) lock (m_dbLock)
{ {
@ -986,7 +989,7 @@ namespace OpenSim.Data.MySQL
rs.RegionUUID = regionUUID; rs.RegionUUID = regionUUID;
rs.OnSave += StoreRegionSettings; rs.OnSave += StoreRegionSettings;
StoreRegionSettings(rs); needStore = true;
} }
} }
} }
@ -994,6 +997,9 @@ namespace OpenSim.Data.MySQL
} }
} }
if(needStore)
StoreRegionSettings(rs);
LoadSpawnPoints(rs); LoadSpawnPoints(rs);
return rs; return rs;
@ -1007,31 +1013,32 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = dbcon.CreateCommand()) using (MySqlCommand cmd = dbcon.CreateCommand())
{ {
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"
;
cmd.Parameters.AddWithValue("region_id", wl.regionID); cmd.Parameters.AddWithValue("region_id", wl.regionID);
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
@ -1137,14 +1144,15 @@ namespace OpenSim.Data.MySQL
IDataReader result = ExecuteReader(cmd); IDataReader result = ExecuteReader(cmd);
if (!result.Read()) if (!result.Read())
{ {
dbcon.Close();
return String.Empty; return String.Empty;
} }
else else
{ {
dbcon.Close();
return Convert.ToString(result["llsd_settings"]); return Convert.ToString(result["llsd_settings"]);
} }
} }
dbcon.Close();
} }
} }