Ensure that UserProfileData doesn't pass down null values.

These cause some issues with the ADO.NET mapping
afrisby
Sean Dague 2007-08-28 13:02:51 +00:00
parent 6dd6ef3fa2
commit c1a899b651
2 changed files with 32 additions and 22 deletions

View File

@ -363,12 +363,12 @@ namespace OpenSim.Framework.Data.SQLite
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
UserProfileData user = new UserProfileData(); UserProfileData user = new UserProfileData();
user.UUID = new LLUUID((String)row["UUID"]); user.UUID = new LLUUID((String)row["UUID"]);
user.username = (string)row["username"]; user.username = (String)row["username"];
user.surname = (string)row["surname"]; user.surname = (String)row["surname"];
user.passwordHash = (string)row["passwordHash"]; user.passwordHash = (String)row["passwordHash"];
user.passwordSalt = (string)row["passwordSalt"]; user.passwordSalt = (String)row["passwordSalt"];
user.homeRegion = Convert.ToUInt64(row["homeRegion"]); // user.homeRegion = Convert.ToUInt64(row["homeRegion"]);
user.homeLocation = new LLVector3( user.homeLocation = new LLVector3(
Convert.ToSingle(row["homeLocationX"]), Convert.ToSingle(row["homeLocationX"]),
Convert.ToSingle(row["homeLocationY"]), Convert.ToSingle(row["homeLocationY"]),
@ -381,15 +381,15 @@ namespace OpenSim.Framework.Data.SQLite
); );
user.created = Convert.ToInt32(row["created"]); user.created = Convert.ToInt32(row["created"]);
user.lastLogin = Convert.ToInt32(row["lastLogin"]); user.lastLogin = Convert.ToInt32(row["lastLogin"]);
user.rootInventoryFolderID = new LLUUID((string)row["rootInventoryFolderID"]); user.rootInventoryFolderID = new LLUUID((String)row["rootInventoryFolderID"]);
user.userInventoryURI = (string)row["userInventoryURI"]; user.userInventoryURI = (String)row["userInventoryURI"];
user.userAssetURI = (string)row["userAssetURI"]; user.userAssetURI = (String)row["userAssetURI"];
user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]);
user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]);
user.profileAboutText = (string)row["profileAboutText"]; user.profileAboutText = (String)row["profileAboutText"];
user.profileFirstText = (string)row["profileFirstText"]; user.profileFirstText = (String)row["profileFirstText"];
user.profileImage = new LLUUID((string)row["profileImage"]); user.profileImage = new LLUUID((String)row["profileImage"]);
user.profileFirstImage = new LLUUID((string)row["profileFirstImage"]); user.profileFirstImage = new LLUUID((String)row["profileFirstImage"]);
return user; return user;
} }
@ -421,22 +421,29 @@ namespace OpenSim.Framework.Data.SQLite
row["profileFirstText"] = user.profileFirstText; row["profileFirstText"] = user.profileFirstText;
row["profileImage"] = user.profileImage; row["profileImage"] = user.profileImage;
row["profileFirstImage"] = user.profileFirstImage; row["profileFirstImage"] = user.profileFirstImage;
// ADO.NET doesn't handle NULL very well
foreach (DataColumn col in ds.Tables["users"].Columns) {
if (row[col] == null) {
row[col] = "";
}
}
} }
private UserAgentData buildUserAgent(DataRow row) private UserAgentData buildUserAgent(DataRow row)
{ {
UserAgentData ua = new UserAgentData(); UserAgentData ua = new UserAgentData();
ua.UUID = new LLUUID((string)row["UUID"]); ua.UUID = new LLUUID((String)row["UUID"]);
ua.agentIP = (string)row["agentIP"]; ua.agentIP = (String)row["agentIP"];
ua.agentPort = Convert.ToUInt32(row["agentPort"]); ua.agentPort = Convert.ToUInt32(row["agentPort"]);
ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); ua.agentOnline = Convert.ToBoolean(row["agentOnline"]);
ua.sessionID = new LLUUID((string)row["sessionID"]); ua.sessionID = new LLUUID((String)row["sessionID"]);
ua.secureSessionID = new LLUUID((string)row["secureSessionID"]); ua.secureSessionID = new LLUUID((String)row["secureSessionID"]);
ua.regionID = new LLUUID((string)row["regionID"]); ua.regionID = new LLUUID((String)row["regionID"]);
ua.loginTime = Convert.ToInt32(row["loginTime"]); ua.loginTime = Convert.ToInt32(row["loginTime"]);
ua.logoutTime = Convert.ToInt32(row["logoutTime"]); ua.logoutTime = Convert.ToInt32(row["logoutTime"]);
ua.currentRegion = new LLUUID((string)row["currentRegion"]); ua.currentRegion = new LLUUID((String)row["currentRegion"]);
ua.currentHandle = Convert.ToUInt32(row["currentHandle"]); ua.currentHandle = Convert.ToUInt32(row["currentHandle"]);
ua.currentPos = new LLVector3( ua.currentPos = new LLVector3(
Convert.ToSingle(row["currentPosX"]), Convert.ToSingle(row["currentPosX"]),

View File

@ -63,6 +63,9 @@ namespace OpenSim.Framework.Data
/// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
/// </summary> /// </summary>
public ulong homeRegion; public ulong homeRegion;
public uint homeRegionX;
public uint homeRegionY;
/// <summary> /// <summary>
/// The coordinates inside the region of the home location /// The coordinates inside the region of the home location
/// </summary> /// </summary>
@ -86,11 +89,11 @@ namespace OpenSim.Framework.Data
/// <summary> /// <summary>
/// A URI to the users inventory server, used for foreigners and large grids /// A URI to the users inventory server, used for foreigners and large grids
/// </summary> /// </summary>
public string userInventoryURI; public string userInventoryURI = String.Empty;
/// <summary> /// <summary>
/// A URI to the users asset server, used for foreigners and large grids. /// A URI to the users asset server, used for foreigners and large grids.
/// </summary> /// </summary>
public string userAssetURI; public string userAssetURI = String.Empty;
/// <summary> /// <summary>
/// A uint mask containing the "I can do" fields of the users profile /// A uint mask containing the "I can do" fields of the users profile
@ -104,11 +107,11 @@ namespace OpenSim.Framework.Data
/// <summary> /// <summary>
/// The about text listed in a users profile. /// The about text listed in a users profile.
/// </summary> /// </summary>
public string profileAboutText; public string profileAboutText = String.Empty;
/// <summary> /// <summary>
/// The first life about text listed in a users profile /// The first life about text listed in a users profile
/// </summary> /// </summary>
public string profileFirstText; public string profileFirstText = String.Empty;
/// <summary> /// <summary>
/// The profile image for an avatar stored on the asset server /// The profile image for an avatar stored on the asset server