From 350cd58e5e52b88651035bcba19010807bff7870 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Nov 2012 04:01:30 +0000 Subject: refactor: move common inventory folder version update code to parent class in mysql, mssql and sqlite database plugins --- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 42 +++++++---------------------- 1 file changed, 10 insertions(+), 32 deletions(-) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 87eb31e..2a0a8f6 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -130,7 +130,7 @@ namespace OpenSim.Data.SQLite } } - public class SqliteItemHandler : SQLiteGenericTableHandler + public class SqliteItemHandler : SqliteInventoryHandler { public SqliteItemHandler(string c, string t, string m) : base(c, t, m) @@ -243,37 +243,9 @@ namespace OpenSim.Data.SQLite return perms; } - - private bool IncrementFolderVersion(UUID folderID) - { - return IncrementFolderVersion(folderID.ToString()); - } - - private bool IncrementFolderVersion(string folderID) - { -// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); -// Util.PrintCallStack(); - - using (SqliteCommand cmd = new SqliteCommand()) - { - cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID"; - cmd.Parameters.Add(new SqliteParameter(":folderID", folderID)); - - try - { - cmd.ExecuteNonQuery(); - } - catch (Exception) - { - return false; - } - } - - return true; - } } - public class SqliteFolderHandler : SQLiteGenericTableHandler + public class SqliteFolderHandler : SqliteInventoryHandler { public SqliteFolderHandler(string c, string t, string m) : base(c, t, m) @@ -315,12 +287,18 @@ namespace OpenSim.Data.SQLite return true; } - private bool IncrementFolderVersion(UUID folderID) + } + + public class SqliteInventoryHandler : SQLiteGenericTableHandler where T: class, new() + { + public SqliteInventoryHandler(string c, string t, string m) : base(c, t, m) {} + + protected bool IncrementFolderVersion(UUID folderID) { return IncrementFolderVersion(folderID.ToString()); } - private bool IncrementFolderVersion(string folderID) + protected bool IncrementFolderVersion(string folderID) { // m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); // Util.PrintCallStack(); -- cgit v1.1