diff options
author | Justin Clarke Casey | 2009-01-07 18:46:27 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-07 18:46:27 +0000 |
commit | 8d035b196df31ddb41e4917a757e83acdbb03d78 (patch) | |
tree | 777605603b47b20075b13fd56317667b29b36185 /OpenSim/Data/MySQL/MySQLManager.cs | |
parent | * refactor: Remove MakeHttpRequest wrapper method from Scene in favour of a d... (diff) | |
download | opensim-SC_OLD-8d035b196df31ddb41e4917a757e83acdbb03d78.zip opensim-SC_OLD-8d035b196df31ddb41e4917a757e83acdbb03d78.tar.gz opensim-SC_OLD-8d035b196df31ddb41e4917a757e83acdbb03d78.tar.bz2 opensim-SC_OLD-8d035b196df31ddb41e4917a757e83acdbb03d78.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=2948
* This fixes adding and updating user profiles in MySQL on platforms that have a commas as a decimal separator
* Thanks Tommil!
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLManager.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLManager.cs | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index a54c020..f16795e 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -340,7 +340,7 @@ namespace OpenSim.Data.MySQL | |||
340 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | 340 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> |
341 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | 341 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> |
342 | /// <returns>A MySQL DB Command</returns> | 342 | /// <returns>A MySQL DB Command</returns> |
343 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | 343 | public IDbCommand Query(string sql, Dictionary<string, object> parameters) |
344 | { | 344 | { |
345 | try | 345 | try |
346 | { | 346 | { |
@@ -348,7 +348,7 @@ namespace OpenSim.Data.MySQL | |||
348 | 348 | ||
349 | MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); | 349 | MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); |
350 | dbcommand.CommandText = sql; | 350 | dbcommand.CommandText = sql; |
351 | foreach (KeyValuePair<string, string> param in parameters) | 351 | foreach (KeyValuePair<string, object> param in parameters) |
352 | { | 352 | { |
353 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 353 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
354 | } | 354 | } |
@@ -714,7 +714,7 @@ namespace OpenSim.Data.MySQL | |||
714 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; | 714 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; |
715 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; | 715 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; |
716 | 716 | ||
717 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 717 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
718 | parameters["?server"] = serverDaemon; | 718 | parameters["?server"] = serverDaemon; |
719 | parameters["?target"] = target; | 719 | parameters["?target"] = target; |
720 | parameters["?method"] = methodCall; | 720 | parameters["?method"] = methodCall; |
@@ -793,34 +793,34 @@ namespace OpenSim.Data.MySQL | |||
793 | "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; | 793 | "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; |
794 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel, ?customType, ?partner)"; | 794 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel, ?customType, ?partner)"; |
795 | 795 | ||
796 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 796 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
797 | parameters["?UUID"] = uuid.ToString(); | 797 | parameters["?UUID"] = uuid.ToString(); |
798 | parameters["?username"] = username; | 798 | parameters["?username"] = username; |
799 | parameters["?lastname"] = lastname; | 799 | parameters["?lastname"] = lastname; |
800 | parameters["?email"] = email; | 800 | parameters["?email"] = email; |
801 | parameters["?passwordHash"] = passwordHash; | 801 | parameters["?passwordHash"] = passwordHash; |
802 | parameters["?passwordSalt"] = passwordSalt; | 802 | parameters["?passwordSalt"] = passwordSalt; |
803 | parameters["?homeRegion"] = homeRegion.ToString(); | 803 | parameters["?homeRegion"] = homeRegion; |
804 | parameters["?homeRegionID"] = homeRegionID.ToString(); | 804 | parameters["?homeRegionID"] = homeRegionID.ToString(); |
805 | parameters["?homeLocationX"] = homeLocX.ToString(); | 805 | parameters["?homeLocationX"] = homeLocX; |
806 | parameters["?homeLocationY"] = homeLocY.ToString(); | 806 | parameters["?homeLocationY"] = homeLocY; |
807 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | 807 | parameters["?homeLocationZ"] = homeLocZ; |
808 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); | 808 | parameters["?homeLookAtX"] = homeLookAtX; |
809 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); | 809 | parameters["?homeLookAtY"] = homeLookAtY; |
810 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | 810 | parameters["?homeLookAtZ"] = homeLookAtZ; |
811 | parameters["?created"] = created.ToString(); | 811 | parameters["?created"] = created; |
812 | parameters["?lastLogin"] = lastlogin.ToString(); | 812 | parameters["?lastLogin"] = lastlogin; |
813 | parameters["?userInventoryURI"] = inventoryURI; | 813 | parameters["?userInventoryURI"] = inventoryURI; |
814 | parameters["?userAssetURI"] = assetURI; | 814 | parameters["?userAssetURI"] = assetURI; |
815 | parameters["?profileCanDoMask"] = canDoMask.ToString(); | 815 | parameters["?profileCanDoMask"] = canDoMask; |
816 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); | 816 | parameters["?profileWantDoMask"] = wantDoMask; |
817 | parameters["?profileAboutText"] = aboutText; | 817 | parameters["?profileAboutText"] = aboutText; |
818 | parameters["?profileFirstText"] = firstText; | 818 | parameters["?profileFirstText"] = firstText; |
819 | parameters["?profileImage"] = profileImage.ToString(); | 819 | parameters["?profileImage"] = profileImage.ToString(); |
820 | parameters["?profileFirstImage"] = firstImage.ToString(); | 820 | parameters["?profileFirstImage"] = firstImage.ToString(); |
821 | parameters["?webLoginKey"] = webLoginKey.ToString(); | 821 | parameters["?webLoginKey"] = webLoginKey.ToString(); |
822 | parameters["?userFlags"] = userFlags.ToString(); | 822 | parameters["?userFlags"] = userFlags; |
823 | parameters["?godLevel"] = godLevel.ToString(); | 823 | parameters["?godLevel"] = godLevel; |
824 | parameters["?customType"] = customType == null ? "" : customType; | 824 | parameters["?customType"] = customType == null ? "" : customType; |
825 | parameters["?partner"] = partner.ToString(); | 825 | parameters["?partner"] = partner.ToString(); |
826 | bool returnval = false; | 826 | bool returnval = false; |
@@ -892,35 +892,35 @@ namespace OpenSim.Data.MySQL | |||
892 | sql += "`customType` = ?customType , `partner` = ?partner , "; | 892 | sql += "`customType` = ?customType , `partner` = ?partner , "; |
893 | sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID"; | 893 | sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID"; |
894 | 894 | ||
895 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 895 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
896 | parameters["?UUID"] = uuid.ToString(); | 896 | parameters["?UUID"] = uuid.ToString(); |
897 | parameters["?username"] = username; | 897 | parameters["?username"] = username; |
898 | parameters["?lastname"] = lastname; | 898 | parameters["?lastname"] = lastname; |
899 | parameters["?email"] = email; | 899 | parameters["?email"] = email; |
900 | parameters["?passwordHash"] = passwordHash; | 900 | parameters["?passwordHash"] = passwordHash; |
901 | parameters["?passwordSalt"] = passwordSalt; | 901 | parameters["?passwordSalt"] = passwordSalt; |
902 | parameters["?homeRegion"] = homeRegion.ToString(); | 902 | parameters["?homeRegion"] = homeRegion; |
903 | parameters["?homeRegionID"] = homeRegionID.ToString(); | 903 | parameters["?homeRegionID"] = homeRegionID.ToString(); |
904 | parameters["?homeLocationX"] = homeLocX.ToString(); | 904 | parameters["?homeLocationX"] = homeLocX; |
905 | parameters["?homeLocationY"] = homeLocY.ToString(); | 905 | parameters["?homeLocationY"] = homeLocY; |
906 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | 906 | parameters["?homeLocationZ"] = homeLocZ; |
907 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); | 907 | parameters["?homeLookAtX"] = homeLookAtX; |
908 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); | 908 | parameters["?homeLookAtY"] = homeLookAtY; |
909 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | 909 | parameters["?homeLookAtZ"] = homeLookAtZ; |
910 | parameters["?created"] = created.ToString(); | 910 | parameters["?created"] = created; |
911 | parameters["?lastLogin"] = lastlogin.ToString(); | 911 | parameters["?lastLogin"] = lastlogin; |
912 | parameters["?userInventoryURI"] = inventoryURI; | 912 | parameters["?userInventoryURI"] = inventoryURI; |
913 | parameters["?userAssetURI"] = assetURI; | 913 | parameters["?userAssetURI"] = assetURI; |
914 | parameters["?profileCanDoMask"] = canDoMask.ToString(); | 914 | parameters["?profileCanDoMask"] = canDoMask; |
915 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); | 915 | parameters["?profileWantDoMask"] = wantDoMask; |
916 | parameters["?profileAboutText"] = aboutText; | 916 | parameters["?profileAboutText"] = aboutText; |
917 | parameters["?profileFirstText"] = firstText; | 917 | parameters["?profileFirstText"] = firstText; |
918 | parameters["?profileImage"] = profileImage.ToString(); | 918 | parameters["?profileImage"] = profileImage.ToString(); |
919 | parameters["?profileFirstImage"] = firstImage.ToString(); | 919 | parameters["?profileFirstImage"] = firstImage.ToString(); |
920 | parameters["?webLoginKey"] = webLoginKey.ToString(); | 920 | parameters["?webLoginKey"] = webLoginKey.ToString(); |
921 | parameters["?userFlags"] = userFlags.ToString(); | 921 | parameters["?userFlags"] = userFlags; |
922 | parameters["?godLevel"] = godLevel.ToString(); | 922 | parameters["?godLevel"] = godLevel; |
923 | parameters["?customType"] = customType == null ? "" : customType.ToString(); | 923 | parameters["?customType"] = customType == null ? "" : customType; |
924 | parameters["?partner"] = partner.ToString(); | 924 | parameters["?partner"] = partner.ToString(); |
925 | 925 | ||
926 | bool returnval = false; | 926 | bool returnval = false; |
@@ -993,7 +993,7 @@ namespace OpenSim.Data.MySQL | |||
993 | sql += ";"; | 993 | sql += ";"; |
994 | } | 994 | } |
995 | 995 | ||
996 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 996 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
997 | 997 | ||
998 | parameters["?regionHandle"] = regiondata.regionHandle.ToString(); | 998 | parameters["?regionHandle"] = regiondata.regionHandle.ToString(); |
999 | parameters["?regionName"] = regiondata.regionName.ToString(); | 999 | parameters["?regionName"] = regiondata.regionName.ToString(); |
@@ -1063,7 +1063,7 @@ namespace OpenSim.Data.MySQL | |||
1063 | 1063 | ||
1064 | string sql = "DELETE FROM regions WHERE uuid = ?uuid;"; | 1064 | string sql = "DELETE FROM regions WHERE uuid = ?uuid;"; |
1065 | 1065 | ||
1066 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 1066 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
1067 | 1067 | ||
1068 | try | 1068 | try |
1069 | { | 1069 | { |
@@ -1102,7 +1102,7 @@ namespace OpenSim.Data.MySQL | |||
1102 | sql += "REPLACE INTO "; | 1102 | sql += "REPLACE INTO "; |
1103 | sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos, currentLookAt) VALUES "; | 1103 | sql += "agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos, currentLookAt) VALUES "; |
1104 | sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos, ?currentLookAt);"; | 1104 | sql += "(?UUID, ?sessionID, ?secureSessionID, ?agentIP, ?agentPort, ?agentOnline, ?loginTime, ?logoutTime, ?currentRegion, ?currentHandle, ?currentPos, ?currentLookAt);"; |
1105 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | 1105 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
1106 | 1106 | ||
1107 | parameters["?UUID"] = agentdata.ProfileID.ToString(); | 1107 | parameters["?UUID"] = agentdata.ProfileID.ToString(); |
1108 | parameters["?sessionID"] = agentdata.SessionID.ToString(); | 1108 | parameters["?sessionID"] = agentdata.SessionID.ToString(); |
@@ -1114,8 +1114,8 @@ namespace OpenSim.Data.MySQL | |||
1114 | parameters["?logoutTime"] = agentdata.LogoutTime.ToString(); | 1114 | parameters["?logoutTime"] = agentdata.LogoutTime.ToString(); |
1115 | parameters["?currentRegion"] = agentdata.Region.ToString(); | 1115 | parameters["?currentRegion"] = agentdata.Region.ToString(); |
1116 | parameters["?currentHandle"] = agentdata.Handle.ToString(); | 1116 | parameters["?currentHandle"] = agentdata.Handle.ToString(); |
1117 | parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString() + "," + (agentdata.Position.Y).ToString() + "," + (agentdata.Position.Z).ToString() + ">"; | 1117 | parameters["?currentPos"] = "<" + (agentdata.Position.X).ToString().Replace(",", ".") + "," + (agentdata.Position.Y).ToString().Replace(",", ".") + "," + (agentdata.Position.Z).ToString().Replace(",", ".") + ">"; |
1118 | parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString() + "," + (agentdata.LookAt.Y).ToString() + "," + (agentdata.LookAt.Z).ToString() + ">"; | 1118 | parameters["?currentLookAt"] = "<" + (agentdata.LookAt.X).ToString().Replace(",", ".") + "," + (agentdata.LookAt.Y).ToString().Replace(",", ".") + "," + (agentdata.LookAt.Z).ToString().Replace(",", ".") + ">"; |
1119 | 1119 | ||
1120 | bool returnval = false; | 1120 | bool returnval = false; |
1121 | 1121 | ||