diff options
author | Sean Dague | 2008-05-21 18:02:09 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-21 18:02:09 +0000 |
commit | 53bcf2139e7c8c9da2fbbcafc45704eae3bc5daa (patch) | |
tree | 6773914f9fd12e53240ce7c3ce8dad3e47ed9a1d /OpenSim/Data/MySQL/MySQLUserData.cs | |
parent | IZ QUATERNION NORMALIZE TO 0? NOWAI! KTHXBYE (diff) | |
download | opensim-SC_OLD-53bcf2139e7c8c9da2fbbcafc45704eae3bc5daa.zip opensim-SC_OLD-53bcf2139e7c8c9da2fbbcafc45704eae3bc5daa.tar.gz opensim-SC_OLD-53bcf2139e7c8c9da2fbbcafc45704eae3bc5daa.tar.bz2 opensim-SC_OLD-53bcf2139e7c8c9da2fbbcafc45704eae3bc5daa.tar.xz |
this removes use of the mapper for wearables, and I can confirm things
get saved to the database. There are still issues on wearing things
after a cleared cache that I'm looking at now.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 56bdcbf..35bcb1d 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -34,8 +34,6 @@ using libsecondlife; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Data.Base; | 36 | using OpenSim.Data.Base; |
37 | using OpenSim.Data.MapperFactory; | ||
38 | using OpenSim.Data.MySQLMapper; | ||
39 | 37 | ||
40 | namespace OpenSim.Data.MySQL | 38 | namespace OpenSim.Data.MySQL |
41 | { | 39 | { |
@@ -56,8 +54,6 @@ namespace OpenSim.Data.MySQL | |||
56 | private string m_userFriendsTableName; | 54 | private string m_userFriendsTableName; |
57 | private string m_appearanceTableName = "avatarappearance"; | 55 | private string m_appearanceTableName = "avatarappearance"; |
58 | private string m_connectString; | 56 | private string m_connectString; |
59 | private BaseDatabaseConnector m_databaseMapper; | ||
60 | private AppearanceTableMapper m_appearanceMapper; | ||
61 | 57 | ||
62 | /// <summary> | 58 | /// <summary> |
63 | /// Loads and initialises the MySQL storage plugin | 59 | /// Loads and initialises the MySQL storage plugin |
@@ -107,15 +103,6 @@ namespace OpenSim.Data.MySQL | |||
107 | database = new MySQLManager(m_connectString); | 103 | database = new MySQLManager(m_connectString); |
108 | } | 104 | } |
109 | 105 | ||
110 | string mapperTypeStr = "MySQL"; | ||
111 | DataMapperFactory.MAPPER_TYPE mapperType = | ||
112 | (DataMapperFactory.MAPPER_TYPE) | ||
113 | Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr); | ||
114 | |||
115 | m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectString); | ||
116 | |||
117 | m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance"); | ||
118 | |||
119 | TestTables(); | 106 | TestTables(); |
120 | } | 107 | } |
121 | 108 | ||
@@ -203,6 +190,12 @@ namespace OpenSim.Data.MySQL | |||
203 | { | 190 | { |
204 | database.ExecuteResourceSql("CreateAvatarAppearance.sql"); | 191 | database.ExecuteResourceSql("CreateAvatarAppearance.sql"); |
205 | return; | 192 | return; |
193 | } | ||
194 | else if (oldVersion.Contains("Rev.1")) | ||
195 | { | ||
196 | database.ExecuteSql("drop table avatarappearance"); | ||
197 | database.ExecuteResourceSql("CreateAvatarAppearance.sql"); | ||
198 | return; | ||
206 | } | 199 | } |
207 | } | 200 | } |
208 | 201 | ||
@@ -676,18 +669,35 @@ namespace OpenSim.Data.MySQL | |||
676 | // override | 669 | // override |
677 | override public AvatarAppearance GetUserAppearance(LLUUID user) | 670 | override public AvatarAppearance GetUserAppearance(LLUUID user) |
678 | { | 671 | { |
679 | AvatarAppearance appearance = null; | 672 | try { |
680 | if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance)) | 673 | lock (database) |
674 | { | ||
675 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
676 | param["?owner"] = user.ToString(); | ||
677 | |||
678 | IDbCommand result = database.Query("SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param); | ||
679 | IDataReader reader = result.ExecuteReader(); | ||
680 | |||
681 | AvatarAppearance appearance = database.readAppearanceRow(reader); | ||
682 | |||
683 | reader.Close(); | ||
684 | result.Dispose(); | ||
685 | |||
686 | return appearance; | ||
687 | } | ||
688 | } | ||
689 | catch (Exception e) | ||
681 | { | 690 | { |
682 | appearance = null; | 691 | database.Reconnect(); |
692 | m_log.Error(e.ToString()); | ||
693 | return null; | ||
683 | } | 694 | } |
684 | return appearance; | ||
685 | } | 695 | } |
686 | |||
687 | // override | 696 | // override |
688 | override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) | 697 | override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) |
689 | { | 698 | { |
690 | m_appearanceMapper.Update(user.UUID, appearance); | 699 | appearance.Owner = user; |
700 | database.insertAppearanceRow(appearance); | ||
691 | } | 701 | } |
692 | 702 | ||
693 | override public void AddAttachment(LLUUID user, LLUUID item) | 703 | override public void AddAttachment(LLUUID user, LLUUID item) |