diff options
author | Melanie Thielker | 2008-08-18 17:22:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-18 17:22:36 +0000 |
commit | 05506cff499b999d6c01e0517e658293b4791317 (patch) | |
tree | c0990ac8347181cbec66bd4adc61c6af3b486b4d /OpenSim/Data/MySQL/MySQLUserData.cs | |
parent | Mantis#1992. Thank you kindly, ChrisDown for a patch that: (diff) | |
download | opensim-SC_OLD-05506cff499b999d6c01e0517e658293b4791317.zip opensim-SC_OLD-05506cff499b999d6c01e0517e658293b4791317.tar.gz opensim-SC_OLD-05506cff499b999d6c01e0517e658293b4791317.tar.bz2 opensim-SC_OLD-05506cff499b999d6c01e0517e658293b4791317.tar.xz |
Avatar Attachment persistence!! Patch #9168 (Mantis #1171)
Plumbs in attachment persistence and adds the tables. Currently MySQL
only, no user functionality yet.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index f77d947..627bc0c 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Data; | 31 | using System.Data; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -34,6 +35,7 @@ using libsecondlife; | |||
34 | using log4net; | 35 | using log4net; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Data.Base; | 37 | using OpenSim.Data.Base; |
38 | using MySql.Data.MySqlClient; | ||
37 | 39 | ||
38 | namespace OpenSim.Data.MySQL | 40 | namespace OpenSim.Data.MySQL |
39 | { | 41 | { |
@@ -737,6 +739,8 @@ namespace OpenSim.Data.MySQL | |||
737 | reader.Dispose(); | 739 | reader.Dispose(); |
738 | result.Dispose(); | 740 | result.Dispose(); |
739 | 741 | ||
742 | appearance.SetAttachments(GetUserAttachments(user)); | ||
743 | |||
740 | return appearance; | 744 | return appearance; |
741 | } | 745 | } |
742 | } | 746 | } |
@@ -762,6 +766,8 @@ namespace OpenSim.Data.MySQL | |||
762 | { | 766 | { |
763 | appearance.Owner = user; | 767 | appearance.Owner = user; |
764 | database.insertAppearanceRow(appearance); | 768 | database.insertAppearanceRow(appearance); |
769 | |||
770 | UpdateUserAttachments(user, appearance.GetAttachments()); | ||
765 | } | 771 | } |
766 | } | 772 | } |
767 | catch (Exception e) | 773 | catch (Exception e) |
@@ -818,5 +824,24 @@ namespace OpenSim.Data.MySQL | |||
818 | { | 824 | { |
819 | get {return "0.1";} | 825 | get {return "0.1";} |
820 | } | 826 | } |
827 | |||
828 | public Hashtable GetUserAttachments(LLUUID agentID) | ||
829 | { | ||
830 | MySqlCommand cmd = (MySqlCommand) (database.Connection.CreateCommand()); | ||
831 | cmd.CommandText = "select attachpoint, item, asset from avatarattachments where UUID = ?uuid"; | ||
832 | cmd.Parameters.AddWithValue("?uuid", agentID.ToString()); | ||
833 | |||
834 | IDataReader r = cmd.ExecuteReader(); | ||
835 | |||
836 | return database.readAttachments(r); | ||
837 | } | ||
838 | |||
839 | public void UpdateUserAttachments(LLUUID agentID, Hashtable data) | ||
840 | { | ||
841 | if(data == null) | ||
842 | return; | ||
843 | |||
844 | database.writeAttachments(agentID, data); | ||
845 | } | ||
821 | } | 846 | } |
822 | } | 847 | } |