aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-18 17:22:36 +0000
committerMelanie Thielker2008-08-18 17:22:36 +0000
commit05506cff499b999d6c01e0517e658293b4791317 (patch)
treec0990ac8347181cbec66bd4adc61c6af3b486b4d /OpenSim/Data/MySQL/MySQLUserData.cs
parentMantis#1992. Thank you kindly, ChrisDown for a patch that: (diff)
downloadopensim-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 'OpenSim/Data/MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs25
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
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
31using System.Reflection; 32using System.Reflection;
@@ -34,6 +35,7 @@ using libsecondlife;
34using log4net; 35using log4net;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Data.Base; 37using OpenSim.Data.Base;
38using MySql.Data.MySqlClient;
37 39
38namespace OpenSim.Data.MySQL 40namespace 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}