From f6251ce810e0bebe68d08a8e4b20a9dfc3fe1af6 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sat, 15 Aug 2009 06:08:36 -0500 Subject: * Modified SQLite/SQLiteInventoryStore.cs to not throw if the inventory row does not exist, to match the mysql behavior. * Modified SQLite/SQLiteRegionData.cs to only persist temporary items following the same rules mysql uses. * Added another ignore to the inventory test that was missing. * Added a few more ignores to the RegionTest that the first version of my test were missing. * Added ignoring the root Folder ID, which is set by the inventory system. * Added several improvements to the PropertyCompareConstraint: Protection against infinite loops, added IComparable (for UUID) and moved IComparable before the property matching. * Fixed a bug where I was saving the inside of the ignore expression instead of the outside of it. --- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 3 ++- OpenSim/Data/SQLite/SQLiteRegionData.cs | 29 ++++++++++++----------------- 2 files changed, 14 insertions(+), 18 deletions(-) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 97c40ba..557dec7 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -301,7 +301,8 @@ namespace OpenSim.Data.SQLite DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString()); - inventoryRow["version"] = (int)inventoryRow["version"] + 1; + if(inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either. + inventoryRow["version"] = (int)inventoryRow["version"] + 1; invFoldersDa.Update(ds, "inventoryfolders"); } diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index d2548c2..0259ac5 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -307,26 +307,21 @@ namespace OpenSim.Data.SQLite /// the region UUID public void StoreObject(SceneObjectGroup obj, UUID regionUUID) { + uint flags = obj.RootPart.GetEffectiveObjectFlags(); + + // Eligibility check + // + if ((flags & (uint)PrimFlags.Temporary) != 0) + return; + if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) + return; + lock (ds) { foreach (SceneObjectPart prim in obj.Children.Values) { - if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0 - && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0) - { - m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); - addPrim(prim, obj.UUID, regionUUID); - } - else if (prim.Stopped) - { - //m_log.Info("[DATASTORE]: " + - //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); - //addPrim(prim, obj.UUID.ToString(), regionUUID.ToString()); - } - else - { - // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); - } + m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); + addPrim(prim, obj.UUID, regionUUID); } } @@ -1130,7 +1125,7 @@ namespace OpenSim.Data.SQLite // explicit conversion of integers is required, which sort // of sucks. No idea if there is a shortcut here or not. prim.CreationDate = Convert.ToInt32(row["CreationDate"]); - prim.Name = (String) row["Name"]; + prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; // various text fields prim.Text = (String) row["Text"]; prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), -- cgit v1.1 From d2e5380cb2325ad42917c528c52a8ad42ec0176f Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sat, 15 Aug 2009 10:54:48 -0500 Subject: * Fixed MySQL/MySQLAssetData.cs to properly do updates * Removed an extra parameter from MySQL/MySQLInventoryData.cs * Fixed a bug in SQLite/SQLiteAssetData.cs that was causing a NRE when updating an asset. * Improved the BasicAssetTest.cs to do full create/update/get testing * Improved the BasicInventoryTest.cs to do full create/update/get of both a folder and an item * Moved the null ref tests to the start of the PropertyCompareConstraint.cs, so that it doesn't throw when passing in a null item --- OpenSim/Data/SQLite/SQLiteAssetData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index b09c1c9..72af7a0 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -183,7 +183,7 @@ namespace OpenSim.Data.SQLite int assetLength = (asset.Data != null) ? asset.Data.Length : 0; m_log.Info("[ASSET DB]: " + - string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", + string.Format("Loaded {5} {4} Asset: [{0}][{3}] \"{1}\":{2} ({6} bytes)", asset.FullID, asset.Name, asset.Description, asset.Type, temporary, local, assetLength)); } -- cgit v1.1 From 82c888fc6c103ec345bf656cd469f4260b678bcb Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 17 Aug 2009 10:29:06 +0900 Subject: Add copyright headers. Formatting cleanup. Fix a compiler warning. --- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 557dec7..e5f7a50 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -301,7 +301,7 @@ namespace OpenSim.Data.SQLite DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString()); - if(inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either. + if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either. inventoryRow["version"] = (int)inventoryRow["version"] + 1; invFoldersDa.Update(ds, "inventoryfolders"); -- cgit v1.1