aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorMelanie2012-11-08 04:51:00 +0000
committerMelanie2012-11-08 04:51:00 +0000
commitb3e99a4d484d805866a6b7c40389683a98c8db36 (patch)
tree2ca7a1655e91212c605c49109ace0209fed1b546 /OpenSim/Data
parentMerge branch 'master' into careminster (diff)
parentBulletSim: add skeleton classes for shape objectification. This will eventual... (diff)
downloadopensim-SC-b3e99a4d484d805866a6b7c40389683a98c8db36.zip
opensim-SC-b3e99a4d484d805866a6b7c40389683a98c8db36.tar.gz
opensim-SC-b3e99a4d484d805866a6b7c40389683a98c8db36.tar.bz2
opensim-SC-b3e99a4d484d805866a6b7c40389683a98c8db36.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs75
2 files changed, 76 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 86367a1..f6731c0 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -224,6 +224,8 @@ namespace OpenSim.Data.MySQL
224 224
225 public virtual bool Store(T row) 225 public virtual bool Store(T row)
226 { 226 {
227// m_log.DebugFormat("[MYSQL GENERIC TABLE HANDLER]: Store(T row) invoked");
228
227 using (MySqlCommand cmd = new MySqlCommand()) 229 using (MySqlCommand cmd = new MySqlCommand())
228 { 230 {
229 string query = ""; 231 string query = "";
@@ -278,6 +280,10 @@ namespace OpenSim.Data.MySQL
278 280
279 public virtual bool Delete(string[] fields, string[] keys) 281 public virtual bool Delete(string[] fields, string[] keys)
280 { 282 {
283// m_log.DebugFormat(
284// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
285// string.Join(",", fields), string.Join(",", keys));
286
281 if (fields.Length != keys.Length) 287 if (fields.Length != keys.Length)
282 return false; 288 return false;
283 289
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index caf18a4..cccc500 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -26,9 +26,10 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Data; 30using System.Data;
31using System.Linq;
30using System.Reflection; 32using System.Reflection;
31using System.Collections.Generic;
32using log4net; 33using log4net;
33using MySql.Data.MySqlClient; 34using MySql.Data.MySqlClient;
34using OpenMetaverse; 35using OpenMetaverse;
@@ -118,22 +119,69 @@ namespace OpenSim.Data.MySQL
118 119
119 public class MySqlItemHandler : MySQLGenericTableHandler<XInventoryItem> 120 public class MySqlItemHandler : MySQLGenericTableHandler<XInventoryItem>
120 { 121 {
122// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
123
121 public MySqlItemHandler(string c, string t, string m) : 124 public MySqlItemHandler(string c, string t, string m) :
122 base(c, t, m) 125 base(c, t, m)
123 { 126 {
124 } 127 }
125 128
129 public override bool Delete(string field, string val)
130 {
131 XInventoryItem[] retrievedItems = Get(new string[] { field }, new string[] { val });
132 if (retrievedItems.Length == 0)
133 return false;
134
135 if (!base.Delete(field, val))
136 return false;
137
138 // Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
139// IncrementFolderVersion(retrievedItems[0].parentFolderID);
140
141 return true;
142 }
143
144 public override bool Delete(string[] fields, string[] vals)
145 {
146 XInventoryItem[] retrievedItems = Get(fields, vals);
147 if (retrievedItems.Length == 0)
148 return false;
149
150 if (!base.Delete(fields, vals))
151 return false;
152
153 HashSet<UUID> deletedItemFolderUUIDs = new HashSet<UUID>();
154
155 Array.ForEach<XInventoryItem>(retrievedItems, i => deletedItemFolderUUIDs.Add(i.parentFolderID));
156
157 foreach (UUID deletedItemFolderUUID in deletedItemFolderUUIDs)
158 IncrementFolderVersion(deletedItemFolderUUID);
159
160 return true;
161 }
162
126 public bool MoveItem(string id, string newParent) 163 public bool MoveItem(string id, string newParent)
127 { 164 {
165 XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
166 if (retrievedItems.Length == 0)
167 return false;
168
169 UUID oldParent = retrievedItems[0].parentFolderID;
170
128 using (MySqlCommand cmd = new MySqlCommand()) 171 using (MySqlCommand cmd = new MySqlCommand())
129 { 172 {
130
131 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm); 173 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
132 cmd.Parameters.AddWithValue("?ParentFolderID", newParent); 174 cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
133 cmd.Parameters.AddWithValue("?InventoryID", id); 175 cmd.Parameters.AddWithValue("?InventoryID", id);
134 176
135 return ExecuteNonQuery(cmd) == 0 ? false : true; 177 if (ExecuteNonQuery(cmd) == 0)
178 return false;
136 } 179 }
180
181 IncrementFolderVersion(oldParent);
182 IncrementFolderVersion(newParent);
183
184 return true;
137 } 185 }
138 186
139 public XInventoryItem[] GetActiveGestures(UUID principalID) 187 public XInventoryItem[] GetActiveGestures(UUID principalID)
@@ -184,6 +232,21 @@ namespace OpenSim.Data.MySQL
184 if (!base.Store(item)) 232 if (!base.Store(item))
185 return false; 233 return false;
186 234
235 IncrementFolderVersion(item.parentFolderID);
236
237 return true;
238 }
239
240 private bool IncrementFolderVersion(UUID folderID)
241 {
242 return IncrementFolderVersion(folderID.ToString());
243 }
244
245 private bool IncrementFolderVersion(string folderID)
246 {
247// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
248// Util.PrintCallStack();
249
187 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 250 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
188 { 251 {
189 dbcon.Open(); 252 dbcon.Open();
@@ -193,7 +256,7 @@ namespace OpenSim.Data.MySQL
193 cmd.Connection = dbcon; 256 cmd.Connection = dbcon;
194 257
195 cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID"); 258 cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
196 cmd.Parameters.AddWithValue("?folderID", item.parentFolderID.ToString()); 259 cmd.Parameters.AddWithValue("?folderID", folderID);
197 260
198 try 261 try
199 { 262 {
@@ -205,9 +268,11 @@ namespace OpenSim.Data.MySQL
205 } 268 }
206 cmd.Dispose(); 269 cmd.Dispose();
207 } 270 }
271
208 dbcon.Close(); 272 dbcon.Close();
209 } 273 }
274
210 return true; 275 return true;
211 } 276 }
212 } 277 }
213} 278} \ No newline at end of file