aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-15 04:01:30 +0000
committerJustin Clark-Casey (justincc)2012-11-15 04:01:30 +0000
commit350cd58e5e52b88651035bcba19010807bff7870 (patch)
tree46363304a9196e43729241cd0a88a4aefba04bad /OpenSim/Data/MSSQL
parentImprove inventory folder version updating for mssql database plugin. (diff)
downloadopensim-SC_OLD-350cd58e5e52b88651035bcba19010807bff7870.zip
opensim-SC_OLD-350cd58e5e52b88651035bcba19010807bff7870.tar.gz
opensim-SC_OLD-350cd58e5e52b88651035bcba19010807bff7870.tar.bz2
opensim-SC_OLD-350cd58e5e52b88651035bcba19010807bff7870.tar.xz
refactor: move common inventory folder version update code to parent class in mysql, mssql and sqlite database plugins
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLXInventoryData.cs47
1 files changed, 9 insertions, 38 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
index 97970af..9164ffe 100644
--- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Data.MSSQL
122 } 122 }
123 } 123 }
124 124
125 public class MSSQLItemHandler : MSSQLGenericTableHandler<XInventoryItem> 125 public class MSSQLItemHandler : MSSQLInventoryHandler<XInventoryItem>
126 { 126 {
127 public MSSQLItemHandler(string c, string t, string m) : 127 public MSSQLItemHandler(string c, string t, string m) :
128 base(c, t, m) 128 base(c, t, m)
@@ -213,43 +213,9 @@ namespace OpenSim.Data.MSSQL
213 213
214 return true; 214 return true;
215 } 215 }
216
217 private bool IncrementFolderVersion(UUID folderID)
218 {
219 return IncrementFolderVersion(folderID.ToString());
220 }
221
222 private bool IncrementFolderVersion(string folderID)
223 {
224// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
225// Util.PrintCallStack();
226
227 string sql = "update inventoryfolders set version=version+1 where folderID = ?folderID";
228
229 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
230 {
231 using (SqlCommand cmd = new SqlCommand(sql, conn))
232 {
233 conn.Open();
234
235 cmd.Parameters.AddWithValue("@folderID", folderID);
236
237 try
238 {
239 cmd.ExecuteNonQuery();
240 }
241 catch (Exception)
242 {
243 return false;
244 }
245 }
246 }
247
248 return true;
249 }
250 } 216 }
251 217
252 public class MSSQLFolderHandler : MSSQLGenericTableHandler<XInventoryFolder> 218 public class MSSQLFolderHandler : MSSQLInventoryHandler<XInventoryFolder>
253 { 219 {
254 public MSSQLFolderHandler(string c, string t, string m) : 220 public MSSQLFolderHandler(string c, string t, string m) :
255 base(c, t, m) 221 base(c, t, m)
@@ -296,13 +262,18 @@ namespace OpenSim.Data.MSSQL
296 262
297 return true; 263 return true;
298 } 264 }
265 }
266
267 public class MSSQLInventoryHandler<T> : MSSQLGenericTableHandler<T> where T: class, new()
268 {
269 public MSSQLInventoryHandler(string c, string t, string m) : base(c, t, m) {}
299 270
300 private bool IncrementFolderVersion(UUID folderID) 271 protected bool IncrementFolderVersion(UUID folderID)
301 { 272 {
302 return IncrementFolderVersion(folderID.ToString()); 273 return IncrementFolderVersion(folderID.ToString());
303 } 274 }
304 275
305 private bool IncrementFolderVersion(string folderID) 276 protected bool IncrementFolderVersion(string folderID)
306 { 277 {
307// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); 278// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
308// Util.PrintCallStack(); 279// Util.PrintCallStack();