mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
seems to compile ( tests comented out)
This commit is contained in:
@@ -202,52 +202,15 @@ namespace OpenSim.Data.MySQL
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.WarnFormat(
|
||||
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
|
||||
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ",
|
||||
asset.FullID, asset.Name)
|
||||
, e);
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ namespace OpenSim.Data.MySQL
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
@@ -1122,53 +1122,14 @@ namespace OpenSim.Data.MySQL
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, " +
|
||||
"?TerrainImageID, ?block_search, ?casino, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "replace into regionsettings (regionUUID, " +
|
||||
"block_terraform, block_fly, allow_damage, " +
|
||||
"restrict_pushing, allow_land_resell, " +
|
||||
"allow_land_join_divide, block_show_in_search, " +
|
||||
"agent_limit, object_bonus, maturity, " +
|
||||
"disable_scripts, disable_collisions, " +
|
||||
"disable_physics, terrain_texture_1, " +
|
||||
"terrain_texture_2, terrain_texture_3, " +
|
||||
"terrain_texture_4, elevation_1_nw, " +
|
||||
"elevation_2_nw, elevation_1_ne, " +
|
||||
"elevation_2_ne, elevation_1_se, " +
|
||||
"elevation_2_se, elevation_1_sw, " +
|
||||
"elevation_2_sw, water_height, " +
|
||||
"terrain_raise_limit, terrain_lower_limit, " +
|
||||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id, map_tile_ID, block_search, casino, " +
|
||||
"TelehubObject, parcel_tile_ID) " +
|
||||
"values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||
"?Maturity, ?DisableScripts, ?DisableCollisions, " +
|
||||
"?DisablePhysics, ?TerrainTexture1, " +
|
||||
"?TerrainTexture2, ?TerrainTexture3, " +
|
||||
"?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
|
||||
"?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
|
||||
"?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
|
||||
"?WaterHeight, ?TerrainRaiseLimit, " +
|
||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
|
||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||
"?LoadedCreationDateTime, ?LoadedCreationID, " +
|
||||
"?TerrainImageID, ?block_search, ?casino, " +
|
||||
"?TelehubObject, ?ParcelImageID)";
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
SaveSpawnPoints(rs);
|
||||
SaveSpawnPoints(rs);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual List<LandData> LoadLandObjects(UUID regionUUID)
|
||||
|
||||
@@ -896,16 +896,16 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
|
||||
#region User Preferences
|
||||
public OSDArray GetUserPreferences(UUID avatarId)
|
||||
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
|
||||
{
|
||||
string query = string.Empty;
|
||||
|
||||
|
||||
query += "SELECT imviaemail,visible,email FROM ";
|
||||
query += "usersettings WHERE ";
|
||||
query += "useruuid = ?Id";
|
||||
|
||||
|
||||
OSDArray data = new OSDArray();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
||||
@@ -913,33 +913,30 @@ namespace OpenSim.Data.MySQL
|
||||
dbcon.Open();
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
|
||||
|
||||
cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
reader.Read();
|
||||
OSDMap record = new OSDMap();
|
||||
|
||||
record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"]));
|
||||
record.Add("visible",OSD.FromString((string)reader["visible"]));
|
||||
record.Add("email",OSD.FromString((string)reader["email"]));
|
||||
data.Add(record);
|
||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||
bool.TryParse((string)reader["visible"], out pref.Visible);
|
||||
pref.EMail = (string)reader["email"];
|
||||
}
|
||||
else
|
||||
{
|
||||
dbcon.Close();
|
||||
dbcon.Open();
|
||||
|
||||
|
||||
query = "INSERT INTO usersettings VALUES ";
|
||||
query += "(?uuid,'false','false', ?Email)";
|
||||
|
||||
using (MySqlCommand put = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
|
||||
// put.Parameters.AddWithValue("?Email", pref.EMail);
|
||||
// put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
||||
|
||||
put.Parameters.AddWithValue("?Email", pref.EMail);
|
||||
put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
|
||||
|
||||
put.ExecuteNonQuery();
|
||||
}
|
||||
@@ -952,20 +949,22 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||
": Get preferences exception {0}", e.Message);
|
||||
result = e.Message;
|
||||
return false;
|
||||
}
|
||||
return data;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId )
|
||||
{
|
||||
|
||||
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
|
||||
{
|
||||
string query = string.Empty;
|
||||
|
||||
query += "UPDATE userpsettings SET ";
|
||||
|
||||
query += "UPDATE usersettings SET ";
|
||||
query += "imviaemail=?ImViaEmail, ";
|
||||
query += "visible=?Visible, ";
|
||||
query += "email=?EMail ";
|
||||
query += "WHERE useruuid=?uuid";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
|
||||
@@ -986,6 +985,7 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
m_log.ErrorFormat("[PROFILES_DATA]" +
|
||||
": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException);
|
||||
result = e.Message;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user