aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Storage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-05 22:48:36 +0000
committerJustin Clarke Casey2008-01-05 22:48:36 +0000
commit70361bceb8e9ca99ed950570831ac40af6f63ad0 (patch)
treeb5d6c1ffb0c0922137f603c2a4ca4ed3ea6bb600 /OpenSim/Region/Storage
parent* Hiding CompletePingChecks and UseCircuitCode messages.. as the packets ar... (diff)
downloadopensim-SC_OLD-70361bceb8e9ca99ed950570831ac40af6f63ad0.zip
opensim-SC_OLD-70361bceb8e9ca99ed950570831ac40af6f63ad0.tar.gz
opensim-SC_OLD-70361bceb8e9ca99ed950570831ac40af6f63ad0.tar.bz2
opensim-SC_OLD-70361bceb8e9ca99ed950570831ac40af6f63ad0.tar.xz
Persistent prim inventory phase 3. Now retrieving prim item data from persistent store, but this doesn't yet show up for the client. Still no user functionality and not
enabled in normal code.
Diffstat (limited to 'OpenSim/Region/Storage')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs92
1 files changed, 67 insertions, 25 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 2de7e25..f9ab0c5 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -121,6 +121,7 @@ namespace OpenSim.DataStore.MonoSqlite
121 { 121 {
122 ds.Tables.Add(createItemsTable()); 122 ds.Tables.Add(createItemsTable());
123 setupItemsCommands(itemsDa, conn); 123 setupItemsCommands(itemsDa, conn);
124 itemsDa.Fill(ds.Tables["primitems"]);
124 } 125 }
125 126
126 ds.Tables.Add(createTerrainTable()); 127 ds.Tables.Add(createTerrainTable());
@@ -265,12 +266,14 @@ namespace OpenSim.DataStore.MonoSqlite
265 { 266 {
266 try 267 try
267 { 268 {
269 SceneObjectPart prim = null;
270
268 string uuid = (string) primRow["UUID"]; 271 string uuid = (string) primRow["UUID"];
269 string objID = (string) primRow["SceneGroupID"]; 272 string objID = (string) primRow["SceneGroupID"];
270 if (uuid == objID) //is new SceneObjectGroup ? 273 if (uuid == objID) //is new SceneObjectGroup ?
271 { 274 {
272 SceneObjectGroup group = new SceneObjectGroup(); 275 SceneObjectGroup group = new SceneObjectGroup();
273 SceneObjectPart prim = buildPrim(primRow); 276 prim = buildPrim(primRow);
274 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); 277 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
275 if (shapeRow != null) 278 if (shapeRow != null)
276 { 279 {
@@ -290,7 +293,7 @@ namespace OpenSim.DataStore.MonoSqlite
290 } 293 }
291 else 294 else
292 { 295 {
293 SceneObjectPart prim = buildPrim(primRow); 296 prim = buildPrim(primRow);
294 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); 297 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
295 if (shapeRow != null) 298 if (shapeRow != null)
296 { 299 {
@@ -305,8 +308,10 @@ namespace OpenSim.DataStore.MonoSqlite
305 createdObjects[new LLUUID(objID)].AddPart(prim); 308 createdObjects[new LLUUID(objID)].AddPart(prim);
306 } 309 }
307 310
308 // Add inventory restore code here, probably in a separate method. 311 if (persistPrimInventories)
309 312 {
313 LoadItems(prim);
314 }
310 } 315 }
311 catch (Exception e) 316 catch (Exception e)
312 { 317 {
@@ -326,25 +331,28 @@ namespace OpenSim.DataStore.MonoSqlite
326 /// Load in a prim's persisted inventory. 331 /// Load in a prim's persisted inventory.
327 /// </summary> 332 /// </summary>
328 /// <param name="prim"></param> 333 /// <param name="prim"></param>
329 /* 334 private void LoadItems(SceneObjectPart prim)
330 private void LoadPrimInventory(SceneObjectPart prim)
331 { 335 {
332 String sql = String.Format("primID = '{0}'", primID); 336 MainLog.Instance.Verbose("DATASTORE", "Loading inventory for {0}, {1}", prim.Name, prim.UUID);
337
338 DataTable dbItems = ds.Tables["primitems"];
339
340 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
333 DataRow[] dbItemRows = dbItems.Select(sql); 341 DataRow[] dbItemRows = dbItems.Select(sql);
334 342
335 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); 343 IDictionary<LLUUID, SceneObjectPart.TaskInventoryItem> inventory
336 if (shapeRow != null) 344 = new Dictionary<LLUUID, SceneObjectPart.TaskInventoryItem>();
337 { 345
338 prim.Shape = buildShape(shapeRow); 346 foreach (DataRow row in dbItemRows)
339 } 347 {
340 else 348 SceneObjectPart.TaskInventoryItem item = buildItem(row);
341 { 349 inventory.Add(item.item_id, item);
342 MainLog.Instance.Notice( 350
343 "No shape found for prim in storage, so setting default box shape"); 351 MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id);
344 prim.Shape = PrimitiveBaseShape.Default; 352 }
345 } 353
354 prim.TaskInventory = inventory;
346 } 355 }
347 */
348 356
349 public void StoreTerrain(double[,] ter, LLUUID regionID) 357 public void StoreTerrain(double[,] ter, LLUUID regionID)
350 { 358 {
@@ -699,11 +707,11 @@ namespace OpenSim.DataStore.MonoSqlite
699 createCol(items, "lastOwnerID", typeof (String)); 707 createCol(items, "lastOwnerID", typeof (String));
700 createCol(items, "groupID", typeof (String)); 708 createCol(items, "groupID", typeof (String));
701 709
702 createCol(items, "nextPermissions", typeof (Int32)); 710 createCol(items, "nextPermissions", typeof (UInt32));
703 createCol(items, "currentPermissions", typeof (Int32)); 711 createCol(items, "currentPermissions", typeof (UInt32));
704 createCol(items, "basePermissions", typeof (Int32)); 712 createCol(items, "basePermissions", typeof (UInt32));
705 createCol(items, "everyonePermissions", typeof (Int32)); 713 createCol(items, "everyonePermissions", typeof (UInt32));
706 createCol(items, "groupPermissions", typeof (Int32)); 714 createCol(items, "groupPermissions", typeof (UInt32));
707 715
708 items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; 716 items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]};
709 717
@@ -877,6 +885,40 @@ namespace OpenSim.DataStore.MonoSqlite
877 885
878 return prim; 886 return prim;
879 } 887 }
888
889 /// <summary>
890 /// Build a prim inventory item from the persisted data.
891 /// </summary>
892 /// <param name="row"></param>
893 /// <returns></returns>
894 private SceneObjectPart.TaskInventoryItem buildItem(DataRow row)
895 {
896 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
897
898 taskItem.item_id = new LLUUID((String)row["itemID"]);
899 taskItem.ParentPartID = new LLUUID((String)row["primID"]);
900 taskItem.asset_id = new LLUUID((String)row["assetID"]);
901 taskItem.parent_id = new LLUUID((String)row["parentFolderID"]);
902
903 taskItem.inv_type = (String)row["invType"];
904 taskItem.type = (String)row["assetType"];
905
906 taskItem.name = (String)row["name"];
907 taskItem.desc = (String)row["description"];
908 taskItem.creation_date = Convert.ToUInt32(row["creationDate"]);
909 taskItem.creator_id = new LLUUID((String)row["creatorID"]);
910 taskItem.owner_id = new LLUUID((String)row["ownerID"]);
911 taskItem.last_owner_id = new LLUUID((String)row["lastOwnerID"]);
912 taskItem.group_id = new LLUUID((String)row["groupID"]);
913
914 taskItem.next_owner_mask = Convert.ToUInt32(row["nextPermissions"]);
915 taskItem.owner_mask = Convert.ToUInt32(row["currentPermissions"]);
916 taskItem.base_mask = Convert.ToUInt32(row["basePermissions"]);
917 taskItem.everyone_mask = Convert.ToUInt32(row["everyonePermissions"]);
918 taskItem.group_mask = Convert.ToUInt32(row["groupPermissions"]);
919
920 return taskItem;
921 }
880 922
881 private LandData buildLandData(DataRow row) 923 private LandData buildLandData(DataRow row)
882 { 924 {
@@ -1223,7 +1265,7 @@ namespace OpenSim.DataStore.MonoSqlite
1223 /// <param name="primID"></param> 1265 /// <param name="primID"></param>
1224 /// <param name="items"></param> 1266 /// <param name="items"></param>
1225 /// <returns></returns> 1267 /// <returns></returns>
1226 private void addPrimInventory(LLUUID primID, Dictionary<LLUUID, SceneObjectPart.TaskInventoryItem> items) 1268 private void addPrimInventory(LLUUID primID, IDictionary<LLUUID, SceneObjectPart.TaskInventoryItem> items)
1227 { 1269 {
1228 MainLog.Instance.Verbose("DATASTORE", "Entered addPrimInventory with prim ID {0}", primID); 1270 MainLog.Instance.Verbose("DATASTORE", "Entered addPrimInventory with prim ID {0}", primID);
1229 1271