From f49daf97086902ca1ac1221daf6522832b4f74c4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 23 Dec 2008 18:56:56 +0000 Subject: [PATCH] * Modify SQLite implementation of UpdateUserProfile() to allow modifications where the name has not been changed --- OpenSim/Data/SQLite/SQLiteUserData.cs | 37 +++++++++++++++------------ 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index ebc58c14f9..d37c75d209 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -483,10 +483,8 @@ namespace OpenSim.Data.SQLite user.WebLoginKey = WebLoginKey; fillUserRow(row, user); da.Update(ds, "users"); - } } - } private bool ExistsFirstLastName(String fname, String lname) @@ -539,15 +537,16 @@ namespace OpenSim.Data.SQLite row = users.NewRow(); fillUserRow(row, user); 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 { - 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 /// True on success, false on error override public bool UpdateUserProfile(UserProfileData user) { - try + DataTable users = ds.Tables["users"]; + lock (ds) { - AddNewUserProfile(user); - return true; - } - catch (Exception) - { - return false; + DataRow row = users.Rows.Find(Util.ToRawUuidString(user.ID)); + if (row == null) + { + return false; + } + else + { + fillUserRow(row, user); + da.Update(ds, "users"); + } } + + //AddNewUserProfile(user); + return true; } /// @@ -598,7 +605,6 @@ namespace OpenSim.Data.SQLite // save changes off to disk dua.Update(ds, "useragents"); } - } /// @@ -859,7 +865,6 @@ namespace OpenSim.Data.SQLite row["passwordHash"] = user.PasswordHash; row["passwordSalt"] = user.PasswordSalt; - row["homeRegionX"] = user.HomeRegionX; row["homeRegionY"] = user.HomeRegionY; row["homeRegionID"] = user.HomeRegionID;