diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserProfilesData.cs | 20 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | 84 |
2 files changed, 98 insertions, 6 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs index dc88f94..8e9f77d 100644 --- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs +++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs | |||
@@ -546,6 +546,10 @@ namespace OpenSim.Data.MySQL | |||
546 | reader.Read(); | 546 | reader.Read(); |
547 | notes.Notes = OSD.FromString((string)reader["notes"]); | 547 | notes.Notes = OSD.FromString((string)reader["notes"]); |
548 | } | 548 | } |
549 | else | ||
550 | { | ||
551 | notes.Notes = OSD.FromString(""); | ||
552 | } | ||
549 | } | 553 | } |
550 | } | 554 | } |
551 | } | 555 | } |
@@ -928,15 +932,19 @@ namespace OpenSim.Data.MySQL | |||
928 | } | 932 | } |
929 | else | 933 | else |
930 | { | 934 | { |
935 | dbcon.Close(); | ||
936 | dbcon.Open(); | ||
937 | |||
938 | query = "INSERT INTO usersettings VALUES "; | ||
939 | query += "(?uuid,'false','false', ?Email)"; | ||
940 | |||
931 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) | 941 | using (MySqlCommand put = new MySqlCommand(query, dbcon)) |
932 | { | 942 | { |
933 | query = "INSERT INTO usersettings VALUES "; | ||
934 | query += "(?Id,'false','false', '')"; | ||
935 | 943 | ||
936 | lock(Lock) | 944 | put.Parameters.AddWithValue("?Email", pref.EMail); |
937 | { | 945 | put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); |
938 | put.ExecuteNonQuery(); | 946 | |
939 | } | 947 | put.ExecuteNonQuery(); |
940 | } | 948 | } |
941 | } | 949 | } |
942 | } | 950 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs index 8c1bcd4..90d45e9 100644 --- a/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserProfilesData.cs | |||
@@ -747,6 +747,90 @@ namespace OpenSim.Data.SQLite | |||
747 | } | 747 | } |
748 | return true; | 748 | return true; |
749 | } | 749 | } |
750 | |||
751 | public bool UpdateUserPreferences(ref UserPreferences pref, ref string result) | ||
752 | { | ||
753 | string query = string.Empty; | ||
754 | |||
755 | query += "UPDATE usersettings SET "; | ||
756 | query += "imviaemail=:ImViaEmail, "; | ||
757 | query += "visible=:Visible "; | ||
758 | query += "WHERE useruuid=:uuid"; | ||
759 | |||
760 | try | ||
761 | { | ||
762 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
763 | { | ||
764 | cmd.CommandText = query; | ||
765 | cmd.Parameters.AddWithValue(":ImViaEmail", pref.IMViaEmail); | ||
766 | cmd.Parameters.AddWithValue(":Visible", pref.Visible); | ||
767 | cmd.Parameters.AddWithValue(":uuid", pref.UserId.ToString()); | ||
768 | |||
769 | cmd.ExecuteNonQuery(); | ||
770 | } | ||
771 | } | ||
772 | catch (Exception e) | ||
773 | { | ||
774 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
775 | ": AgentInterestsUpdate exception {0}", e.Message); | ||
776 | result = e.Message; | ||
777 | return false; | ||
778 | } | ||
779 | return true; | ||
780 | } | ||
781 | |||
782 | public bool GetUserPreferences(ref UserPreferences pref, ref string result) | ||
783 | { | ||
784 | IDataReader reader = null; | ||
785 | string query = string.Empty; | ||
786 | |||
787 | query += "SELECT imviaemail,visible,email FROM "; | ||
788 | query += "usersettings WHERE "; | ||
789 | query += "useruuid = :Id"; | ||
790 | |||
791 | OSDArray data = new OSDArray(); | ||
792 | |||
793 | try | ||
794 | { | ||
795 | using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand()) | ||
796 | { | ||
797 | cmd.CommandText = query; | ||
798 | cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString()); | ||
799 | |||
800 | using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
801 | { | ||
802 | if(reader.Read()) | ||
803 | { | ||
804 | bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail); | ||
805 | bool.TryParse((string)reader["visible"], out pref.Visible); | ||
806 | pref.EMail = (string)reader["email"]; | ||
807 | } | ||
808 | else | ||
809 | { | ||
810 | query = "INSERT INTO usersettings VALUES "; | ||
811 | query += "(:Id,'false','false', :Email)"; | ||
812 | |||
813 | using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand()) | ||
814 | { | ||
815 | put.Parameters.AddWithValue(":Id", pref.UserId.ToString()); | ||
816 | put.Parameters.AddWithValue(":Email", pref.EMail); | ||
817 | put.ExecuteNonQuery(); | ||
818 | |||
819 | } | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | } | ||
824 | catch (Exception e) | ||
825 | { | ||
826 | m_log.DebugFormat("[PROFILES_DATA]" + | ||
827 | ": Get preferences exception {0}", e.Message); | ||
828 | result = e.Message; | ||
829 | return false; | ||
830 | } | ||
831 | return true; | ||
832 | } | ||
833 | |||
750 | public bool GetUserAppData(ref UserAppData props, ref string result) | 834 | public bool GetUserAppData(ref UserAppData props, ref string result) |
751 | { | 835 | { |
752 | IDataReader reader = null; | 836 | IDataReader reader = null; |