diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLXInventoryData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXInventoryData.cs | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 7a3b5b4..c74033e 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL | |||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | public class MySqlItemHandler : MySQLGenericTableHandler<XInventoryItem> | 125 | public class MySqlItemHandler : MySqlInventoryHandler<XInventoryItem> |
126 | { | 126 | { |
127 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 127 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
128 | 128 | ||
@@ -241,47 +241,9 @@ namespace OpenSim.Data.MySQL | |||
241 | 241 | ||
242 | return true; | 242 | return true; |
243 | } | 243 | } |
244 | |||
245 | private bool IncrementFolderVersion(UUID folderID) | ||
246 | { | ||
247 | return IncrementFolderVersion(folderID.ToString()); | ||
248 | } | ||
249 | |||
250 | private bool IncrementFolderVersion(string folderID) | ||
251 | { | ||
252 | // m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); | ||
253 | // Util.PrintCallStack(); | ||
254 | |||
255 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
256 | { | ||
257 | dbcon.Open(); | ||
258 | |||
259 | using (MySqlCommand cmd = new MySqlCommand()) | ||
260 | { | ||
261 | cmd.Connection = dbcon; | ||
262 | |||
263 | cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID"); | ||
264 | cmd.Parameters.AddWithValue("?folderID", folderID); | ||
265 | |||
266 | try | ||
267 | { | ||
268 | cmd.ExecuteNonQuery(); | ||
269 | } | ||
270 | catch (Exception) | ||
271 | { | ||
272 | return false; | ||
273 | } | ||
274 | cmd.Dispose(); | ||
275 | } | ||
276 | |||
277 | dbcon.Close(); | ||
278 | } | ||
279 | |||
280 | return true; | ||
281 | } | ||
282 | } | 244 | } |
283 | 245 | ||
284 | public class MySqlFolderHandler : MySQLGenericTableHandler<XInventoryFolder> | 246 | public class MySqlFolderHandler : MySqlInventoryHandler<XInventoryFolder> |
285 | { | 247 | { |
286 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 248 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
287 | 249 | ||
@@ -326,13 +288,18 @@ namespace OpenSim.Data.MySQL | |||
326 | 288 | ||
327 | return true; | 289 | return true; |
328 | } | 290 | } |
291 | } | ||
292 | |||
293 | public class MySqlInventoryHandler<T> : MySQLGenericTableHandler<T> where T: class, new() | ||
294 | { | ||
295 | public MySqlInventoryHandler(string c, string t, string m) : base(c, t, m) {} | ||
329 | 296 | ||
330 | private bool IncrementFolderVersion(UUID folderID) | 297 | protected bool IncrementFolderVersion(UUID folderID) |
331 | { | 298 | { |
332 | return IncrementFolderVersion(folderID.ToString()); | 299 | return IncrementFolderVersion(folderID.ToString()); |
333 | } | 300 | } |
334 | 301 | ||
335 | private bool IncrementFolderVersion(string folderID) | 302 | protected bool IncrementFolderVersion(string folderID) |
336 | { | 303 | { |
337 | // m_log.DebugFormat("[MYSQL FOLDER HANDLER]: Incrementing version on folder {0}", folderID); | 304 | // m_log.DebugFormat("[MYSQL FOLDER HANDLER]: Incrementing version on folder {0}", folderID); |
338 | // Util.PrintCallStack(); | 305 | // Util.PrintCallStack(); |