aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-04 17:14:12 +0100
committerJustin Clark-Casey (justincc)2010-06-04 17:14:12 +0100
commit55040a84a5e4b84e5dc3d979945a91c35c5820e0 (patch)
tree6dbe515e15a05c583b162c2f19be67fc87e4bb67 /OpenSim
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-55040a84a5e4b84e5dc3d979945a91c35c5820e0.zip
opensim-SC-55040a84a5e4b84e5dc3d979945a91c35c5820e0.tar.gz
opensim-SC-55040a84a5e4b84e5dc3d979945a91c35c5820e0.tar.bz2
opensim-SC-55040a84a5e4b84e5dc3d979945a91c35c5820e0.tar.xz
Fix bug where prim items were not loaded in the new sqlite database handler
This addresses mantis http://opensimulator.org/mantis/view.php?id=4739
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs66
1 files changed, 39 insertions, 27 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 85703dc..81d0ac4 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Data.SQLite
93 93
94 ds = new DataSet("Region"); 94 ds = new DataSet("Region");
95 95
96 m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); 96 m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
97 m_conn = new SqliteConnection(m_connectionString); 97 m_conn = new SqliteConnection(m_connectionString);
98 m_conn.Open(); 98 m_conn.Open();
99 99
@@ -156,7 +156,7 @@ namespace OpenSim.Data.SQLite
156 } 156 }
157 catch (Exception) 157 catch (Exception)
158 { 158 {
159 m_log.Info("[REGION DB]: Caught fill error on prims table"); 159 m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
160 } 160 }
161 161
162 try 162 try
@@ -165,16 +165,25 @@ namespace OpenSim.Data.SQLite
165 } 165 }
166 catch (Exception) 166 catch (Exception)
167 { 167 {
168 m_log.Info("[REGION DB]: Caught fill error on primshapes table"); 168 m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
169 } 169 }
170 170
171 try 171 try
172 { 172 {
173 itemsDa.Fill(ds.Tables["primitems"]);
174 }
175 catch (Exception)
176 {
177 m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
178 }
179
180 try
181 {
173 terrainDa.Fill(ds.Tables["terrain"]); 182 terrainDa.Fill(ds.Tables["terrain"]);
174 } 183 }
175 catch (Exception) 184 catch (Exception)
176 { 185 {
177 m_log.Info("[REGION DB]: Caught fill error on terrain table"); 186 m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
178 } 187 }
179 188
180 try 189 try
@@ -183,7 +192,7 @@ namespace OpenSim.Data.SQLite
183 } 192 }
184 catch (Exception) 193 catch (Exception)
185 { 194 {
186 m_log.Info("[REGION DB]: Caught fill error on land table"); 195 m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
187 } 196 }
188 197
189 try 198 try
@@ -192,7 +201,7 @@ namespace OpenSim.Data.SQLite
192 } 201 }
193 catch (Exception) 202 catch (Exception)
194 { 203 {
195 m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); 204 m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
196 } 205 }
197 206
198 try 207 try
@@ -201,7 +210,7 @@ namespace OpenSim.Data.SQLite
201 } 210 }
202 catch (Exception) 211 catch (Exception)
203 { 212 {
204 m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); 213 m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
205 } 214 }
206 215
207 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! 216 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
@@ -434,7 +443,7 @@ namespace OpenSim.Data.SQLite
434 lock (ds) 443 lock (ds)
435 { 444 {
436 DataRow[] primsForRegion = prims.Select(byRegion); 445 DataRow[] primsForRegion = prims.Select(byRegion);
437 m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 446// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
438 447
439 // First, create all groups 448 // First, create all groups
440 foreach (DataRow primRow in primsForRegion) 449 foreach (DataRow primRow in primsForRegion)
@@ -456,8 +465,8 @@ namespace OpenSim.Data.SQLite
456 } 465 }
457 else 466 else
458 { 467 {
459 m_log.Info( 468 m_log.Warn(
460 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 469 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
461 prim.Shape = PrimitiveBaseShape.Default; 470 prim.Shape = PrimitiveBaseShape.Default;
462 } 471 }
463 472
@@ -469,11 +478,11 @@ namespace OpenSim.Data.SQLite
469 } 478 }
470 catch (Exception e) 479 catch (Exception e)
471 { 480 {
472 m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); 481 m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
473 m_log.Info("[REGION DB]: " + e.ToString()); 482 m_log.Error("[SQLITE REGION DB]: ", e);
474 foreach (DataColumn col in prims.Columns) 483 foreach (DataColumn col in prims.Columns)
475 { 484 {
476 m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); 485 m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
477 } 486 }
478 } 487 }
479 } 488 }
@@ -498,7 +507,7 @@ namespace OpenSim.Data.SQLite
498 else 507 else
499 { 508 {
500 m_log.Warn( 509 m_log.Warn(
501 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 510 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
502 prim.Shape = PrimitiveBaseShape.Default; 511 prim.Shape = PrimitiveBaseShape.Default;
503 } 512 }
504 513
@@ -508,11 +517,11 @@ namespace OpenSim.Data.SQLite
508 } 517 }
509 catch (Exception e) 518 catch (Exception e)
510 { 519 {
511 m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); 520 m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
512 m_log.Info("[REGION DB]: " + e.ToString()); 521 m_log.Error("[SQLITE REGION DB]: ", e);
513 foreach (DataColumn col in prims.Columns) 522 foreach (DataColumn col in prims.Columns)
514 { 523 {
515 m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); 524 m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
516 } 525 }
517 } 526 }
518 } 527 }
@@ -525,20 +534,23 @@ namespace OpenSim.Data.SQLite
525 /// </summary> 534 /// </summary>
526 /// <param name="prim">the prim</param> 535 /// <param name="prim">the prim</param>
527 private void LoadItems(SceneObjectPart prim) 536 private void LoadItems(SceneObjectPart prim)
528 { 537 {
529 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 538// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
530 539
531 DataTable dbItems = ds.Tables["primitems"]; 540 DataTable dbItems = ds.Tables["primitems"];
532 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 541 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
533 DataRow[] dbItemRows = dbItems.Select(sql); 542 DataRow[] dbItemRows = dbItems.Select(sql);
534 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 543 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
535 544
545// m_log.DebugFormat(
546// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
547
536 foreach (DataRow row in dbItemRows) 548 foreach (DataRow row in dbItemRows)
537 { 549 {
538 TaskInventoryItem item = buildItem(row); 550 TaskInventoryItem item = buildItem(row);
539 inventory.Add(item); 551 inventory.Add(item);
540 552
541 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 553// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
542 } 554 }
543 555
544 prim.Inventory.RestoreInventoryItems(inventory); 556 prim.Inventory.RestoreInventoryItems(inventory);
@@ -574,7 +586,7 @@ namespace OpenSim.Data.SQLite
574 586
575 // the following is an work around for .NET. The perf 587 // the following is an work around for .NET. The perf
576 // issues associated with it aren't as bad as you think. 588 // issues associated with it aren't as bad as you think.
577 m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); 589 m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
578 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + 590 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
579 " values(:RegionUUID, :Revision, :Heightfield)"; 591 " values(:RegionUUID, :Revision, :Heightfield)";
580 592
@@ -630,11 +642,11 @@ namespace OpenSim.Data.SQLite
630 } 642 }
631 else 643 else
632 { 644 {
633 m_log.Info("[REGION DB]: No terrain found for region"); 645 m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
634 return null; 646 return null;
635 } 647 }
636 648
637 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); 649 m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
638 } 650 }
639 } 651 }
640 return terret; 652 return terret;
@@ -1417,7 +1429,7 @@ namespace OpenSim.Data.SQLite
1417 } 1429 }
1418 catch (InvalidCastException) 1430 catch (InvalidCastException)
1419 { 1431 {
1420 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); 1432 m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
1421 newData.UserLocation = Vector3.Zero; 1433 newData.UserLocation = Vector3.Zero;
1422 newData.UserLookAt = Vector3.Zero; 1434 newData.UserLookAt = Vector3.Zero;
1423 } 1435 }
@@ -1926,7 +1938,7 @@ namespace OpenSim.Data.SQLite
1926 /// <param name="items"></param> 1938 /// <param name="items"></param>
1927 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1939 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1928 { 1940 {
1929 //m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); 1941// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
1930 1942
1931 DataTable dbItems = ds.Tables["primitems"]; 1943 DataTable dbItems = ds.Tables["primitems"];
1932 1944