aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-16 18:35:34 +0000
committerJustin Clarke Casey2008-01-16 18:35:34 +0000
commit57519b6dba97d7e7a2de71af9d58c93b4750bde8 (patch)
tree9597647ee1e70e50215b90bb116fede1ca7f8e27 /OpenSim/Framework/Data.MySQL
parentFirst part of changing prim's permission flags to use the correct enum (libsl... (diff)
downloadopensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.zip
opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.gz
opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.bz2
opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.xz
* Store task inventory when an object is taken into agent inventory
* This means that you can take an object from a region and rez it somewhere else, with its inventory intact. * As for earlier, at this stage only scripts can be placed in inventory * This isn't an efficient implementation, a better one will probably need to come along soonish
Diffstat (limited to 'OpenSim/Framework/Data.MySQL')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs97
1 files changed, 54 insertions, 43 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index 26985b3..183a2f9 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -163,6 +163,8 @@ namespace OpenSim.Framework.Data.MySQL
163 163
164 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 164 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
165 { 165 {
166 MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
167
166 DataTable prims = m_primTable; 168 DataTable prims = m_primTable;
167 DataTable shapes = m_shapeTable; 169 DataTable shapes = m_shapeTable;
168 DataTable items = m_itemsTable; 170 DataTable items = m_itemsTable;
@@ -187,9 +189,9 @@ namespace OpenSim.Framework.Data.MySQL
187 String sql = String.Format("primID = '{0}'", uuid); 189 String sql = String.Format("primID = '{0}'", uuid);
188 DataRow[] itemRows = items.Select(sql); 190 DataRow[] itemRows = items.Select(sql);
189 191
190 foreach (DataRow itemsRow in itemRows) 192 foreach (DataRow itemRow in itemRows)
191 { 193 {
192 shapeRow.Delete(); 194 itemRow.Delete();
193 } 195 }
194 } 196 }
195 197
@@ -307,7 +309,7 @@ namespace OpenSim.Framework.Data.MySQL
307 TaskInventoryItem item = buildItem(row); 309 TaskInventoryItem item = buildItem(row);
308 inventory.Add(item); 310 inventory.Add(item);
309 311
310 MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); 312 MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID);
311 } 313 }
312 314
313 prim.AddInventoryItems(inventory); 315 prim.AddInventoryItems(inventory);
@@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.MySQL
316 // every item). This data should really be stored in the prim table itself. 318 // every item). This data should really be stored in the prim table itself.
317 if (dbItemRows.Length > 0) 319 if (dbItemRows.Length > 0)
318 { 320 {
319 prim.FolderID = inventory[0].parent_id; 321 prim.FolderID = inventory[0].ParentID;
320 } 322 }
321 } 323 }
322 324
@@ -853,27 +855,27 @@ namespace OpenSim.Framework.Data.MySQL
853 { 855 {
854 TaskInventoryItem taskItem = new TaskInventoryItem(); 856 TaskInventoryItem taskItem = new TaskInventoryItem();
855 857
856 taskItem.item_id = new LLUUID((String)row["itemID"]); 858 taskItem.ItemID = new LLUUID((String)row["itemID"]);
857 taskItem.ParentPartID = new LLUUID((String)row["primID"]); 859 taskItem.ParentPartID = new LLUUID((String)row["primID"]);
858 taskItem.asset_id = new LLUUID((String)row["assetID"]); 860 taskItem.AssetID = new LLUUID((String)row["assetID"]);
859 taskItem.parent_id = new LLUUID((String)row["parentFolderID"]); 861 taskItem.ParentID = new LLUUID((String)row["parentFolderID"]);
860 862
861 taskItem.inv_type = Convert.ToInt32(row["invType"]); 863 taskItem.InvType = Convert.ToInt32(row["invType"]);
862 taskItem.type = Convert.ToInt32(row["assetType"]); 864 taskItem.Type = Convert.ToInt32(row["assetType"]);
863 865
864 taskItem.name = (String)row["name"]; 866 taskItem.Name = (String)row["name"];
865 taskItem.desc = (String)row["description"]; 867 taskItem.Description = (String)row["description"];
866 taskItem.creation_date = Convert.ToUInt32(row["creationDate"]); 868 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
867 taskItem.creator_id = new LLUUID((String)row["creatorID"]); 869 taskItem.CreatorID = new LLUUID((String)row["creatorID"]);
868 taskItem.owner_id = new LLUUID((String)row["ownerID"]); 870 taskItem.OwnerID = new LLUUID((String)row["ownerID"]);
869 taskItem.last_owner_id = new LLUUID((String)row["lastOwnerID"]); 871 taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]);
870 taskItem.group_id = new LLUUID((String)row["groupID"]); 872 taskItem.GroupID = new LLUUID((String)row["groupID"]);
871 873
872 taskItem.next_owner_mask = Convert.ToUInt32(row["nextPermissions"]); 874 taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]);
873 taskItem.owner_mask = Convert.ToUInt32(row["currentPermissions"]); 875 taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]);
874 taskItem.base_mask = Convert.ToUInt32(row["basePermissions"]); 876 taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]);
875 taskItem.everyone_mask = Convert.ToUInt32(row["everyonePermissions"]); 877 taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]);
876 taskItem.group_mask = Convert.ToUInt32(row["groupPermissions"]); 878 taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]);
877 879
878 return taskItem; 880 return taskItem;
879 } 881 }
@@ -1023,26 +1025,26 @@ namespace OpenSim.Framework.Data.MySQL
1023 1025
1024 private void fillItemRow(DataRow row, TaskInventoryItem taskItem) 1026 private void fillItemRow(DataRow row, TaskInventoryItem taskItem)
1025 { 1027 {
1026 row["itemID"] = taskItem.item_id; 1028 row["itemID"] = taskItem.ItemID;
1027 row["primID"] = taskItem.ParentPartID; 1029 row["primID"] = taskItem.ParentPartID;
1028 row["assetID"] = taskItem.asset_id; 1030 row["assetID"] = taskItem.AssetID;
1029 row["parentFolderID"] = taskItem.parent_id; 1031 row["parentFolderID"] = taskItem.ParentID;
1030 1032
1031 row["invType"] = taskItem.inv_type; 1033 row["invType"] = taskItem.InvType;
1032 row["assetType"] = taskItem.type; 1034 row["assetType"] = taskItem.Type;
1033 1035
1034 row["name"] = taskItem.name; 1036 row["name"] = taskItem.Name;
1035 row["description"] = taskItem.desc; 1037 row["description"] = taskItem.Description;
1036 row["creationDate"] = taskItem.creation_date; 1038 row["creationDate"] = taskItem.CreationDate;
1037 row["creatorID"] = taskItem.creator_id; 1039 row["creatorID"] = taskItem.CreatorID;
1038 row["ownerID"] = taskItem.owner_id; 1040 row["ownerID"] = taskItem.OwnerID;
1039 row["lastOwnerID"] = taskItem.last_owner_id; 1041 row["lastOwnerID"] = taskItem.LastOwnerID;
1040 row["groupID"] = taskItem.group_id; 1042 row["groupID"] = taskItem.GroupID;
1041 row["nextPermissions"] = taskItem.next_owner_mask; 1043 row["nextPermissions"] = taskItem.NextOwnerMask;
1042 row["currentPermissions"] = taskItem.owner_mask; 1044 row["currentPermissions"] = taskItem.OwnerMask;
1043 row["basePermissions"] = taskItem.base_mask; 1045 row["basePermissions"] = taskItem.BaseMask;
1044 row["everyonePermissions"] = taskItem.everyone_mask; 1046 row["everyonePermissions"] = taskItem.EveryoneMask;
1045 row["groupPermissions"] = taskItem.group_mask; 1047 row["groupPermissions"] = taskItem.GroupMask;
1046 } 1048 }
1047 1049
1048 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 1050 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
@@ -1216,11 +1218,15 @@ namespace OpenSim.Framework.Data.MySQL
1216 1218
1217 // Build structures for manipulation purposes 1219 // Build structures for manipulation purposes
1218 IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>(); 1220 IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>();
1219 ICollection<TaskInventoryItem> itemsToAdd 1221 ICollection<TaskInventoryItem> itemsToAdd = new List<TaskInventoryItem>();
1220 = new List<TaskInventoryItem>();
1221 1222
1222 foreach (DataRow row in dbItemRows) 1223 foreach (DataRow row in dbItemRows)
1223 { 1224 {
1225 MainLog.Instance.Verbose(
1226 "DATASTORE",
1227 "Found item {0}, {1} in prim id {2}",
1228 row["name"], row["itemID"], primID);
1229
1224 dbItemsToRemove.Add((String)row["itemID"], row); 1230 dbItemsToRemove.Add((String)row["itemID"], row);
1225 } 1231 }
1226 1232
@@ -1232,6 +1238,11 @@ namespace OpenSim.Framework.Data.MySQL
1232 1238
1233 if (dbItemsToRemove.ContainsKey(rawItemId)) 1239 if (dbItemsToRemove.ContainsKey(rawItemId))
1234 { 1240 {
1241 MainLog.Instance.Verbose(
1242 "DATASTORE",
1243 "Discarding item {0}, {1} from remove candidates for prim id {2}",
1244 items[itemId].Name, rawItemId, primID);
1245
1235 dbItemsToRemove.Remove(rawItemId); 1246 dbItemsToRemove.Remove(rawItemId);
1236 } 1247 }
1237 else 1248 else
@@ -1256,8 +1267,8 @@ namespace OpenSim.Framework.Data.MySQL
1256 { 1267 {
1257 MainLog.Instance.Verbose( 1268 MainLog.Instance.Verbose(
1258 "DATASTORE", 1269 "DATASTORE",
1259 "Adding item {0}, {1} to prim ID {1}", 1270 "Adding item {0}, {1} to prim ID {2}",
1260 newItem.name, newItem.item_id, newItem.ParentPartID); 1271 newItem.Name, newItem.ItemID, newItem.ParentPartID);
1261 1272
1262 DataRow newItemRow = dbItems.NewRow(); 1273 DataRow newItemRow = dbItems.NewRow();
1263 fillItemRow(newItemRow, newItem); 1274 fillItemRow(newItemRow, newItem);