From c176caeb05c2264654b764e4d010561da60c24fc Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 10 Apr 2008 13:53:06 +0000 Subject: moved fields to properties for UserDataProfile, which was actually a little more work than I expected given the copious use of out params. --- OpenSim/Data/DB4o/DB4oManager.cs | 12 ++-- OpenSim/Data/DB4o/DB4oUserData.cs | 8 +-- OpenSim/Data/MSSQL/MSSQLManager.cs | 38 +++++----- OpenSim/Data/MSSQL/MSSQLUserData.cs | 68 +++++++++--------- OpenSim/Data/MySQL/MySQLManager.cs | 63 ++++++++++------- OpenSim/Data/MySQL/MySQLUserData.cs | 28 ++++---- OpenSim/Data/SQLite/SQLiteUserData.cs | 128 ++++++++++++++++++---------------- 7 files changed, 180 insertions(+), 165 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/DB4o/DB4oManager.cs b/OpenSim/Data/DB4o/DB4oManager.cs index d9085c5..13bd61c 100644 --- a/OpenSim/Data/DB4o/DB4oManager.cs +++ b/OpenSim/Data/DB4o/DB4oManager.cs @@ -125,10 +125,10 @@ namespace OpenSim.Data.DB4o IObjectSet result = database.Get(typeof (UserProfileData)); foreach (UserProfileData row in result) { - if (userProfiles.ContainsKey(row.UUID)) - userProfiles[row.UUID] = row; + if (userProfiles.ContainsKey(row.Id)) + userProfiles[row.Id] = row; else - userProfiles.Add(row.UUID, row); + userProfiles.Add(row.Id, row); } database.Close(); } @@ -145,13 +145,13 @@ namespace OpenSim.Data.DB4o /// true on success, false on fail to persist to db public bool UpdateRecord(UserProfileData record) { - if (userProfiles.ContainsKey(record.UUID)) + if (userProfiles.ContainsKey(record.Id)) { - userProfiles[record.UUID] = record; + userProfiles[record.Id] = record; } else { - userProfiles.Add(record.UUID, record); + userProfiles.Add(record.Id, record); } try diff --git a/OpenSim/Data/DB4o/DB4oUserData.cs b/OpenSim/Data/DB4o/DB4oUserData.cs index 62671e3..d0108ab 100644 --- a/OpenSim/Data/DB4o/DB4oUserData.cs +++ b/OpenSim/Data/DB4o/DB4oUserData.cs @@ -85,7 +85,7 @@ namespace OpenSim.Data.DB4o { foreach (UserProfileData profile in manager.userProfiles.Values) { - if (profile.username == fname && profile.surname == lname) + if (profile.FirstName == fname && profile.SurName == lname) return profile; } return null; @@ -100,7 +100,7 @@ namespace OpenSim.Data.DB4o { try { - return GetUserByUUID(uuid).currentAgent; + return GetUserByUUID(uuid).CurrentAgent; } catch (Exception) { @@ -128,7 +128,7 @@ namespace OpenSim.Data.DB4o { try { - return GetUserByName(fname, lname).currentAgent; + return GetUserByName(fname, lname).CurrentAgent; } catch (Exception) { @@ -138,7 +138,7 @@ namespace OpenSim.Data.DB4o public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) { UserProfileData user = GetUserByUUID(AgentID); - user.webLoginKey = WebLoginKey; + user.WebLoginKey = WebLoginKey; UpdateUserProfile(user); } diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 5154092..e33468a 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs @@ -300,38 +300,38 @@ namespace OpenSim.Data.MSSQL if (reader.Read()) { - retval.UUID = new LLUUID((string)reader["UUID"]); - retval.username = (string)reader["username"]; - retval.surname = (string)reader["lastname"]; + retval.Id = new LLUUID((string)reader["UUID"]); + retval.FirstName = (string)reader["username"]; + retval.SurName = (string)reader["lastname"]; - retval.passwordHash = (string)reader["passwordHash"]; - retval.passwordSalt = (string)reader["passwordSalt"]; + retval.PasswordHash = (string)reader["passwordHash"]; + retval.PasswordSalt = (string)reader["passwordSalt"]; - retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); - retval.homeLocation = new LLVector3( + retval.HomeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); + retval.HomeLocation = new LLVector3( Convert.ToSingle(reader["homeLocationX"].ToString()), Convert.ToSingle(reader["homeLocationY"].ToString()), Convert.ToSingle(reader["homeLocationZ"].ToString())); - retval.homeLookAt = new LLVector3( + retval.HomeLookAt = new LLVector3( Convert.ToSingle(reader["homeLookAtX"].ToString()), Convert.ToSingle(reader["homeLookAtY"].ToString()), Convert.ToSingle(reader["homeLookAtZ"].ToString())); - retval.created = Convert.ToInt32(reader["created"].ToString()); - retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); + retval.Created = Convert.ToInt32(reader["created"].ToString()); + retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); - retval.userInventoryURI = (string)reader["userInventoryURI"]; - retval.userAssetURI = (string)reader["userAssetURI"]; + retval.UserInventoryURI = (string)reader["userInventoryURI"]; + retval.UserAssetURI = (string)reader["userAssetURI"]; - retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); - retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); + retval.ProfileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); + retval.ProfileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); - retval.profileAboutText = (string)reader["profileAboutText"]; - retval.profileFirstText = (string)reader["profileFirstText"]; + retval.ProfileAboutText = (string)reader["profileAboutText"]; + retval.ProfileFirstText = (string)reader["profileFirstText"]; - retval.profileImage = new LLUUID((string)reader["profileImage"]); - retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); - retval.webLoginKey = new LLUUID((string)reader["webLoginKey"]); + retval.ProfileImage = new LLUUID((string)reader["profileImage"]); + retval.ProfileFirstImage = new LLUUID((string)reader["profileFirstImage"]); + retval.WebLoginKey = new LLUUID((string)reader["webLoginKey"]); } else { diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index c045084..aae0095 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -453,7 +453,7 @@ namespace OpenSim.Data.MSSQL override public UserAgentData GetAgentByName(string user, string last) { UserProfileData profile = GetUserByName(user, last); - return GetAgentByUUID(profile.UUID); + return GetAgentByUUID(profile.Id); } /// @@ -491,7 +491,7 @@ namespace OpenSim.Data.MSSQL override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) { UserProfileData user = GetUserByUUID(AgentID); - user.webLoginKey = WebLoginKey; + user.WebLoginKey = WebLoginKey; UpdateUserProfile(user); } @@ -505,14 +505,14 @@ namespace OpenSim.Data.MSSQL { lock (database) { - InsertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, - user.homeRegion, user.homeLocation.X, user.homeLocation.Y, - user.homeLocation.Z, - user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, - user.lastLogin, user.userInventoryURI, user.userAssetURI, - user.profileCanDoMask, user.profileWantDoMask, - user.profileAboutText, user.profileFirstText, user.profileImage, - user.profileFirstImage, user.webLoginKey); + InsertUserRow(user.Id, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, + user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, + user.HomeLocation.Z, + user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, + user.LastLogin, user.UserInventoryURI, user.UserAssetURI, + user.ProfileCanDoMask, user.ProfileWantDoMask, + user.ProfileAboutText, user.ProfileFirstText, user.ProfileImage, + user.ProfileFirstImage, user.WebLoginKey); } } catch (Exception e) @@ -651,30 +651,30 @@ namespace OpenSim.Data.MSSQL "profileFirstImage = @profileFirstImage, " + "webLoginKey = @webLoginKey where " + "UUID = @keyUUUID;", database.getConnection()); - SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString()); - SqlParameter param2 = new SqlParameter("@username", user.username); - SqlParameter param3 = new SqlParameter("@lastname", user.surname); - SqlParameter param4 = new SqlParameter("@passwordHash", user.passwordHash); - SqlParameter param5 = new SqlParameter("@passwordSalt", user.passwordSalt); - SqlParameter param6 = new SqlParameter("@homeRegion", Convert.ToInt64(user.homeRegion)); - SqlParameter param7 = new SqlParameter("@homeLocationX", user.homeLocation.X); - SqlParameter param8 = new SqlParameter("@homeLocationY", user.homeLocation.Y); - SqlParameter param9 = new SqlParameter("@homeLocationZ", user.homeLocation.Y); - SqlParameter param10 = new SqlParameter("@homeLookAtX", user.homeLookAt.X); - SqlParameter param11 = new SqlParameter("@homeLookAtY", user.homeLookAt.Y); - SqlParameter param12 = new SqlParameter("@homeLookAtZ", user.homeLookAt.Z); - SqlParameter param13 = new SqlParameter("@created", Convert.ToInt32(user.created)); - SqlParameter param14 = new SqlParameter("@lastLogin", Convert.ToInt32(user.lastLogin)); - SqlParameter param15 = new SqlParameter("@userInventoryURI", user.userInventoryURI); - SqlParameter param16 = new SqlParameter("@userAssetURI", user.userAssetURI); - SqlParameter param17 = new SqlParameter("@profileCanDoMask", Convert.ToInt32(user.profileCanDoMask)); - SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask)); - SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText); - SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText); - SqlParameter param21 = new SqlParameter("@profileImage", user.profileImage.ToString()); - SqlParameter param22 = new SqlParameter("@profileFirstImage", user.profileFirstImage.ToString()); - SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString()); - SqlParameter param24 = new SqlParameter("@webLoginKey", user.webLoginKey.UUID.ToString()); + SqlParameter param1 = new SqlParameter("@uuid", user.Id.ToString()); + SqlParameter param2 = new SqlParameter("@username", user.FirstName); + SqlParameter param3 = new SqlParameter("@lastname", user.SurName); + SqlParameter param4 = new SqlParameter("@passwordHash", user.PasswordHash); + SqlParameter param5 = new SqlParameter("@passwordSalt", user.PasswordSalt); + SqlParameter param6 = new SqlParameter("@homeRegion", Convert.ToInt64(user.HomeRegion)); + SqlParameter param7 = new SqlParameter("@homeLocationX", user.HomeLocation.X); + SqlParameter param8 = new SqlParameter("@homeLocationY", user.HomeLocation.Y); + SqlParameter param9 = new SqlParameter("@homeLocationZ", user.HomeLocation.Y); + SqlParameter param10 = new SqlParameter("@homeLookAtX", user.HomeLookAt.X); + SqlParameter param11 = new SqlParameter("@homeLookAtY", user.HomeLookAt.Y); + SqlParameter param12 = new SqlParameter("@homeLookAtZ", user.HomeLookAt.Z); + SqlParameter param13 = new SqlParameter("@created", Convert.ToInt32(user.Created)); + SqlParameter param14 = new SqlParameter("@lastLogin", Convert.ToInt32(user.LastLogin)); + SqlParameter param15 = new SqlParameter("@userInventoryURI", user.UserInventoryURI); + SqlParameter param16 = new SqlParameter("@userAssetURI", user.UserAssetURI); + SqlParameter param17 = new SqlParameter("@profileCanDoMask", Convert.ToInt32(user.ProfileCanDoMask)); + SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.ProfileWantDoMask)); + SqlParameter param19 = new SqlParameter("@profileAboutText", user.ProfileAboutText); + SqlParameter param20 = new SqlParameter("@profileFirstText", user.ProfileFirstText); + SqlParameter param21 = new SqlParameter("@profileImage", user.ProfileImage.ToString()); + SqlParameter param22 = new SqlParameter("@profileFirstImage", user.ProfileFirstImage.ToString()); + SqlParameter param23 = new SqlParameter("@keyUUUID", user.Id.ToString()); + SqlParameter param24 = new SqlParameter("@webLoginKey", user.WebLoginKey.UUID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); command.Parameters.Add(param3); diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index 0d36136..110f192 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs @@ -427,60 +427,71 @@ namespace OpenSim.Data.MySQL if (reader.Read()) { - if (!LLUUID.TryParse((string)reader["UUID"], out retval.UUID)) + LLUUID id; + if (!LLUUID.TryParse((string)reader["UUID"], out id)) return null; - retval.username = (string) reader["username"]; - retval.surname = (string) reader["lastname"]; - retval.passwordHash = (string) reader["passwordHash"]; - retval.passwordSalt = (string) reader["passwordSalt"]; + retval.Id = id; + retval.FirstName = (string) reader["username"]; + retval.SurName = (string) reader["lastname"]; + + retval.PasswordHash = (string) reader["passwordHash"]; + retval.PasswordSalt = (string) reader["passwordSalt"]; - retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); - retval.homeLocation = new LLVector3( + retval.HomeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); + retval.HomeLocation = new LLVector3( Convert.ToSingle(reader["homeLocationX"].ToString()), Convert.ToSingle(reader["homeLocationY"].ToString()), Convert.ToSingle(reader["homeLocationZ"].ToString())); - retval.homeLookAt = new LLVector3( + retval.HomeLookAt = new LLVector3( Convert.ToSingle(reader["homeLookAtX"].ToString()), Convert.ToSingle(reader["homeLookAtY"].ToString()), Convert.ToSingle(reader["homeLookAtZ"].ToString())); - retval.created = Convert.ToInt32(reader["created"].ToString()); - retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); + retval.Created = Convert.ToInt32(reader["created"].ToString()); + retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); - retval.userInventoryURI = (string) reader["userInventoryURI"]; - retval.userAssetURI = (string) reader["userAssetURI"]; + retval.UserInventoryURI = (string) reader["userInventoryURI"]; + retval.UserAssetURI = (string) reader["userAssetURI"]; - retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); - retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); + retval.ProfileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); + retval.ProfileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); if (reader.IsDBNull(reader.GetOrdinal("profileAboutText"))) - retval.profileAboutText = ""; + retval.ProfileAboutText = ""; else - retval.profileAboutText = (string) reader["profileAboutText"]; + retval.ProfileAboutText = (string) reader["profileAboutText"]; if (reader.IsDBNull(reader.GetOrdinal("profileFirstText"))) - retval.profileFirstText = ""; + retval.ProfileFirstText = ""; else - retval.profileFirstText = (string)reader["profileFirstText"]; + retval.ProfileFirstText = (string)reader["profileFirstText"]; if (reader.IsDBNull(reader.GetOrdinal("profileImage"))) - retval.profileImage = LLUUID.Zero; - else - LLUUID.TryParse((string)reader["profileImage"], out retval.profileImage); + retval.ProfileImage = LLUUID.Zero; + else { + LLUUID tmp; + LLUUID.TryParse((string)reader["profileImage"], out tmp); + retval.ProfileImage = tmp; + } if (reader.IsDBNull(reader.GetOrdinal("profileFirstImage"))) - retval.profileFirstImage = LLUUID.Zero; - else - LLUUID.TryParse((string)reader["profileFirstImage"], out retval.profileFirstImage); + retval.ProfileFirstImage = LLUUID.Zero; + else { + LLUUID tmp; + LLUUID.TryParse((string)reader["profileFirstImage"], out tmp); + retval.ProfileFirstImage = tmp; + } if(reader.IsDBNull(reader.GetOrdinal("webLoginKey"))) { - retval.webLoginKey = LLUUID.Zero; + retval.WebLoginKey = LLUUID.Zero; } else { - LLUUID.TryParse((string)reader["webLoginKey"], out retval.webLoginKey); + LLUUID tmp; + LLUUID.TryParse((string)reader["webLoginKey"], out tmp); + retval.WebLoginKey = tmp; } } else diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index bd094f6..5654207 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -475,7 +475,7 @@ namespace OpenSim.Data.MySQL override public UserAgentData GetAgentByName(string user, string last) { UserProfileData profile = GetUserByName(user, last); - return GetAgentByUUID(profile.UUID); + return GetAgentByUUID(profile.Id); } override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) @@ -547,14 +547,14 @@ namespace OpenSim.Data.MySQL { lock (database) { - database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, - user.homeRegion, user.homeLocation.X, user.homeLocation.Y, - user.homeLocation.Z, - user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, - user.lastLogin, user.userInventoryURI, user.userAssetURI, - user.profileCanDoMask, user.profileWantDoMask, - user.profileAboutText, user.profileFirstText, user.profileImage, - user.profileFirstImage, user.webLoginKey); + database.insertUserRow(user.Id, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, + user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, + user.HomeLocation.Z, + user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, + user.LastLogin, user.UserInventoryURI, user.UserAssetURI, + user.ProfileCanDoMask, user.ProfileWantDoMask, + user.ProfileAboutText, user.ProfileFirstText, user.ProfileImage, + user.ProfileFirstImage, user.WebLoginKey); } } catch (Exception e) @@ -590,11 +590,11 @@ namespace OpenSim.Data.MySQL /// The profile data to use to update the DB override public bool UpdateUserProfile(UserProfileData user) { - database.updateUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, - user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, user.homeLookAt.X, - user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, - user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, user.profileAboutText, - user.profileFirstText, user.profileImage, user.profileFirstImage, user.webLoginKey); + database.updateUserRow(user.Id, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, + user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X, + user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI, + user.UserAssetURI, user.ProfileCanDoMask, user.ProfileWantDoMask, user.ProfileAboutText, + user.ProfileFirstText, user.ProfileImage, user.ProfileFirstImage, user.WebLoginKey); return true; } diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index ad3d1a4..e395565 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -114,7 +114,7 @@ namespace OpenSim.Data.SQLite row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(uuid)); if (row != null) { - user.currentAgent = buildUserAgent(row); + user.CurrentAgent = buildUserAgent(row); } return user; } @@ -135,10 +135,10 @@ namespace OpenSim.Data.SQLite if (rows.Length > 0) { UserProfileData user = buildUserProfile(rows[0]); - DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(user.UUID)); + DataRow row = ds.Tables["useragents"].Rows.Find(Util.ToRawUuidString(user.Id)); if (row != null) { - user.currentAgent = buildUserAgent(row); + user.CurrentAgent = buildUserAgent(row); } return user; } @@ -297,7 +297,7 @@ namespace OpenSim.Data.SQLite { try { - return GetUserByUUID(uuid).currentAgent; + return GetUserByUUID(uuid).CurrentAgent; } catch (Exception) { @@ -325,7 +325,7 @@ namespace OpenSim.Data.SQLite { try { - return GetUserByName(fname, lname).currentAgent; + return GetUserByName(fname, lname).CurrentAgent; } catch (Exception) { @@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite else { UserProfileData user = GetUserByUUID(AgentID); - user.webLoginKey = WebLoginKey; + user.WebLoginKey = WebLoginKey; fillUserRow(row, user); da.Update(ds, "users"); @@ -365,7 +365,7 @@ namespace OpenSim.Data.SQLite DataTable users = ds.Tables["users"]; lock (ds) { - DataRow row = users.Rows.Find(Util.ToRawUuidString(user.UUID)); + DataRow row = users.Rows.Find(Util.ToRawUuidString(user.Id)); if (row == null) { row = users.NewRow(); @@ -381,19 +381,19 @@ namespace OpenSim.Data.SQLite // useragents table once the useragent is null // // A database guy should look at this and figure out the best way to clear the useragents table. - if (user.currentAgent != null) + if (user.CurrentAgent != null) { DataTable ua = ds.Tables["useragents"]; - row = ua.Rows.Find(Util.ToRawUuidString(user.UUID)); + row = ua.Rows.Find(Util.ToRawUuidString(user.Id)); if (row == null) { row = ua.NewRow(); - fillUserAgentRow(row, user.currentAgent); + fillUserAgentRow(row, user.CurrentAgent); ua.Rows.Add(row); } else { - fillUserAgentRow(row, user.currentAgent); + fillUserAgentRow(row, user.CurrentAgent); } } else @@ -401,7 +401,7 @@ namespace OpenSim.Data.SQLite // I just added this to help the standalone login situation. //It still needs to be looked at by a Database guy DataTable ua = ds.Tables["useragents"]; - row = ua.Rows.Find(Util.ToRawUuidString(user.UUID)); + row = ua.Rows.Find(Util.ToRawUuidString(user.Id)); if (row == null) { @@ -591,70 +591,74 @@ namespace OpenSim.Data.SQLite // interesting has to be done to actually get these values // back out. Not enough time to figure it out yet. UserProfileData user = new UserProfileData(); - LLUUID.TryParse((String)row["UUID"], out user.UUID); - user.username = (String) row["username"]; - user.surname = (String) row["surname"]; - user.passwordHash = (String) row["passwordHash"]; - user.passwordSalt = (String) row["passwordSalt"]; - - user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); - user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); - user.homeLocation = new LLVector3( + LLUUID tmp; + LLUUID.TryParse((String)row["UUID"], out tmp); + user.Id = tmp; + user.FirstName = (String) row["username"]; + user.SurName = (String) row["surname"]; + user.PasswordHash = (String) row["passwordHash"]; + user.PasswordSalt = (String) row["passwordSalt"]; + + user.HomeRegionX = Convert.ToUInt32(row["homeRegionX"]); + user.HomeRegionY = Convert.ToUInt32(row["homeRegionY"]); + user.HomeLocation = new LLVector3( Convert.ToSingle(row["homeLocationX"]), Convert.ToSingle(row["homeLocationY"]), Convert.ToSingle(row["homeLocationZ"]) ); - user.homeLookAt = new LLVector3( + user.HomeLookAt = new LLVector3( Convert.ToSingle(row["homeLookAtX"]), Convert.ToSingle(row["homeLookAtY"]), Convert.ToSingle(row["homeLookAtZ"]) ); - user.created = Convert.ToInt32(row["created"]); - user.lastLogin = Convert.ToInt32(row["lastLogin"]); - user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); - user.userInventoryURI = (String) row["userInventoryURI"]; - user.userAssetURI = (String) row["userAssetURI"]; - user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); - user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); - user.profileAboutText = (String) row["profileAboutText"]; - user.profileFirstText = (String) row["profileFirstText"]; - LLUUID.TryParse((String)row["profileImage"], out user.profileImage); - LLUUID.TryParse((String)row["profileFirstImage"], out user.profileFirstImage); - user.webLoginKey = new LLUUID((String) row["webLoginKey"]); + user.Created = Convert.ToInt32(row["created"]); + user.LastLogin = Convert.ToInt32(row["lastLogin"]); + user.RootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); + user.UserInventoryURI = (String) row["userInventoryURI"]; + user.UserAssetURI = (String) row["userAssetURI"]; + user.ProfileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); + user.ProfileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); + user.ProfileAboutText = (String) row["profileAboutText"]; + user.ProfileFirstText = (String) row["profileFirstText"]; + LLUUID.TryParse((String)row["profileImage"], out tmp); + user.ProfileImage = tmp; + LLUUID.TryParse((String)row["profileFirstImage"], out tmp); + user.ProfileFirstImage = tmp; + user.WebLoginKey = new LLUUID((String) row["webLoginKey"]); return user; } private void fillUserRow(DataRow row, UserProfileData user) { - row["UUID"] = Util.ToRawUuidString(user.UUID); - row["username"] = user.username; - row["surname"] = user.surname; - row["passwordHash"] = user.passwordHash; - row["passwordSalt"] = user.passwordSalt; - - - row["homeRegionX"] = user.homeRegionX; - row["homeRegionY"] = user.homeRegionY; - row["homeLocationX"] = user.homeLocation.X; - row["homeLocationY"] = user.homeLocation.Y; - row["homeLocationZ"] = user.homeLocation.Z; - row["homeLookAtX"] = user.homeLookAt.X; - row["homeLookAtY"] = user.homeLookAt.Y; - row["homeLookAtZ"] = user.homeLookAt.Z; - - row["created"] = user.created; - row["lastLogin"] = user.lastLogin; - row["rootInventoryFolderID"] = user.rootInventoryFolderID; - row["userInventoryURI"] = user.userInventoryURI; - row["userAssetURI"] = user.userAssetURI; - row["profileCanDoMask"] = user.profileCanDoMask; - row["profileWantDoMask"] = user.profileWantDoMask; - row["profileAboutText"] = user.profileAboutText; - row["profileFirstText"] = user.profileFirstText; - row["profileImage"] = user.profileImage; - row["profileFirstImage"] = user.profileFirstImage; - row["webLoginKey"] = user.webLoginKey; + row["UUID"] = Util.ToRawUuidString(user.Id); + row["username"] = user.FirstName; + row["surname"] = user.SurName; + row["passwordHash"] = user.PasswordHash; + row["passwordSalt"] = user.PasswordSalt; + + + row["homeRegionX"] = user.HomeRegionX; + row["homeRegionY"] = user.HomeRegionY; + row["homeLocationX"] = user.HomeLocation.X; + row["homeLocationY"] = user.HomeLocation.Y; + row["homeLocationZ"] = user.HomeLocation.Z; + row["homeLookAtX"] = user.HomeLookAt.X; + row["homeLookAtY"] = user.HomeLookAt.Y; + row["homeLookAtZ"] = user.HomeLookAt.Z; + + row["created"] = user.Created; + row["lastLogin"] = user.LastLogin; + row["rootInventoryFolderID"] = user.RootInventoryFolderID; + row["userInventoryURI"] = user.UserInventoryURI; + row["userAssetURI"] = user.UserAssetURI; + row["profileCanDoMask"] = user.ProfileCanDoMask; + row["profileWantDoMask"] = user.ProfileWantDoMask; + row["profileAboutText"] = user.ProfileAboutText; + row["profileFirstText"] = user.ProfileFirstText; + row["profileImage"] = user.ProfileImage; + row["profileFirstImage"] = user.ProfileFirstImage; + row["webLoginKey"] = user.WebLoginKey; // ADO.NET doesn't handle NULL very well foreach (DataColumn col in ds.Tables["users"].Columns) -- cgit v1.1