aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLXInventoryData.cs47
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs51
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs42
3 files changed, 28 insertions, 112 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();
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();
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
130 } 130 }
131 } 131 }
132 132
133 public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem> 133 public class SqliteItemHandler : SqliteInventoryHandler<XInventoryItem>
134 { 134 {
135 public SqliteItemHandler(string c, string t, string m) : 135 public SqliteItemHandler(string c, string t, string m) :
136 base(c, t, m) 136 base(c, t, m)
@@ -243,37 +243,9 @@ namespace OpenSim.Data.SQLite
243 243
244 return perms; 244 return perms;
245 } 245 }
246
247 private bool IncrementFolderVersion(UUID folderID)
248 {
249 return IncrementFolderVersion(folderID.ToString());
250 }
251
252 private bool IncrementFolderVersion(string folderID)
253 {
254// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
255// Util.PrintCallStack();
256
257 using (SqliteCommand cmd = new SqliteCommand())
258 {
259 cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID";
260 cmd.Parameters.Add(new SqliteParameter(":folderID", folderID));
261
262 try
263 {
264 cmd.ExecuteNonQuery();
265 }
266 catch (Exception)
267 {
268 return false;
269 }
270 }
271
272 return true;
273 }
274 } 246 }
275 247
276 public class SqliteFolderHandler : SQLiteGenericTableHandler<XInventoryFolder> 248 public class SqliteFolderHandler : SqliteInventoryHandler<XInventoryFolder>
277 { 249 {
278 public SqliteFolderHandler(string c, string t, string m) : 250 public SqliteFolderHandler(string c, string t, string m) :
279 base(c, t, m) 251 base(c, t, m)
@@ -315,12 +287,18 @@ namespace OpenSim.Data.SQLite
315 return true; 287 return true;
316 } 288 }
317 289
318 private bool IncrementFolderVersion(UUID folderID) 290 }
291
292 public class SqliteInventoryHandler<T> : SQLiteGenericTableHandler<T> where T: class, new()
293 {
294 public SqliteInventoryHandler(string c, string t, string m) : base(c, t, m) {}
295
296 protected bool IncrementFolderVersion(UUID folderID)
319 { 297 {
320 return IncrementFolderVersion(folderID.ToString()); 298 return IncrementFolderVersion(folderID.ToString());
321 } 299 }
322 300
323 private bool IncrementFolderVersion(string folderID) 301 protected bool IncrementFolderVersion(string folderID)
324 { 302 {
325// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID); 303// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
326// Util.PrintCallStack(); 304// Util.PrintCallStack();