aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.SQLite
diff options
context:
space:
mode:
authorSean Dague2008-03-11 21:23:06 +0000
committerSean Dague2008-03-11 21:23:06 +0000
commit0159aa7048e040e53d89c227169f7d86e7cf149a (patch)
tree18fd04c84c38f777f2d6ed002b403f7354475576 /OpenSim/Framework/Data.SQLite
parentadded early readme (diff)
downloadopensim-SC_OLD-0159aa7048e040e53d89c227169f7d86e7cf149a.zip
opensim-SC_OLD-0159aa7048e040e53d89c227169f7d86e7cf149a.tar.gz
opensim-SC_OLD-0159aa7048e040e53d89c227169f7d86e7cf149a.tar.bz2
opensim-SC_OLD-0159aa7048e040e53d89c227169f7d86e7cf149a.tar.xz
get rid of artificial InventoryLock object in favor of
locking on the DataSet. This doesn't change any functionality and leaves us with one less object.
Diffstat (limited to 'OpenSim/Framework/Data.SQLite')
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs31
1 files changed, 13 insertions, 18 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index 566880b..8ecdc04 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -48,11 +48,6 @@ namespace OpenSim.Framework.Data.SQLite
48 private SqliteDataAdapter invFoldersDa; 48 private SqliteDataAdapter invFoldersDa;
49 49
50 /// <summary> 50 /// <summary>
51 /// used to manage concurrent access tothe sqlite database files. Only one thread may open, read, write at a time.
52 /// </summary>
53 private object InventoryLock = new object();
54
55 /// <summary>
56 /// Initialises the interface 51 /// Initialises the interface
57 /// </summary> 52 /// </summary>
58 public void Initialise() 53 public void Initialise()
@@ -131,7 +126,7 @@ namespace OpenSim.Framework.Data.SQLite
131 126
132 private void addFolder(InventoryFolderBase folder) 127 private void addFolder(InventoryFolderBase folder)
133 { 128 {
134 lock (InventoryLock) 129 lock (ds)
135 { 130 {
136 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 131 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
137 132
@@ -153,7 +148,7 @@ namespace OpenSim.Framework.Data.SQLite
153 148
154 private void moveFolder(InventoryFolderBase folder) 149 private void moveFolder(InventoryFolderBase folder)
155 { 150 {
156 lock (InventoryLock) 151 lock (ds)
157 { 152 {
158 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 153 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
159 154
@@ -175,7 +170,7 @@ namespace OpenSim.Framework.Data.SQLite
175 170
176 private void addItem(InventoryItemBase item) 171 private void addItem(InventoryItemBase item)
177 { 172 {
178 lock (InventoryLock) 173 lock (ds)
179 { 174 {
180 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 175 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
181 176
@@ -238,7 +233,7 @@ namespace OpenSim.Framework.Data.SQLite
238 /// <returns>A List of InventoryItemBase items</returns> 233 /// <returns>A List of InventoryItemBase items</returns>
239 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 234 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
240 { 235 {
241 lock (InventoryLock) 236 lock (ds)
242 { 237 {
243 List<InventoryItemBase> retval = new List<InventoryItemBase>(); 238 List<InventoryItemBase> retval = new List<InventoryItemBase>();
244 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 239 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
@@ -266,7 +261,7 @@ namespace OpenSim.Framework.Data.SQLite
266 // see InventoryItemBase.getUserRootFolder 261 // see InventoryItemBase.getUserRootFolder
267 public InventoryFolderBase getUserRootFolder(LLUUID user) 262 public InventoryFolderBase getUserRootFolder(LLUUID user)
268 { 263 {
269 lock (InventoryLock) 264 lock (ds)
270 { 265 {
271 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 266 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
272 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 267 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
@@ -299,7 +294,7 @@ namespace OpenSim.Framework.Data.SQLite
299 /// <param name="parentID">ID of parent</param> 294 /// <param name="parentID">ID of parent</param>
300 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) 295 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
301 { 296 {
302 lock (InventoryLock) 297 lock (ds)
303 { 298 {
304 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 299 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
305 string selectExp = "parentID = '" + Util.ToRawUuidString(parentID) + "'"; 300 string selectExp = "parentID = '" + Util.ToRawUuidString(parentID) + "'";
@@ -346,7 +341,7 @@ namespace OpenSim.Framework.Data.SQLite
346 /// <returns>A class containing item information</returns> 341 /// <returns>A class containing item information</returns>
347 public InventoryItemBase getInventoryItem(LLUUID item) 342 public InventoryItemBase getInventoryItem(LLUUID item)
348 { 343 {
349 lock (InventoryLock) 344 lock (ds)
350 { 345 {
351 DataRow row = ds.Tables["inventoryitems"].Rows.Find(Util.ToRawUuidString(item)); 346 DataRow row = ds.Tables["inventoryitems"].Rows.Find(Util.ToRawUuidString(item));
352 if (row != null) 347 if (row != null)
@@ -372,7 +367,7 @@ namespace OpenSim.Framework.Data.SQLite
372 // better to leave multi region at this point. It does mean 367 // better to leave multi region at this point. It does mean
373 // that you don't get to see system textures why creating 368 // that you don't get to see system textures why creating
374 // clothes and the like. :( 369 // clothes and the like. :(
375 lock (InventoryLock) 370 lock (ds)
376 { 371 {
377 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(Util.ToRawUuidString(folder)); 372 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(Util.ToRawUuidString(folder));
378 if (row != null) 373 if (row != null)
@@ -410,7 +405,7 @@ namespace OpenSim.Framework.Data.SQLite
410 /// <param name="item"></param> 405 /// <param name="item"></param>
411 public void deleteInventoryItem(LLUUID itemID) 406 public void deleteInventoryItem(LLUUID itemID)
412 { 407 {
413 lock (InventoryLock) 408 lock (ds)
414 { 409 {
415 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 410 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
416 411
@@ -473,7 +468,7 @@ namespace OpenSim.Framework.Data.SQLite
473 /// <param name="item"></param> 468 /// <param name="item"></param>
474 public void deleteInventoryFolder(LLUUID folderID) 469 public void deleteInventoryFolder(LLUUID folderID)
475 { 470 {
476 lock (InventoryLock) 471 lock (ds)
477 { 472 {
478 List<InventoryFolderBase> subFolders = getFolderHierarchy(Util.ToRawUuidString(folderID)); 473 List<InventoryFolderBase> subFolders = getFolderHierarchy(Util.ToRawUuidString(folderID));
479 474
@@ -550,7 +545,7 @@ namespace OpenSim.Framework.Data.SQLite
550 545
551 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) 546 private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
552 { 547 {
553 lock (InventoryLock) 548 lock (ds)
554 { 549 {
555 da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]); 550 da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]);
556 da.InsertCommand.Connection = conn; 551 da.InsertCommand.Connection = conn;
@@ -567,7 +562,7 @@ namespace OpenSim.Framework.Data.SQLite
567 562
568 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn) 563 private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
569 { 564 {
570 lock (InventoryLock) 565 lock (ds)
571 { 566 {
572 da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]); 567 da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]);
573 da.InsertCommand.Connection = conn; 568 da.InsertCommand.Connection = conn;
@@ -618,7 +613,7 @@ namespace OpenSim.Framework.Data.SQLite
618 613
619 private void InitDB(SqliteConnection conn) 614 private void InitDB(SqliteConnection conn)
620 { 615 {
621 lock (InventoryLock) 616 lock (ds)
622 { 617 {
623 string createInventoryItems = defineTable(createInventoryItemsTable()); 618 string createInventoryItems = defineTable(createInventoryItemsTable());
624 string createInventoryFolders = defineTable(createInventoryFoldersTable()); 619 string createInventoryFolders = defineTable(createInventoryFoldersTable());