aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs81
1 files changed, 75 insertions, 6 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index f999a59..1938fe3 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Data.MySQL
118 118
119 m_landAccessListTable = createLandAccessListTable(); 119 m_landAccessListTable = createLandAccessListTable();
120 m_dataSet.Tables.Add(m_landAccessListTable); 120 m_dataSet.Tables.Add(m_landAccessListTable);
121 setupLandCommands(m_landAccessListDataAdapter, m_connection); 121 setupLandAccessCommands(m_landAccessListDataAdapter, m_connection);
122 m_landAccessListDataAdapter.Fill(m_landAccessListTable); 122 m_landAccessListDataAdapter.Fill(m_landAccessListTable);
123 } 123 }
124 } 124 }
@@ -313,15 +313,82 @@ namespace OpenSim.Framework.Data.MySQL
313 313
314 public void RemoveLandObject(LLUUID globalID) 314 public void RemoveLandObject(LLUUID globalID)
315 { 315 {
316 lock (m_dataSet)
317 {
318 using (MySqlCommand cmd = new MySqlCommand("delete from land where UUID=?UUID", m_connection))
319 {
320 cmd.Parameters.Add(new MySqlParameter("?UUID", globalID.ToString()));
321 cmd.ExecuteNonQuery();
322 }
323
324 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection))
325 {
326 cmd.Parameters.Add(new MySqlParameter("?UUID", globalID.ToString()));
327 cmd.ExecuteNonQuery();
328 }
329 }
316 } 330 }
317 331
318 public void StoreLandObject(Land parcel, LLUUID regionUUID) 332 public void StoreLandObject(Land parcel, LLUUID regionUUID)
319 { 333 {
334 lock (m_dataSet)
335 {
336 DataTable land = m_landTable;
337 DataTable landaccesslist = m_landAccessListTable;
338
339 DataRow landRow = land.Rows.Find(parcel.landData.globalID.ToString());
340 if (landRow == null)
341 {
342 landRow = land.NewRow();
343 fillLandRow(landRow, parcel.landData, regionUUID);
344 land.Rows.Add(landRow);
345 }
346 else
347 {
348 fillLandRow(landRow, parcel.landData, regionUUID);
349 }
350
351 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection))
352 {
353 cmd.Parameters.Add(new MySqlParameter("?LandUUID", parcel.landData.globalID.ToString()));
354 cmd.ExecuteNonQuery();
355 }
356
357 foreach (ParcelManager.ParcelAccessEntry entry in parcel.landData.parcelAccessList)
358 {
359 DataRow newAccessRow = landaccesslist.NewRow();
360 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
361 landaccesslist.Rows.Add(newAccessRow);
362 }
363
364 }
365
366 Commit();
320 } 367 }
321 368
322 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 369 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID)
323 { 370 {
324 return new List<LandData>(); 371 List<LandData> landDataForRegion = new List<LandData>();
372 lock (m_dataSet)
373 {
374 DataTable land = m_landTable;
375 DataTable landaccesslist = m_landAccessListTable;
376 string searchExp = "RegionUUID = '" + regionUUID.ToString() + "'";
377 DataRow[] rawDataForRegion = land.Select(searchExp);
378 foreach (DataRow rawDataLand in rawDataForRegion)
379 {
380 LandData newLand = buildLandData(rawDataLand);
381 string accessListSearchExp = "LandUUID = '" + newLand.globalID.ToString() + "'";
382 DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
383 foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
384 {
385 newLand.parcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
386 }
387
388 landDataForRegion.Add(newLand);
389 }
390 }
391 return landDataForRegion;
325 } 392 }
326 393
327 private void DisplayDataSet(DataSet ds, string title) 394 private void DisplayDataSet(DataSet ds, string title)
@@ -371,6 +438,8 @@ namespace OpenSim.Framework.Data.MySQL
371 m_primDataAdapter.Update(m_primTable); 438 m_primDataAdapter.Update(m_primTable);
372 m_shapeDataAdapter.Update(m_shapeTable); 439 m_shapeDataAdapter.Update(m_shapeTable);
373 m_terrainDataAdapter.Update(m_terrainTable); 440 m_terrainDataAdapter.Update(m_terrainTable);
441 m_landDataAdapter.Update(m_landTable);
442 m_landAccessListDataAdapter.Update(m_landAccessListTable);
374 443
375 m_dataSet.AcceptChanges(); 444 m_dataSet.AcceptChanges();
376 } 445 }
@@ -635,7 +704,7 @@ namespace OpenSim.Framework.Data.MySQL
635 newData.landName = (String)row["Name"]; 704 newData.landName = (String)row["Name"];
636 newData.landDesc = (String)row["Description"]; 705 newData.landDesc = (String)row["Description"];
637 newData.ownerID = (String)row["OwnerUUID"]; 706 newData.ownerID = (String)row["OwnerUUID"];
638 newData.isGroupOwned = (Boolean)row["IsGroupOwned"]; 707 newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
639 newData.area = Convert.ToInt32(row["Area"]); 708 newData.area = Convert.ToInt32(row["Area"]);
640 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 709 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
641 newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory 710 newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory
@@ -645,8 +714,8 @@ namespace OpenSim.Framework.Data.MySQL
645 newData.salePrice = Convert.ToInt32(row["SalePrice"]); 714 newData.salePrice = Convert.ToInt32(row["SalePrice"]);
646 newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus 715 newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus
647 newData.landFlags = Convert.ToUInt32(row["LandFlags"]); 716 newData.landFlags = Convert.ToUInt32(row["LandFlags"]);
648 newData.landingType = (Byte)row["LandingType"]; 717 newData.landingType = Convert.ToByte(row["LandingType"]);
649 newData.mediaAutoScale = (Byte)row["MediaAutoScale"]; 718 newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
650 newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]); 719 newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]);
651 newData.mediaURL = (String)row["MediaURL"]; 720 newData.mediaURL = (String)row["MediaURL"];
652 newData.musicURL = (String)row["MusicURL"]; 721 newData.musicURL = (String)row["MusicURL"];
@@ -665,7 +734,7 @@ namespace OpenSim.Framework.Data.MySQL
665 { 734 {
666 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 735 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
667 entry.AgentID = new LLUUID((string)row["AccessUUID"]); 736 entry.AgentID = new LLUUID((string)row["AccessUUID"]);
668 entry.Flags = (ParcelManager.AccessList)row["Flags"]; 737 entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]);
669 entry.Time = new DateTime(); 738 entry.Time = new DateTime();
670 return entry; 739 return entry;
671 } 740 }