* Modify SQLite implementation of UpdateUserProfile() to allow modifications where the name has not been changed

0.6.2-post-fixes
Justin Clarke Casey 2008-12-23 18:56:56 +00:00
parent 690d190783
commit f49daf9708
1 changed files with 21 additions and 16 deletions

View File

@ -483,10 +483,8 @@ namespace OpenSim.Data.SQLite
user.WebLoginKey = WebLoginKey; user.WebLoginKey = WebLoginKey;
fillUserRow(row, user); fillUserRow(row, user);
da.Update(ds, "users"); da.Update(ds, "users");
} }
} }
} }
private bool ExistsFirstLastName(String fname, String lname) private bool ExistsFirstLastName(String fname, String lname)
@ -539,15 +537,16 @@ namespace OpenSim.Data.SQLite
row = users.NewRow(); row = users.NewRow();
fillUserRow(row, user); fillUserRow(row, user);
users.Rows.Add(row); users.Rows.Add(row);
m_log.Debug("[USER DB]: Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored");
// save changes off to disk
da.Update(ds, "users");
} }
else else
{ {
fillUserRow(row, user); m_log.Warn("[USER DB]: Ignoring add since user with id {0} already exists", user.ID);
} }
m_log.Info("[USER DB]: Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored");
// save changes off to disk
da.Update(ds, "users");
} }
} }
@ -558,15 +557,23 @@ namespace OpenSim.Data.SQLite
/// <returns>True on success, false on error</returns> /// <returns>True on success, false on error</returns>
override public bool UpdateUserProfile(UserProfileData user) override public bool UpdateUserProfile(UserProfileData user)
{ {
try DataTable users = ds.Tables["users"];
lock (ds)
{ {
AddNewUserProfile(user); DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID));
return true; if (row == null)
}
catch (Exception)
{ {
return false; return false;
} }
else
{
fillUserRow(row, user);
da.Update(ds, "users");
}
}
//AddNewUserProfile(user);
return true;
} }
/// <summary> /// <summary>
@ -598,7 +605,6 @@ namespace OpenSim.Data.SQLite
// save changes off to disk // save changes off to disk
dua.Update(ds, "useragents"); dua.Update(ds, "useragents");
} }
} }
/// <summary> /// <summary>
@ -859,7 +865,6 @@ namespace OpenSim.Data.SQLite
row["passwordHash"] = user.PasswordHash; row["passwordHash"] = user.PasswordHash;
row["passwordSalt"] = user.PasswordSalt; row["passwordSalt"] = user.PasswordSalt;
row["homeRegionX"] = user.HomeRegionX; row["homeRegionX"] = user.HomeRegionX;
row["homeRegionY"] = user.HomeRegionY; row["homeRegionY"] = user.HomeRegionY;
row["homeRegionID"] = user.HomeRegionID; row["homeRegionID"] = user.HomeRegionID;