aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-04 17:14:12 +0100
committerJustin Clark-Casey (justincc)2010-06-04 18:02:30 +0100
commit8eb70f9719585f26f4dc610b383d546bda091655 (patch)
treef58c4ccd06a5f57985869f4679e3b208f59db912 /OpenSim/Data/SQLite
parentMerge remote branch 'origin/0.6.9' into 0.6.9-post-fixes (diff)
downloadopensim-SC-8eb70f9719585f26f4dc610b383d546bda091655.zip
opensim-SC-8eb70f9719585f26f4dc610b383d546bda091655.tar.gz
opensim-SC-8eb70f9719585f26f4dc610b383d546bda091655.tar.bz2
opensim-SC-8eb70f9719585f26f4dc610b383d546bda091655.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/Data/SQLite')
-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 fe6e919..4313db8 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!
@@ -425,7 +434,7 @@ namespace OpenSim.Data.SQLite
425 lock (ds) 434 lock (ds)
426 { 435 {
427 DataRow[] primsForRegion = prims.Select(byRegion); 436 DataRow[] primsForRegion = prims.Select(byRegion);
428 m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 437// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
429 438
430 // First, create all groups 439 // First, create all groups
431 foreach (DataRow primRow in primsForRegion) 440 foreach (DataRow primRow in primsForRegion)
@@ -447,8 +456,8 @@ namespace OpenSim.Data.SQLite
447 } 456 }
448 else 457 else
449 { 458 {
450 m_log.Info( 459 m_log.Warn(
451 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 460 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
452 prim.Shape = PrimitiveBaseShape.Default; 461 prim.Shape = PrimitiveBaseShape.Default;
453 } 462 }
454 463
@@ -460,11 +469,11 @@ namespace OpenSim.Data.SQLite
460 } 469 }
461 catch (Exception e) 470 catch (Exception e)
462 { 471 {
463 m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); 472 m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
464 m_log.Info("[REGION DB]: " + e.ToString()); 473 m_log.Error("[SQLITE REGION DB]: ", e);
465 foreach (DataColumn col in prims.Columns) 474 foreach (DataColumn col in prims.Columns)
466 { 475 {
467 m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); 476 m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
468 } 477 }
469 } 478 }
470 } 479 }
@@ -489,7 +498,7 @@ namespace OpenSim.Data.SQLite
489 else 498 else
490 { 499 {
491 m_log.Warn( 500 m_log.Warn(
492 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 501 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
493 prim.Shape = PrimitiveBaseShape.Default; 502 prim.Shape = PrimitiveBaseShape.Default;
494 } 503 }
495 504
@@ -499,11 +508,11 @@ namespace OpenSim.Data.SQLite
499 } 508 }
500 catch (Exception e) 509 catch (Exception e)
501 { 510 {
502 m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); 511 m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
503 m_log.Info("[REGION DB]: " + e.ToString()); 512 m_log.Error("[SQLITE REGION DB]: ", e);
504 foreach (DataColumn col in prims.Columns) 513 foreach (DataColumn col in prims.Columns)
505 { 514 {
506 m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); 515 m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
507 } 516 }
508 } 517 }
509 } 518 }
@@ -516,20 +525,23 @@ namespace OpenSim.Data.SQLite
516 /// </summary> 525 /// </summary>
517 /// <param name="prim">the prim</param> 526 /// <param name="prim">the prim</param>
518 private void LoadItems(SceneObjectPart prim) 527 private void LoadItems(SceneObjectPart prim)
519 { 528 {
520 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 529// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
521 530
522 DataTable dbItems = ds.Tables["primitems"]; 531 DataTable dbItems = ds.Tables["primitems"];
523 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 532 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
524 DataRow[] dbItemRows = dbItems.Select(sql); 533 DataRow[] dbItemRows = dbItems.Select(sql);
525 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 534 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
526 535
536// m_log.DebugFormat(
537// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
538
527 foreach (DataRow row in dbItemRows) 539 foreach (DataRow row in dbItemRows)
528 { 540 {
529 TaskInventoryItem item = buildItem(row); 541 TaskInventoryItem item = buildItem(row);
530 inventory.Add(item); 542 inventory.Add(item);
531 543
532 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 544// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
533 } 545 }
534 546
535 prim.Inventory.RestoreInventoryItems(inventory); 547 prim.Inventory.RestoreInventoryItems(inventory);
@@ -565,7 +577,7 @@ namespace OpenSim.Data.SQLite
565 577
566 // the following is an work around for .NET. The perf 578 // the following is an work around for .NET. The perf
567 // issues associated with it aren't as bad as you think. 579 // issues associated with it aren't as bad as you think.
568 m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); 580 m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
569 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + 581 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
570 " values(:RegionUUID, :Revision, :Heightfield)"; 582 " values(:RegionUUID, :Revision, :Heightfield)";
571 583
@@ -621,11 +633,11 @@ namespace OpenSim.Data.SQLite
621 } 633 }
622 else 634 else
623 { 635 {
624 m_log.Info("[REGION DB]: No terrain found for region"); 636 m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
625 return null; 637 return null;
626 } 638 }
627 639
628 m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); 640 m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
629 } 641 }
630 } 642 }
631 return terret; 643 return terret;
@@ -1407,7 +1419,7 @@ namespace OpenSim.Data.SQLite
1407 } 1419 }
1408 catch (InvalidCastException) 1420 catch (InvalidCastException)
1409 { 1421 {
1410 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); 1422 m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
1411 newData.UserLocation = Vector3.Zero; 1423 newData.UserLocation = Vector3.Zero;
1412 newData.UserLookAt = Vector3.Zero; 1424 newData.UserLookAt = Vector3.Zero;
1413 } 1425 }
@@ -1914,7 +1926,7 @@ namespace OpenSim.Data.SQLite
1914 /// <param name="items"></param> 1926 /// <param name="items"></param>
1915 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 1927 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
1916 { 1928 {
1917 //m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); 1929// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
1918 1930
1919 DataTable dbItems = ds.Tables["primitems"]; 1931 DataTable dbItems = ds.Tables["primitems"];
1920 1932