Thanks Gavin Hird for a fix for Mantis 0007604: DeleteClassifiedRecord exception PGSQL
parent
2c5a3ff9f0
commit
3aa9e786de
|
@ -37,7 +37,7 @@ using Npgsql;
|
|||
|
||||
namespace OpenSim.Data.PGSQL
|
||||
{
|
||||
public class UserProfilesData: IProfilesData
|
||||
public class UserProfilesData : IProfilesData
|
||||
{
|
||||
static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -46,7 +46,8 @@ namespace OpenSim.Data.PGSQL
|
|||
#region Properites
|
||||
string ConnectionString
|
||||
{
|
||||
get; set;
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
|
@ -97,9 +98,9 @@ namespace OpenSim.Data.PGSQL
|
|||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Id", creatorId));
|
||||
using( NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -149,11 +150,11 @@ namespace OpenSim.Data.PGSQL
|
|||
WHERE NOT EXISTS (
|
||||
SELECT * FROM upsert )";
|
||||
|
||||
if(string.IsNullOrEmpty(ad.ParcelName))
|
||||
if (string.IsNullOrEmpty(ad.ParcelName))
|
||||
ad.ParcelName = "Unknown";
|
||||
if(ad.ParcelId == null)
|
||||
if (ad.ParcelId == null)
|
||||
ad.ParcelId = UUID.Zero;
|
||||
if(string.IsNullOrEmpty(ad.Description))
|
||||
if (string.IsNullOrEmpty(ad.Description))
|
||||
ad.Description = "No Description";
|
||||
|
||||
DateTime epoch = new DateTime(1970, 1, 1);
|
||||
|
@ -163,15 +164,15 @@ namespace OpenSim.Data.PGSQL
|
|||
DateTime expiration;
|
||||
TimeSpan epochexp;
|
||||
|
||||
if(ad.Flags == 2)
|
||||
if (ad.Flags == 2)
|
||||
{
|
||||
duration = new TimeSpan(7,0,0,0);
|
||||
duration = new TimeSpan(7, 0, 0, 0);
|
||||
expiration = now.Add(duration);
|
||||
epochexp = expiration - epoch;
|
||||
}
|
||||
else
|
||||
{
|
||||
duration = new TimeSpan(365,0,0,0);
|
||||
duration = new TimeSpan(365, 0, 0, 0);
|
||||
expiration = now.Add(duration);
|
||||
epochexp = expiration - epoch;
|
||||
}
|
||||
|
@ -219,7 +220,7 @@ namespace OpenSim.Data.PGSQL
|
|||
{
|
||||
string query = string.Empty;
|
||||
|
||||
query = @"DELETE FROM classifieds WHERE classifieduuid = :ClasifiedId ;";
|
||||
query = @"DELETE FROM classifieds WHERE classifieduuid = :ClassifiedId ;";
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -261,7 +262,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if(reader.Read ())
|
||||
if (reader.Read())
|
||||
{
|
||||
ad.CreatorId = DBGuid.FromDB(reader["creatoruuid"]);
|
||||
ad.ParcelId = DBGuid.FromDB(reader["parceluuid"]);
|
||||
|
@ -323,14 +324,14 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
OSDMap record = new OSDMap();
|
||||
|
||||
record.Add("pickuuid",OSD.FromUUID(DBGuid.FromDB(reader["pickuuid"])));
|
||||
record.Add("name",OSD.FromString((string)reader["name"]));
|
||||
record.Add("pickuuid", OSD.FromUUID(DBGuid.FromDB(reader["pickuuid"])));
|
||||
record.Add("name", OSD.FromString((string)reader["name"]));
|
||||
data.Add(record);
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +368,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
|
@ -383,7 +384,7 @@ namespace OpenSim.Data.PGSQL
|
|||
pick.GlobalPos = (string)reader["posglobal"].ToString();
|
||||
pick.TopPick = Convert.ToBoolean(reader["toppick"]);
|
||||
pick.Enabled = Convert.ToBoolean(reader["enabled"]);
|
||||
pick.Name = reader["name"].ToString ();
|
||||
pick.Name = reader["name"].ToString();
|
||||
pick.Desc = reader["description"].ToString();
|
||||
pick.ParcelName = reader["user"].ToString();
|
||||
pick.OriginalName = reader["originalname"].ToString();
|
||||
|
@ -439,7 +440,7 @@ namespace OpenSim.Data.PGSQL
|
|||
cmd.Parameters.Add(m_database.CreateParameter("SnapshotId", pick.SnapshotId));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("User", pick.ParcelName));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Original", pick.OriginalName));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("SimName",pick.SimName));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("SimName", pick.SimName));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("GlobalPos", pick.GlobalPos));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("SortOrder", pick.SortOrder));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Enabled", pick.Enabled));
|
||||
|
@ -512,7 +513,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
reader.Read();
|
||||
notes.Notes = OSD.FromString((string)reader["notes"]);
|
||||
|
@ -561,7 +562,7 @@ namespace OpenSim.Data.PGSQL
|
|||
dbcon.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
||||
{
|
||||
if(!remove)
|
||||
if (!remove)
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Notes", note.Notes));
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("TargetId", note.TargetId));
|
||||
|
@ -602,7 +603,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
// m_log.DebugFormat("[PROFILES_DATA]" +
|
||||
// ": Getting data for {0}.", props.UserId);
|
||||
|
@ -804,13 +805,13 @@ namespace OpenSim.Data.PGSQL
|
|||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format (query,"\"classifieds\""), dbcon))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format(query, "\"classifieds\""), dbcon))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Id", avatarId));
|
||||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -823,13 +824,13 @@ namespace OpenSim.Data.PGSQL
|
|||
dbcon.Close();
|
||||
dbcon.Open();
|
||||
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format (query,"\"userpicks\""), dbcon))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format(query, "\"userpicks\""), dbcon))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Id", avatarId));
|
||||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -844,13 +845,13 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
query = "SELECT \"profileImage\", \"profileFirstImage\" FROM \"userprofile\" WHERE \"useruuid\" = :Id";
|
||||
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format (query,"\"userpicks\""), dbcon))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(string.Format(query, "\"userpicks\""), dbcon))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("Id", avatarId));
|
||||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -893,7 +894,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
reader.Read();
|
||||
bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
|
||||
|
@ -924,7 +925,7 @@ namespace OpenSim.Data.PGSQL
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
|
||||
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
|
||||
{
|
||||
string query = string.Empty;
|
||||
|
||||
|
@ -984,7 +985,7 @@ namespace OpenSim.Data.PGSQL
|
|||
|
||||
using (NpgsqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||
{
|
||||
if(reader.HasRows)
|
||||
if (reader.HasRows)
|
||||
{
|
||||
reader.Read();
|
||||
props.DataKey = (string)reader["DataKey"];
|
||||
|
@ -996,7 +997,7 @@ namespace OpenSim.Data.PGSQL
|
|||
query += ":UserId,";
|
||||
query += ":TagId,";
|
||||
query += ":DataKey,";
|
||||
query += ":DataVal) ";
|
||||
query += ":DataVal) ";
|
||||
|
||||
using (NpgsqlCommand put = new NpgsqlCommand(query, dbcon))
|
||||
{
|
||||
|
@ -1041,9 +1042,9 @@ namespace OpenSim.Data.PGSQL
|
|||
using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("UserId", props.UserId.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("TagId", props.TagId.ToString ()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("DataKey", props.DataKey.ToString ()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("DataVal", props.DataKey.ToString ()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("TagId", props.TagId.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("DataKey", props.DataKey.ToString()));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("DataVal", props.DataKey.ToString()));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue