* This fixes adding and updating user profiles in MySQL on platforms that have a commas as a decimal separator
* Thanks Tommil!
0.6.2-post-fixes
Justin Clarke Casey 2009-01-07 18:46:27 +00:00
parent a9df572c25
commit 8d035b196d
3 changed files with 55 additions and 55 deletions

View File

@ -245,7 +245,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?xmin"] = xmin.ToString();
param["?ymin"] = ymin.ToString();
param["?xmax"] = xmax.ToString();
@ -294,7 +294,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?name"] = namePrefix + "%";
IDbCommand result =
@ -339,7 +339,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?handle"] = handle.ToString();
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
@ -374,7 +374,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
@ -409,7 +409,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
// Add % because this is a like query.
param["?regionName"] = regionName + "%";
// Order by statement will return shorter matches first. Only returns one record or no record.
@ -546,7 +546,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?x"] = x.ToString();
param["?y"] = y.ToString();
IDbCommand result =

View File

@ -340,7 +340,7 @@ namespace OpenSim.Data.MySQL
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
/// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
/// <returns>A MySQL DB Command</returns>
public IDbCommand Query(string sql, Dictionary<string, string> parameters)
public IDbCommand Query(string sql, Dictionary<string, object> parameters)
{
try
{
@ -348,7 +348,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters)
foreach (KeyValuePair<string, object> param in parameters)
{
dbcommand.Parameters.AddWithValue(param.Key, param.Value);
}
@ -714,7 +714,7 @@ namespace OpenSim.Data.MySQL
string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["?server"] = serverDaemon;
parameters["?target"] = target;
parameters["?method"] = methodCall;
@ -793,34 +793,34 @@ namespace OpenSim.Data.MySQL
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel, ?customType, ?partner)";
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["?UUID"] = uuid.ToString();
parameters["?username"] = username;
parameters["?lastname"] = lastname;
parameters["?email"] = email;
parameters["?passwordHash"] = passwordHash;
parameters["?passwordSalt"] = passwordSalt;
parameters["?homeRegion"] = homeRegion.ToString();
parameters["?homeRegion"] = homeRegion;
parameters["?homeRegionID"] = homeRegionID.ToString();
parameters["?homeLocationX"] = homeLocX.ToString();
parameters["?homeLocationY"] = homeLocY.ToString();
parameters["?homeLocationZ"] = homeLocZ.ToString();
parameters["?homeLookAtX"] = homeLookAtX.ToString();
parameters["?homeLookAtY"] = homeLookAtY.ToString();
parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
parameters["?created"] = created.ToString();
parameters["?lastLogin"] = lastlogin.ToString();
parameters["?homeLocationX"] = homeLocX;
parameters["?homeLocationY"] = homeLocY;
parameters["?homeLocationZ"] = homeLocZ;
parameters["?homeLookAtX"] = homeLookAtX;
parameters["?homeLookAtY"] = homeLookAtY;
parameters["?homeLookAtZ"] = homeLookAtZ;
parameters["?created"] = created;
parameters["?lastLogin"] = lastlogin;
parameters["?userInventoryURI"] = inventoryURI;
parameters["?userAssetURI"] = assetURI;
parameters["?profileCanDoMask"] = canDoMask.ToString();
parameters["?profileWantDoMask"] = wantDoMask.ToString();
parameters["?profileCanDoMask"] = canDoMask;
parameters["?profileWantDoMask"] = wantDoMask;
parameters["?profileAboutText"] = aboutText;
parameters["?profileFirstText"] = firstText;
parameters["?profileImage"] = profileImage.ToString();
parameters["?profileFirstImage"] = firstImage.ToString();
parameters["?webLoginKey"] = webLoginKey.ToString();
parameters["?userFlags"] = userFlags.ToString();
parameters["?godLevel"] = godLevel.ToString();
parameters["?userFlags"] = userFlags;
parameters["?godLevel"] = godLevel;
parameters["?customType"] = customType == null ? "" : customType;
parameters["?partner"] = partner.ToString();
bool returnval = false;
@ -892,35 +892,35 @@ namespace OpenSim.Data.MySQL
sql += "`customType` = ?customType , `partner` = ?partner , ";
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["?UUID"] = uuid.ToString();
parameters["?username"] = username;
parameters["?lastname"] = lastname;
parameters["?email"] = email;
parameters["?passwordHash"] = passwordHash;
parameters["?passwordSalt"] = passwordSalt;
parameters["?homeRegion"] = homeRegion.ToString();
parameters["?homeRegion"] = homeRegion;
parameters["?homeRegionID"] = homeRegionID.ToString();
parameters["?homeLocationX"] = homeLocX.ToString();
parameters["?homeLocationY"] = homeLocY.ToString();
parameters["?homeLocationZ"] = homeLocZ.ToString();
parameters["?homeLookAtX"] = homeLookAtX.ToString();
parameters["?homeLookAtY"] = homeLookAtY.ToString();
parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
parameters["?created"] = created.ToString();
parameters["?lastLogin"] = lastlogin.ToString();
parameters["?homeLocationX"] = homeLocX;
parameters["?homeLocationY"] = homeLocY;
parameters["?homeLocationZ"] = homeLocZ;
parameters["?homeLookAtX"] = homeLookAtX;
parameters["?homeLookAtY"] = homeLookAtY;
parameters["?homeLookAtZ"] = homeLookAtZ;
parameters["?created"] = created;
parameters["?lastLogin"] = lastlogin;
parameters["?userInventoryURI"] = inventoryURI;
parameters["?userAssetURI"] = assetURI;
parameters["?profileCanDoMask"] = canDoMask.ToString();
parameters["?profileWantDoMask"] = wantDoMask.ToString();
parameters["?profileCanDoMask"] = canDoMask;
parameters["?profileWantDoMask"] = wantDoMask;
parameters["?profileAboutText"] = aboutText;
parameters["?profileFirstText"] = firstText;
parameters["?profileImage"] = profileImage.ToString();
parameters["?profileFirstImage"] = firstImage.ToString();
parameters["?webLoginKey"] = webLoginKey.ToString();
parameters["?userFlags"] = userFlags.ToString();
parameters["?godLevel"] = godLevel.ToString();
parameters["?customType"] = customType == null ? "" : customType.ToString();
parameters["?userFlags"] = userFlags;
parameters["?godLevel"] = godLevel;
parameters["?customType"] = customType == null ? "" : customType;
parameters["?partner"] = partner.ToString();
bool returnval = false;
@ -993,7 +993,7 @@ namespace OpenSim.Data.MySQL
sql += ";";
}
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["?regionHandle"] = regiondata.regionHandle.ToString();
parameters["?regionName"] = regiondata.regionName.ToString();
@ -1063,7 +1063,7 @@ namespace OpenSim.Data.MySQL
string sql = "DELETE FROM regions WHERE uuid = ?uuid;";
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
try
{
@ -1102,7 +1102,7 @@ namespace OpenSim.Data.MySQL
sql += "REPLACE INTO ";
sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos, currentLookAt) VALUES ";
sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos, ?currentLookAt);";
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters["?UUID"] = agentdata.ProfileID.ToString();
parameters["?sessionID"] = agentdata.SessionID.ToString();
@ -1114,8 +1114,8 @@ namespace OpenSim.Data.MySQL
parameters["?logoutTime"] = agentdata.LogoutTime.ToString();
parameters["?currentRegion"] = agentdata.Region.ToString();
parameters["?currentHandle"] = agentdata.Handle.ToString();
parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString() + "," + (agentdata.Position.Y).ToString() + "," + (agentdata.Position.Z).ToString() + ">";
parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString() + "," + (agentdata.LookAt.Y).ToString() + "," + (agentdata.LookAt.Z).ToString() + ">";
parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString().Replace(",", ".") + "," + (agentdata.Position.Y).ToString().Replace(",", ".") + "," + (agentdata.Position.Z).ToString().Replace(",", ".") + ">";
parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString().Replace(",", ".") + "," + (agentdata.LookAt.Y).ToString().Replace(",", ".") + "," + (agentdata.LookAt.Z).ToString().Replace(",", ".") + ">";
bool returnval = false;

View File

@ -176,7 +176,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = user;
param["?second"] = last;
@ -209,7 +209,7 @@ namespace OpenSim.Data.MySQL
{
int dtvalue = Util.UnixTimeSinceEpoch();
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString();
@ -251,7 +251,7 @@ namespace OpenSim.Data.MySQL
public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
@ -285,7 +285,7 @@ namespace OpenSim.Data.MySQL
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString();
@ -318,7 +318,7 @@ namespace OpenSim.Data.MySQL
{
List<FriendListItem> Lfli = new List<FriendListItem>();
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?ownerID"] = friendlistowner.ToString();
MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
@ -373,7 +373,7 @@ namespace OpenSim.Data.MySQL
{
foreach (UUID uuid in uuids)
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
IDbCommand result =
dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName +
@ -419,7 +419,7 @@ namespace OpenSim.Data.MySQL
querysplit = query.Split(' ');
if (querysplit.Length > 1 && querysplit[1].Trim() != String.Empty)
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
@ -461,7 +461,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
IDbCommand result =
@ -506,7 +506,7 @@ namespace OpenSim.Data.MySQL
MySQLSuperManager dbm = GetLockedConnection("GetUserByUUID");
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param);
@ -596,7 +596,7 @@ namespace OpenSim.Data.MySQL
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = uuid.ToString();
IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid",
@ -744,7 +744,7 @@ namespace OpenSim.Data.MySQL
MySQLSuperManager dbm = GetLockedConnection("GetUserAppearance");
try
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?owner"] = user.ToString();
IDbCommand result = dbm.Manager.Query(
@ -825,7 +825,7 @@ namespace OpenSim.Data.MySQL
public Hashtable GetUserAttachments(UUID agentID)
{
Dictionary<string, string> param = new Dictionary<string, string>();
Dictionary<string, object> param = new Dictionary<string, object>();
param["?uuid"] = agentID.ToString();
MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");