diff options
author | Justin Clark-Casey (justincc) | 2012-11-15 04:01:30 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-15 04:01:30 +0000 |
commit | 350cd58e5e52b88651035bcba19010807bff7870 (patch) | |
tree | 46363304a9196e43729241cd0a88a4aefba04bad /OpenSim/Data/SQLite | |
parent | Improve inventory folder version updating for mssql database plugin. (diff) | |
download | opensim-SC-350cd58e5e52b88651035bcba19010807bff7870.zip opensim-SC-350cd58e5e52b88651035bcba19010807bff7870.tar.gz opensim-SC-350cd58e5e52b88651035bcba19010807bff7870.tar.bz2 opensim-SC-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/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 42 |
1 files changed, 10 insertions, 32 deletions
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(); |