aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL
diff options
context:
space:
mode:
authorDiva Canto2013-12-06 16:02:03 -0800
committerDiva Canto2013-12-06 16:02:03 -0800
commit5047bd7b4403177fb92a6b4c84a7ba2eaff3b86e (patch)
tree855b759cf5de6fff16e81b39d09eeaeab7c3d012 /OpenSim/Data/PGSQL
parentFixed misleading comment (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-5047bd7b4403177fb92a6b4c84a7ba2eaff3b86e.zip
opensim-SC-5047bd7b4403177fb92a6b4c84a7ba2eaff3b86e.tar.gz
opensim-SC-5047bd7b4403177fb92a6b4c84a7ba2eaff3b86e.tar.bz2
opensim-SC-5047bd7b4403177fb92a6b4c84a7ba2eaff3b86e.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLRegionData.cs2
-rw-r--r--OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs31
-rw-r--r--OpenSim/Data/PGSQL/Resources/UserProfiles.migrations9
3 files changed, 24 insertions, 18 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
index f3e4064..b3076f0 100644
--- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
206 206
207 DataTable schemaTable = result.GetSchemaTable(); 207 DataTable schemaTable = result.GetSchemaTable();
208 foreach (DataRow row in schemaTable.Rows) 208 foreach (DataRow row in schemaTable.Rows)
209 m_ColumnNames.Add(row["column_name"].ToString()); 209 m_ColumnNames.Add(row["ColumnName"].ToString());
210 } 210 }
211 211
212 foreach (string s in m_ColumnNames) 212 foreach (string s in m_ColumnNames)
diff --git a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
index e3cbf7f..46f57d8 100644
--- a/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLUserProfilesData.cs
@@ -715,7 +715,6 @@ namespace OpenSim.Data.PGSQL
715 string query = string.Empty; 715 string query = string.Empty;
716 716
717 query += "UPDATE userprofile SET "; 717 query += "UPDATE userprofile SET ";
718 query += "profilePartner=:profilePartner, ";
719 query += "profileURL=:profileURL, "; 718 query += "profileURL=:profileURL, ";
720 query += "profileImage=:image, "; 719 query += "profileImage=:image, ";
721 query += "profileAboutText=:abouttext,"; 720 query += "profileAboutText=:abouttext,";
@@ -731,7 +730,6 @@ namespace OpenSim.Data.PGSQL
731 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 730 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
732 { 731 {
733 cmd.Parameters.AddWithValue("profileURL", props.WebUrl); 732 cmd.Parameters.AddWithValue("profileURL", props.WebUrl);
734 cmd.Parameters.AddWithValue("profilePartner", props.PartnerId.ToString());
735 cmd.Parameters.AddWithValue("image", props.ImageId.ToString()); 733 cmd.Parameters.AddWithValue("image", props.ImageId.ToString());
736 cmd.Parameters.AddWithValue("abouttext", props.AboutText); 734 cmd.Parameters.AddWithValue("abouttext", props.AboutText);
737 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString()); 735 cmd.Parameters.AddWithValue("firstlifeimage", props.FirstLifeImageId.ToString());
@@ -876,7 +874,7 @@ namespace OpenSim.Data.PGSQL
876 } 874 }
877 875
878 #region User Preferences 876 #region User Preferences
879 public OSDArray GetUserPreferences(UUID avatarId) 877 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
880 { 878 {
881 string query = string.Empty; 879 string query = string.Empty;
882 880
@@ -893,19 +891,16 @@ namespace OpenSim.Data.PGSQL
893 dbcon.Open(); 891 dbcon.Open();
894 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 892 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
895 { 893 {
896 cmd.Parameters.AddWithValue("Id", avatarId.ToString()); 894 cmd.Parameters.AddWithValue("Id", pref.UserId.ToString());
897 895
898 using (NpgsqlDataReader reader = cmd.ExecuteReader()) 896 using (NpgsqlDataReader reader = cmd.ExecuteReader())
899 { 897 {
900 if(reader.HasRows) 898 if(reader.HasRows)
901 { 899 {
902 reader.Read(); 900 reader.Read();
903 OSDMap record = new OSDMap(); 901 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
904 902 bool.TryParse((string)reader["visible"], out pref.Visible);
905 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 903 pref.EMail = (string)reader["email"];
906 record.Add("visible",OSD.FromString((string)reader["visible"]));
907 record.Add("email",OSD.FromString((string)reader["email"]));
908 data.Add(record);
909 } 904 }
910 else 905 else
911 { 906 {
@@ -928,15 +923,16 @@ namespace OpenSim.Data.PGSQL
928 { 923 {
929 m_log.DebugFormat("[PROFILES_DATA]" + 924 m_log.DebugFormat("[PROFILES_DATA]" +
930 ": Get preferences exception {0}", e.Message); 925 ": Get preferences exception {0}", e.Message);
926 result = e.Message;
931 } 927 }
932 return data; 928 return true;
933 } 929 }
934 930
935 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 931 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
936 { 932 {
937 string query = string.Empty; 933 string query = string.Empty;
938 934
939 query += "UPDATE userpsettings SET "; 935 query += "UPDATE usersettings SET ";
940 query += "imviaemail=:ImViaEmail, "; 936 query += "imviaemail=:ImViaEmail, ";
941 query += "visible=:Visible,"; 937 query += "visible=:Visible,";
942 query += "WHERE useruuid=:uuid"; 938 query += "WHERE useruuid=:uuid";
@@ -948,9 +944,9 @@ namespace OpenSim.Data.PGSQL
948 dbcon.Open(); 944 dbcon.Open();
949 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon)) 945 using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
950 { 946 {
951 cmd.Parameters.AddWithValue("ImViaEmail", emailIm.ToString().ToLower ()); 947 cmd.Parameters.AddWithValue("ImViaEmail", pref.IMViaEmail.ToString().ToLower ());
952 cmd.Parameters.AddWithValue("WantText", visible.ToString().ToLower ()); 948 cmd.Parameters.AddWithValue("Visible", pref.Visible.ToString().ToLower ());
953 cmd.Parameters.AddWithValue("uuid", avatarId.ToString()); 949 cmd.Parameters.AddWithValue("uuid", pref.UserId.ToString());
954 950
955 lock(Lock) 951 lock(Lock)
956 { 952 {
@@ -963,6 +959,7 @@ namespace OpenSim.Data.PGSQL
963 { 959 {
964 m_log.DebugFormat("[PROFILES_DATA]" + 960 m_log.DebugFormat("[PROFILES_DATA]" +
965 ": AgentInterestsUpdate exception {0}", e.Message); 961 ": AgentInterestsUpdate exception {0}", e.Message);
962 result = e.Message;
966 return false; 963 return false;
967 } 964 }
968 return true; 965 return true;
diff --git a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
index f23c870..4fcaa8e 100644
--- a/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
+++ b/OpenSim/Data/PGSQL/Resources/UserProfiles.migrations
@@ -81,3 +81,12 @@ CREATE TABLE userdata (
81 81
82commit; 82commit;
83 83
84:VERSION 3 # -------------------------------
85begin;
86CREATE TABLE usersettings (
87 "useruuid" char(36) NOT NULL,
88 "imviaemail" bytea NOT NULL,
89 "visible" bytea NOT NULL,
90 PRIMARY KEY ("useruuid")
91);
92commit; \ No newline at end of file