diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 710 |
1 files changed, 477 insertions, 233 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index bb0ab75..e754522 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL | |||
55 | /// <summary> | 55 | /// <summary> |
56 | /// This lock was being used to serialize database operations when the connection was shared, but this has | 56 | /// This lock was being used to serialize database operations when the connection was shared, but this has |
57 | /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead. | 57 | /// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead. |
58 | /// FIXME: However, the locks remain in many places since they are effectively providing a level of | 58 | /// FIXME: However, the locks remain in many places since they are effectively providing a level of |
59 | /// transactionality. This should be replaced by more efficient database transactions which would not require | 59 | /// transactionality. This should be replaced by more efficient database transactions which would not require |
60 | /// unrelated operations to block each other or unrelated operations on the same tables from blocking each | 60 | /// unrelated operations to block each other or unrelated operations on the same tables from blocking each |
61 | /// other. | 61 | /// other. |
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL | |||
76 | Initialise(connectionString); | 76 | Initialise(connectionString); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void Initialise(string connectionString) | 79 | public virtual void Initialise(string connectionString) |
80 | { | 80 | { |
81 | m_connectionString = connectionString; | 81 | m_connectionString = connectionString; |
82 | 82 | ||
@@ -88,6 +88,7 @@ namespace OpenSim.Data.MySQL | |||
88 | // | 88 | // |
89 | Migration m = new Migration(dbcon, Assembly, "RegionStore"); | 89 | Migration m = new Migration(dbcon, Assembly, "RegionStore"); |
90 | m.Update(); | 90 | m.Update(); |
91 | dbcon.Close(); | ||
91 | } | 92 | } |
92 | } | 93 | } |
93 | 94 | ||
@@ -123,7 +124,7 @@ namespace OpenSim.Data.MySQL | |||
123 | 124 | ||
124 | public void Dispose() {} | 125 | public void Dispose() {} |
125 | 126 | ||
126 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 127 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
127 | { | 128 | { |
128 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 129 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
129 | 130 | ||
@@ -167,7 +168,7 @@ namespace OpenSim.Data.MySQL | |||
167 | "SitTargetOrientY, SitTargetOrientZ, " + | 168 | "SitTargetOrientY, SitTargetOrientZ, " + |
168 | "RegionUUID, CreatorID, " + | 169 | "RegionUUID, CreatorID, " + |
169 | "OwnerID, GroupID, " + | 170 | "OwnerID, GroupID, " + |
170 | "LastOwnerID, SceneGroupID, " + | 171 | "LastOwnerID, RezzerID, SceneGroupID, " + |
171 | "PayPrice, PayButton1, " + | 172 | "PayPrice, PayButton1, " + |
172 | "PayButton2, PayButton3, " + | 173 | "PayButton2, PayButton3, " + |
173 | "PayButton4, LoopedSound, " + | 174 | "PayButton4, LoopedSound, " + |
@@ -183,10 +184,12 @@ namespace OpenSim.Data.MySQL | |||
183 | "ParticleSystem, ClickAction, Material, " + | 184 | "ParticleSystem, ClickAction, Material, " + |
184 | "CollisionSound, CollisionSoundVolume, " + | 185 | "CollisionSound, CollisionSoundVolume, " + |
185 | "PassTouches, " + | 186 | "PassTouches, " + |
186 | "LinkNumber, MediaURL, AttachedPosX, " + | 187 | "PassCollisions, " + |
187 | "AttachedPosY, AttachedPosZ, KeyframeMotion, " + | 188 | "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " + |
189 | "AttachedPosY, AttachedPosZ, " + | ||
188 | "PhysicsShapeType, Density, GravityModifier, " + | 190 | "PhysicsShapeType, Density, GravityModifier, " + |
189 | "Friction, Restitution, DynAttrs " + | 191 | "Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " + |
192 | "RotationAxisLocks" + | ||
190 | ") values (" + "?UUID, " + | 193 | ") values (" + "?UUID, " + |
191 | "?CreationDate, ?Name, ?Text, " + | 194 | "?CreationDate, ?Name, ?Text, " + |
192 | "?Description, ?SitName, ?TouchName, " + | 195 | "?Description, ?SitName, ?TouchName, " + |
@@ -205,7 +208,7 @@ namespace OpenSim.Data.MySQL | |||
205 | "?SitTargetOrientW, ?SitTargetOrientX, " + | 208 | "?SitTargetOrientW, ?SitTargetOrientX, " + |
206 | "?SitTargetOrientY, ?SitTargetOrientZ, " + | 209 | "?SitTargetOrientY, ?SitTargetOrientZ, " + |
207 | "?RegionUUID, ?CreatorID, ?OwnerID, " + | 210 | "?RegionUUID, ?CreatorID, ?OwnerID, " + |
208 | "?GroupID, ?LastOwnerID, ?SceneGroupID, " + | 211 | "?GroupID, ?LastOwnerID, ?RezzerID, ?SceneGroupID, " + |
209 | "?PayPrice, ?PayButton1, ?PayButton2, " + | 212 | "?PayPrice, ?PayButton1, ?PayButton2, " + |
210 | "?PayButton3, ?PayButton4, ?LoopedSound, " + | 213 | "?PayButton3, ?PayButton4, ?LoopedSound, " + |
211 | "?LoopedSoundGain, ?TextureAnimation, " + | 214 | "?LoopedSoundGain, ?TextureAnimation, " + |
@@ -218,11 +221,12 @@ namespace OpenSim.Data.MySQL | |||
218 | "?SaleType, ?ColorR, ?ColorG, " + | 221 | "?SaleType, ?ColorR, ?ColorG, " + |
219 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 222 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
220 | "?ClickAction, ?Material, ?CollisionSound, " + | 223 | "?ClickAction, ?Material, ?CollisionSound, " + |
221 | "?CollisionSoundVolume, ?PassTouches, " + | 224 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
222 | "?LinkNumber, ?MediaURL, ?AttachedPosX, " + | 225 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " + |
223 | "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + | 226 | "?AttachedPosY, ?AttachedPosZ, " + |
224 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 227 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
225 | "?Friction, ?Restitution, ?DynAttrs)"; | 228 | "?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," + |
229 | "?RotationAxisLocks)"; | ||
226 | 230 | ||
227 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 231 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
228 | 232 | ||
@@ -258,14 +262,15 @@ namespace OpenSim.Data.MySQL | |||
258 | ExecuteNonQuery(cmd); | 262 | ExecuteNonQuery(cmd); |
259 | } | 263 | } |
260 | } | 264 | } |
265 | dbcon.Close(); | ||
261 | } | 266 | } |
262 | } | 267 | } |
263 | } | 268 | } |
264 | 269 | ||
265 | public void RemoveObject(UUID obj, UUID regionUUID) | 270 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
266 | { | 271 | { |
267 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 272 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
268 | 273 | ||
269 | List<UUID> uuids = new List<UUID>(); | 274 | List<UUID> uuids = new List<UUID>(); |
270 | 275 | ||
271 | // Formerly, this used to check the region UUID. | 276 | // Formerly, this used to check the region UUID. |
@@ -297,6 +302,7 @@ namespace OpenSim.Data.MySQL | |||
297 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; | 302 | cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; |
298 | ExecuteNonQuery(cmd); | 303 | ExecuteNonQuery(cmd); |
299 | } | 304 | } |
305 | dbcon.Close(); | ||
300 | } | 306 | } |
301 | } | 307 | } |
302 | 308 | ||
@@ -317,7 +323,8 @@ namespace OpenSim.Data.MySQL | |||
317 | /// <param name="uuid">the Item UUID</param> | 323 | /// <param name="uuid">the Item UUID</param> |
318 | private void RemoveItems(UUID uuid) | 324 | private void RemoveItems(UUID uuid) |
319 | { | 325 | { |
320 | lock (m_dbLock) | 326 | // locked by caller |
327 | // lock (m_dbLock) | ||
321 | { | 328 | { |
322 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 329 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
323 | { | 330 | { |
@@ -330,6 +337,7 @@ namespace OpenSim.Data.MySQL | |||
330 | 337 | ||
331 | ExecuteNonQuery(cmd); | 338 | ExecuteNonQuery(cmd); |
332 | } | 339 | } |
340 | dbcon.Close(); | ||
333 | } | 341 | } |
334 | } | 342 | } |
335 | } | 343 | } |
@@ -368,6 +376,7 @@ namespace OpenSim.Data.MySQL | |||
368 | 376 | ||
369 | ExecuteNonQuery(cmd); | 377 | ExecuteNonQuery(cmd); |
370 | } | 378 | } |
379 | dbcon.Close(); | ||
371 | } | 380 | } |
372 | } | 381 | } |
373 | } | 382 | } |
@@ -407,11 +416,12 @@ namespace OpenSim.Data.MySQL | |||
407 | 416 | ||
408 | ExecuteNonQuery(cmd); | 417 | ExecuteNonQuery(cmd); |
409 | } | 418 | } |
419 | dbcon.Close(); | ||
410 | } | 420 | } |
411 | } | 421 | } |
412 | } | 422 | } |
413 | 423 | ||
414 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 424 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
415 | { | 425 | { |
416 | const int ROWS_PER_QUERY = 5000; | 426 | const int ROWS_PER_QUERY = 5000; |
417 | 427 | ||
@@ -456,6 +466,7 @@ namespace OpenSim.Data.MySQL | |||
456 | } | 466 | } |
457 | } | 467 | } |
458 | } | 468 | } |
469 | dbcon.Close(); | ||
459 | } | 470 | } |
460 | } | 471 | } |
461 | 472 | ||
@@ -505,7 +516,7 @@ namespace OpenSim.Data.MySQL | |||
505 | #region Prim Inventory Loading | 516 | #region Prim Inventory Loading |
506 | 517 | ||
507 | // Instead of attempting to LoadItems on every prim, | 518 | // Instead of attempting to LoadItems on every prim, |
508 | // most of which probably have no items... get a | 519 | // most of which probably have no items... get a |
509 | // list from DB of all prims which have items and | 520 | // list from DB of all prims which have items and |
510 | // LoadItems only on those | 521 | // LoadItems only on those |
511 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); | 522 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); |
@@ -531,6 +542,7 @@ namespace OpenSim.Data.MySQL | |||
531 | } | 542 | } |
532 | } | 543 | } |
533 | } | 544 | } |
545 | dbcon.Close(); | ||
534 | } | 546 | } |
535 | } | 547 | } |
536 | 548 | ||
@@ -576,6 +588,7 @@ namespace OpenSim.Data.MySQL | |||
576 | } | 588 | } |
577 | } | 589 | } |
578 | } | 590 | } |
591 | dbcon.Close(); | ||
579 | } | 592 | } |
580 | 593 | ||
581 | prim.Inventory.RestoreInventoryItems(inventory); | 594 | prim.Inventory.RestoreInventoryItems(inventory); |
@@ -590,40 +603,102 @@ namespace OpenSim.Data.MySQL | |||
590 | 603 | ||
591 | public void StoreTerrain(TerrainData terrData, UUID regionID) | 604 | public void StoreTerrain(TerrainData terrData, UUID regionID) |
592 | { | 605 | { |
593 | lock (m_dbLock) | 606 | Util.FireAndForget(delegate(object x) |
594 | { | 607 | { |
595 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 608 | m_log.Info("[REGION DB]: Storing terrain"); |
596 | { | ||
597 | dbcon.Open(); | ||
598 | 609 | ||
599 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 610 | int terrainDBRevision; |
611 | Array terrainDBblob; | ||
612 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
613 | |||
614 | lock (m_dbLock) | ||
615 | { | ||
616 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
600 | { | 617 | { |
601 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 618 | dbcon.Open(); |
602 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
603 | 619 | ||
604 | ExecuteNonQuery(cmd); | 620 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
621 | { | ||
622 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
623 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
605 | 624 | ||
606 | int terrainDBRevision; | 625 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
607 | Array terrainDBblob; | 626 | { |
608 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | 627 | try |
628 | { | ||
629 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
630 | "Revision, Heightfield) values (?RegionUUID, " + | ||
631 | "?Revision, ?Heightfield)"; | ||
609 | 632 | ||
610 | m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", | 633 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
611 | LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); | 634 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); |
635 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
612 | 636 | ||
613 | cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" | 637 | ExecuteNonQuery(cmd); |
614 | + "values (?RegionUUID, ?Revision, ?Heightfield)"; | 638 | ExecuteNonQuery(cmd2); |
639 | } | ||
640 | catch (Exception e) | ||
641 | { | ||
642 | m_log.ErrorFormat(e.ToString()); | ||
643 | } | ||
644 | } | ||
645 | } | ||
646 | dbcon.Close(); | ||
647 | } | ||
648 | } | ||
649 | }); | ||
650 | } | ||
615 | 651 | ||
616 | cmd.Parameters.AddWithValue("Revision", terrainDBRevision); | 652 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) |
617 | cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); | 653 | { |
654 | Util.FireAndForget(delegate(object x) | ||
655 | { | ||
656 | m_log.Info("[REGION DB]: Storing Baked terrain"); | ||
618 | 657 | ||
619 | ExecuteNonQuery(cmd); | 658 | int terrainDBRevision; |
659 | Array terrainDBblob; | ||
660 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
661 | |||
662 | lock (m_dbLock) | ||
663 | { | ||
664 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
665 | { | ||
666 | dbcon.Open(); | ||
667 | |||
668 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
669 | { | ||
670 | cmd.CommandText = "delete from bakedterrain where RegionUUID = ?RegionUUID"; | ||
671 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
672 | |||
673 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) | ||
674 | { | ||
675 | try | ||
676 | { | ||
677 | cmd2.CommandText = "insert into bakedterrain (RegionUUID, " + | ||
678 | "Revision, Heightfield) values (?RegionUUID, " + | ||
679 | "?Revision, ?Heightfield)"; | ||
680 | |||
681 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
682 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); | ||
683 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
684 | |||
685 | ExecuteNonQuery(cmd); | ||
686 | ExecuteNonQuery(cmd2); | ||
687 | } | ||
688 | catch (Exception e) | ||
689 | { | ||
690 | m_log.ErrorFormat(e.ToString()); | ||
691 | } | ||
692 | } | ||
693 | } | ||
694 | dbcon.Close(); | ||
620 | } | 695 | } |
621 | } | 696 | } |
622 | } | 697 | }); |
623 | } | 698 | } |
624 | 699 | ||
625 | // Legacy region loading | 700 | // Legacy region loading |
626 | public double[,] LoadTerrain(UUID regionID) | 701 | public virtual double[,] LoadTerrain(UUID regionID) |
627 | { | 702 | { |
628 | double[,] ret = null; | 703 | double[,] ret = null; |
629 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | 704 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); |
@@ -636,9 +711,12 @@ namespace OpenSim.Data.MySQL | |||
636 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | 711 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) |
637 | { | 712 | { |
638 | TerrainData terrData = null; | 713 | TerrainData terrData = null; |
714 | byte[] blob = null; | ||
715 | int rev = 0; | ||
639 | 716 | ||
640 | lock (m_dbLock) | 717 | lock (m_dbLock) |
641 | { | 718 | { |
719 | |||
642 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 720 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
643 | { | 721 | { |
644 | dbcon.Open(); | 722 | dbcon.Open(); |
@@ -654,19 +732,64 @@ namespace OpenSim.Data.MySQL | |||
654 | { | 732 | { |
655 | while (reader.Read()) | 733 | while (reader.Read()) |
656 | { | 734 | { |
657 | int rev = Convert.ToInt32(reader["Revision"]); | 735 | rev = Convert.ToInt32(reader["Revision"]); |
658 | byte[] blob = (byte[])reader["Heightfield"]; | 736 | if ((reader["Heightfield"] != DBNull.Value)) |
659 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | 737 | { |
738 | blob = (byte[])reader["Heightfield"]; | ||
739 | } | ||
740 | } | ||
741 | } | ||
742 | } | ||
743 | dbcon.Close(); | ||
744 | } | ||
745 | } | ||
746 | |||
747 | if(blob != null) | ||
748 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
749 | |||
750 | return terrData; | ||
751 | } | ||
752 | |||
753 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
754 | { | ||
755 | TerrainData terrData = null; | ||
756 | byte[] blob = null; | ||
757 | int rev = 0; | ||
758 | |||
759 | lock (m_dbLock) | ||
760 | { | ||
761 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
762 | { | ||
763 | dbcon.Open(); | ||
764 | |||
765 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
766 | { | ||
767 | cmd.CommandText = "select RegionUUID, Revision, Heightfield " + | ||
768 | "from bakedterrain where RegionUUID = ?RegionUUID "; | ||
769 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
770 | |||
771 | using (IDataReader reader = ExecuteReader(cmd)) | ||
772 | { | ||
773 | while (reader.Read()) | ||
774 | { | ||
775 | rev = Convert.ToInt32(reader["Revision"]); | ||
776 | if ((reader["Heightfield"] != DBNull.Value)) | ||
777 | { | ||
778 | blob = (byte[])reader["Heightfield"]; | ||
779 | } | ||
660 | } | 780 | } |
661 | } | 781 | } |
662 | } | 782 | } |
783 | dbcon.Close(); | ||
663 | } | 784 | } |
664 | } | 785 | } |
786 | if(blob != null) | ||
787 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
665 | 788 | ||
666 | return terrData; | 789 | return terrData; |
667 | } | 790 | } |
668 | 791 | ||
669 | public void RemoveLandObject(UUID globalID) | 792 | public virtual void RemoveLandObject(UUID globalID) |
670 | { | 793 | { |
671 | lock (m_dbLock) | 794 | lock (m_dbLock) |
672 | { | 795 | { |
@@ -681,11 +804,12 @@ namespace OpenSim.Data.MySQL | |||
681 | 804 | ||
682 | ExecuteNonQuery(cmd); | 805 | ExecuteNonQuery(cmd); |
683 | } | 806 | } |
807 | dbcon.Close(); | ||
684 | } | 808 | } |
685 | } | 809 | } |
686 | } | 810 | } |
687 | 811 | ||
688 | public void StoreLandObject(ILandObject parcel) | 812 | public virtual void StoreLandObject(ILandObject parcel) |
689 | { | 813 | { |
690 | lock (m_dbLock) | 814 | lock (m_dbLock) |
691 | { | 815 | { |
@@ -705,7 +829,8 @@ namespace OpenSim.Data.MySQL | |||
705 | "UserLocationX, UserLocationY, UserLocationZ, " + | 829 | "UserLocationX, UserLocationY, UserLocationZ, " + |
706 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + | 830 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + |
707 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + | 831 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + |
708 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + | 832 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " + |
833 | "SeeAVs, AnyAVSounds, GroupAVSounds) values (" + | ||
709 | "?UUID, ?RegionUUID, " + | 834 | "?UUID, ?RegionUUID, " + |
710 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + | 835 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + |
711 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + | 836 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + |
@@ -716,7 +841,8 @@ namespace OpenSim.Data.MySQL | |||
716 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + | 841 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + |
717 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + | 842 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + |
718 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ | 843 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ |
719 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; | 844 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " + |
845 | "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)"; | ||
720 | 846 | ||
721 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); | 847 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); |
722 | 848 | ||
@@ -738,11 +864,12 @@ namespace OpenSim.Data.MySQL | |||
738 | cmd.Parameters.Clear(); | 864 | cmd.Parameters.Clear(); |
739 | } | 865 | } |
740 | } | 866 | } |
867 | dbcon.Close(); | ||
741 | } | 868 | } |
742 | } | 869 | } |
743 | } | 870 | } |
744 | 871 | ||
745 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 872 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
746 | { | 873 | { |
747 | RegionLightShareData nWP = new RegionLightShareData(); | 874 | RegionLightShareData nWP = new RegionLightShareData(); |
748 | nWP.OnSave += StoreRegionWindlightSettings; | 875 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -759,90 +886,94 @@ namespace OpenSim.Data.MySQL | |||
759 | 886 | ||
760 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | 887 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
761 | 888 | ||
762 | IDataReader result = ExecuteReader(cmd); | 889 | using(IDataReader result = ExecuteReader(cmd)) |
763 | if (!result.Read()) | ||
764 | { | 890 | { |
765 | //No result, so store our default windlight profile and return it | 891 | if(!result.Read()) |
766 | nWP.regionID = regionUUID; | 892 | { |
767 | // StoreRegionWindlightSettings(nWP); | 893 | //No result, so store our default windlight profile and return it |
768 | return nWP; | 894 | nWP.regionID = regionUUID; |
769 | } | 895 | // StoreRegionWindlightSettings(nWP); |
770 | else | 896 | return nWP; |
771 | { | 897 | } |
772 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | 898 | else |
773 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 899 | { |
774 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 900 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
775 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 901 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
776 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 902 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
777 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 903 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
778 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 904 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
779 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 905 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
780 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 906 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
781 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 907 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
782 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 908 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
783 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 909 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
784 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 910 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
785 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 911 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
786 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 912 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
787 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 913 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
788 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 914 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
789 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 915 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
790 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 916 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
791 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 917 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
792 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 918 | UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture); |
793 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 919 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
794 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 920 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
795 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 921 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
796 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 922 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
797 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 923 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
798 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 924 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
799 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 925 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
800 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 926 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
801 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 927 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
802 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 928 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
803 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 929 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
804 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 930 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
805 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 931 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
806 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 932 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
807 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 933 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
808 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 934 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
809 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 935 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
810 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 936 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
811 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 937 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
812 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 938 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
813 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 939 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
814 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 940 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
815 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 941 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
816 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 942 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
817 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 943 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
818 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 944 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
819 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 945 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
820 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 946 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
821 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 947 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
822 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 948 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
823 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 949 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
824 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 950 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); |
825 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 951 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); |
826 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 952 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); |
827 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 953 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); |
828 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 954 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); |
829 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 955 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); |
830 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 956 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); |
831 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 957 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); |
832 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 958 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); |
833 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 959 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); |
834 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 960 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); |
835 | nWP.valid = true; | 961 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); |
962 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
963 | nWP.valid = true; | ||
964 | } | ||
836 | } | 965 | } |
837 | } | 966 | } |
967 | dbcon.Close(); | ||
838 | } | 968 | } |
839 | 969 | ||
840 | return nWP; | 970 | return nWP; |
841 | } | 971 | } |
842 | 972 | ||
843 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 973 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
844 | { | 974 | { |
845 | RegionSettings rs = null; | 975 | RegionSettings rs = null; |
976 | bool needStore = false; | ||
846 | 977 | ||
847 | lock (m_dbLock) | 978 | lock (m_dbLock) |
848 | { | 979 | { |
@@ -868,19 +999,23 @@ namespace OpenSim.Data.MySQL | |||
868 | rs.RegionUUID = regionUUID; | 999 | rs.RegionUUID = regionUUID; |
869 | rs.OnSave += StoreRegionSettings; | 1000 | rs.OnSave += StoreRegionSettings; |
870 | 1001 | ||
871 | StoreRegionSettings(rs); | 1002 | needStore = true; |
872 | } | 1003 | } |
873 | } | 1004 | } |
874 | } | 1005 | } |
1006 | dbcon.Close(); | ||
875 | } | 1007 | } |
876 | } | 1008 | } |
877 | 1009 | ||
1010 | if(needStore) | ||
1011 | StoreRegionSettings(rs); | ||
1012 | |||
878 | LoadSpawnPoints(rs); | 1013 | LoadSpawnPoints(rs); |
879 | 1014 | ||
880 | return rs; | 1015 | return rs; |
881 | } | 1016 | } |
882 | 1017 | ||
883 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 1018 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
884 | { | 1019 | { |
885 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1020 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
886 | { | 1021 | { |
@@ -888,31 +1023,32 @@ namespace OpenSim.Data.MySQL | |||
888 | 1023 | ||
889 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1024 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
890 | { | 1025 | { |
891 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 1026 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, " |
892 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 1027 | + "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, " |
893 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; | 1028 | + "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, " |
894 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; | 1029 | + "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, " |
895 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; | 1030 | + "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, " |
896 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; | 1031 | + "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, " |
897 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; | 1032 | + "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, " |
898 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; | 1033 | + "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, " |
899 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; | 1034 | + "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, " |
900 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; | 1035 | + "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, " |
901 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; | 1036 | + "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, " |
902 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; | 1037 | + "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, " |
903 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; | 1038 | + "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, " |
904 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; | 1039 | + "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, " |
905 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; | 1040 | + "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, " |
906 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; | 1041 | + "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, " |
907 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; | 1042 | + "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, " |
908 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; | 1043 | + "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, " |
909 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; | 1044 | + "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, " |
910 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; | 1045 | + "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, " |
911 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; | 1046 | + "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, " |
912 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 1047 | + "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, " |
913 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; | 1048 | + "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, " |
914 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; | 1049 | + "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, " |
915 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 1050 | + "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)" |
1051 | ; | ||
916 | 1052 | ||
917 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 1053 | cmd.Parameters.AddWithValue("region_id", wl.regionID); |
918 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 1054 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); |
@@ -977,13 +1113,14 @@ namespace OpenSim.Data.MySQL | |||
977 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | 1113 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); |
978 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | 1114 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); |
979 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | 1115 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); |
980 | 1116 | ||
981 | ExecuteNonQuery(cmd); | 1117 | ExecuteNonQuery(cmd); |
982 | } | 1118 | } |
1119 | dbcon.Close(); | ||
983 | } | 1120 | } |
984 | } | 1121 | } |
985 | 1122 | ||
986 | public void RemoveRegionWindlightSettings(UUID regionID) | 1123 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
987 | { | 1124 | { |
988 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1125 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
989 | { | 1126 | { |
@@ -995,6 +1132,7 @@ namespace OpenSim.Data.MySQL | |||
995 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | 1132 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); |
996 | ExecuteNonQuery(cmd); | 1133 | ExecuteNonQuery(cmd); |
997 | } | 1134 | } |
1135 | dbcon.Close(); | ||
998 | } | 1136 | } |
999 | } | 1137 | } |
1000 | 1138 | ||
@@ -1013,14 +1151,19 @@ namespace OpenSim.Data.MySQL | |||
1013 | 1151 | ||
1014 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1152 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1015 | 1153 | ||
1016 | IDataReader result = ExecuteReader(cmd); | 1154 | using(IDataReader result = ExecuteReader(cmd)) |
1017 | if (!result.Read()) | ||
1018 | { | 1155 | { |
1019 | return String.Empty; | 1156 | if(!result.Read()) |
1020 | } | 1157 | { |
1021 | else | 1158 | dbcon.Close(); |
1022 | { | 1159 | return String.Empty; |
1023 | return Convert.ToString(result["llsd_settings"]); | 1160 | } |
1161 | else | ||
1162 | { | ||
1163 | string ret = Convert.ToString(result["llsd_settings"]); | ||
1164 | dbcon.Close(); | ||
1165 | return ret; | ||
1166 | } | ||
1024 | } | 1167 | } |
1025 | } | 1168 | } |
1026 | } | 1169 | } |
@@ -1041,6 +1184,7 @@ namespace OpenSim.Data.MySQL | |||
1041 | 1184 | ||
1042 | ExecuteNonQuery(cmd); | 1185 | ExecuteNonQuery(cmd); |
1043 | } | 1186 | } |
1187 | dbcon.Close(); | ||
1044 | } | 1188 | } |
1045 | } | 1189 | } |
1046 | 1190 | ||
@@ -1056,11 +1200,12 @@ namespace OpenSim.Data.MySQL | |||
1056 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1200 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); |
1057 | ExecuteNonQuery(cmd); | 1201 | ExecuteNonQuery(cmd); |
1058 | } | 1202 | } |
1203 | dbcon.Close(); | ||
1059 | } | 1204 | } |
1060 | } | 1205 | } |
1061 | #endregion | 1206 | #endregion |
1062 | 1207 | ||
1063 | public void StoreRegionSettings(RegionSettings rs) | 1208 | public virtual void StoreRegionSettings(RegionSettings rs) |
1064 | { | 1209 | { |
1065 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1210 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1066 | { | 1211 | { |
@@ -1069,52 +1214,51 @@ namespace OpenSim.Data.MySQL | |||
1069 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1214 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1070 | { | 1215 | { |
1071 | cmd.CommandText = "replace into regionsettings (regionUUID, " + | 1216 | cmd.CommandText = "replace into regionsettings (regionUUID, " + |
1072 | "block_terraform, block_fly, allow_damage, " + | 1217 | "block_terraform, block_fly, allow_damage, " + |
1073 | "restrict_pushing, allow_land_resell, " + | 1218 | "restrict_pushing, allow_land_resell, " + |
1074 | "allow_land_join_divide, block_show_in_search, " + | 1219 | "allow_land_join_divide, block_show_in_search, " + |
1075 | "agent_limit, object_bonus, maturity, " + | 1220 | "agent_limit, object_bonus, maturity, " + |
1076 | "disable_scripts, disable_collisions, " + | 1221 | "disable_scripts, disable_collisions, " + |
1077 | "disable_physics, terrain_texture_1, " + | 1222 | "disable_physics, terrain_texture_1, " + |
1078 | "terrain_texture_2, terrain_texture_3, " + | 1223 | "terrain_texture_2, terrain_texture_3, " + |
1079 | "terrain_texture_4, elevation_1_nw, " + | 1224 | "terrain_texture_4, elevation_1_nw, " + |
1080 | "elevation_2_nw, elevation_1_ne, " + | 1225 | "elevation_2_nw, elevation_1_ne, " + |
1081 | "elevation_2_ne, elevation_1_se, " + | 1226 | "elevation_2_ne, elevation_1_se, " + |
1082 | "elevation_2_se, elevation_1_sw, " + | 1227 | "elevation_2_se, elevation_1_sw, " + |
1083 | "elevation_2_sw, water_height, " + | 1228 | "elevation_2_sw, water_height, " + |
1084 | "terrain_raise_limit, terrain_lower_limit, " + | 1229 | "terrain_raise_limit, terrain_lower_limit, " + |
1085 | "use_estate_sun, fixed_sun, sun_position, " + | 1230 | "use_estate_sun, fixed_sun, sun_position, " + |
1086 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1231 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1087 | "sunvectorz, loaded_creation_datetime, " + | 1232 | "sunvectorz, loaded_creation_datetime, " + |
1088 | "loaded_creation_id, map_tile_ID, " + | 1233 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1089 | "TelehubObject, parcel_tile_ID) " + | 1234 | "TelehubObject, parcel_tile_ID) " + |
1090 | "values (?RegionUUID, ?BlockTerraform, " + | 1235 | "values (?RegionUUID, ?BlockTerraform, " + |
1091 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1236 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
1092 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 1237 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
1093 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 1238 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
1094 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + | 1239 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + |
1095 | "?DisablePhysics, ?TerrainTexture1, " + | 1240 | "?DisablePhysics, ?TerrainTexture1, " + |
1096 | "?TerrainTexture2, ?TerrainTexture3, " + | 1241 | "?TerrainTexture2, ?TerrainTexture3, " + |
1097 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + | 1242 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + |
1098 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + | 1243 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + |
1099 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + | 1244 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + |
1100 | "?WaterHeight, ?TerrainRaiseLimit, " + | 1245 | "?WaterHeight, ?TerrainRaiseLimit, " + |
1101 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + | 1246 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + |
1102 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1247 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1103 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1248 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1104 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1249 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1105 | "?TerrainImageID, " + | 1250 | "?TerrainImageID, ?block_search, ?casino, " + |
1106 | "?TelehubObject, ?ParcelImageID)"; | 1251 | "?TelehubObject, ?ParcelImageID)"; |
1107 | 1252 | ||
1108 | FillRegionSettingsCommand(cmd, rs); | 1253 | FillRegionSettingsCommand(cmd, rs); |
1109 | |||
1110 | ExecuteNonQuery(cmd); | 1254 | ExecuteNonQuery(cmd); |
1111 | } | 1255 | } |
1256 | dbcon.Close(); | ||
1257 | SaveSpawnPoints(rs); | ||
1112 | } | 1258 | } |
1113 | |||
1114 | SaveSpawnPoints(rs); | ||
1115 | } | 1259 | } |
1116 | 1260 | ||
1117 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1261 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1118 | { | 1262 | { |
1119 | List<LandData> landData = new List<LandData>(); | 1263 | List<LandData> landData = new List<LandData>(); |
1120 | 1264 | ||
@@ -1156,6 +1300,7 @@ namespace OpenSim.Data.MySQL | |||
1156 | } | 1300 | } |
1157 | } | 1301 | } |
1158 | } | 1302 | } |
1303 | dbcon.Close(); | ||
1159 | } | 1304 | } |
1160 | } | 1305 | } |
1161 | 1306 | ||
@@ -1170,12 +1315,16 @@ namespace OpenSim.Data.MySQL | |||
1170 | { | 1315 | { |
1171 | SceneObjectPart prim = new SceneObjectPart(); | 1316 | SceneObjectPart prim = new SceneObjectPart(); |
1172 | 1317 | ||
1173 | // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! | 1318 | // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! |
1174 | prim.UUID = DBGuid.FromDB(row["UUID"]); | 1319 | prim.UUID = DBGuid.FromDB(row["UUID"]); |
1175 | prim.CreatorIdentification = (string)row["CreatorID"]; | 1320 | prim.CreatorIdentification = (string)row["CreatorID"]; |
1176 | prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); | 1321 | prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); |
1177 | prim.GroupID = DBGuid.FromDB(row["GroupID"]); | 1322 | prim.GroupID = DBGuid.FromDB(row["GroupID"]); |
1178 | prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); | 1323 | prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); |
1324 | if (row["RezzerID"] != DBNull.Value) | ||
1325 | prim.RezzerID = DBGuid.FromDB(row["RezzerID"]); | ||
1326 | else | ||
1327 | prim.RezzerID = UUID.Zero; | ||
1179 | 1328 | ||
1180 | // explicit conversion of integers is required, which sort | 1329 | // explicit conversion of integers is required, which sort |
1181 | // of sucks. No idea if there is a shortcut here or not. | 1330 | // of sucks. No idea if there is a shortcut here or not. |
@@ -1294,10 +1443,11 @@ namespace OpenSim.Data.MySQL | |||
1294 | 1443 | ||
1295 | prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); | 1444 | prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); |
1296 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1445 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1297 | 1446 | ||
1298 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1447 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1448 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1299 | prim.LinkNum = (int)row["LinkNumber"]; | 1449 | prim.LinkNum = (int)row["LinkNumber"]; |
1300 | 1450 | ||
1301 | if (!(row["MediaURL"] is System.DBNull)) | 1451 | if (!(row["MediaURL"] is System.DBNull)) |
1302 | prim.MediaUrl = (string)row["MediaURL"]; | 1452 | prim.MediaUrl = (string)row["MediaURL"]; |
1303 | 1453 | ||
@@ -1313,7 +1463,7 @@ namespace OpenSim.Data.MySQL | |||
1313 | if (!(row["DynAttrs"] is System.DBNull)) | 1463 | if (!(row["DynAttrs"] is System.DBNull)) |
1314 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); | 1464 | prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]); |
1315 | else | 1465 | else |
1316 | prim.DynAttrs = new DAMap(); | 1466 | prim.DynAttrs = new DAMap(); |
1317 | 1467 | ||
1318 | if (!(row["KeyframeMotion"] is DBNull)) | 1468 | if (!(row["KeyframeMotion"] is DBNull)) |
1319 | { | 1469 | { |
@@ -1333,7 +1483,22 @@ namespace OpenSim.Data.MySQL | |||
1333 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | 1483 | prim.GravityModifier = (float)(double)row["GravityModifier"]; |
1334 | prim.Friction = (float)(double)row["Friction"]; | 1484 | prim.Friction = (float)(double)row["Friction"]; |
1335 | prim.Restitution = (float)(double)row["Restitution"]; | 1485 | prim.Restitution = (float)(double)row["Restitution"]; |
1336 | 1486 | prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString()); | |
1487 | |||
1488 | SOPVehicle vehicle = null; | ||
1489 | |||
1490 | if (row["Vehicle"].ToString() != String.Empty) | ||
1491 | { | ||
1492 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1493 | if (vehicle != null) | ||
1494 | prim.VehicleParams = vehicle; | ||
1495 | } | ||
1496 | |||
1497 | PhysicsInertiaData pdata = null; | ||
1498 | if (row["PhysInertia"].ToString() != String.Empty) | ||
1499 | pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString()); | ||
1500 | prim.PhysicsInertia = pdata; | ||
1501 | |||
1337 | return prim; | 1502 | return prim; |
1338 | } | 1503 | } |
1339 | 1504 | ||
@@ -1344,32 +1509,40 @@ namespace OpenSim.Data.MySQL | |||
1344 | /// <returns></returns> | 1509 | /// <returns></returns> |
1345 | private static TaskInventoryItem BuildItem(IDataReader row) | 1510 | private static TaskInventoryItem BuildItem(IDataReader row) |
1346 | { | 1511 | { |
1347 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1512 | try |
1348 | 1513 | { | |
1349 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1514 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1350 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1515 | |
1351 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1516 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1352 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1517 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1353 | 1518 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1354 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1519 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1355 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1520 | |
1356 | 1521 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1357 | taskItem.Name = (String)row["name"]; | 1522 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1358 | taskItem.Description = (String)row["description"]; | 1523 | |
1359 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1524 | taskItem.Name = (String)row["name"]; |
1360 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1525 | taskItem.Description = (String)row["description"]; |
1361 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1526 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1362 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1527 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1363 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1528 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1364 | 1529 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1365 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1530 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1366 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1531 | |
1367 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1532 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1368 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1533 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1369 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1534 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1370 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1535 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1371 | 1536 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1372 | return taskItem; | 1537 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1538 | |||
1539 | return taskItem; | ||
1540 | } | ||
1541 | catch | ||
1542 | { | ||
1543 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1544 | throw; | ||
1545 | } | ||
1373 | } | 1546 | } |
1374 | 1547 | ||
1375 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1548 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1417,16 +1590,19 @@ namespace OpenSim.Data.MySQL | |||
1417 | newSettings.Covenant = DBGuid.FromDB(row["covenant"]); | 1590 | newSettings.Covenant = DBGuid.FromDB(row["covenant"]); |
1418 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); | 1591 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); |
1419 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); | 1592 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); |
1420 | 1593 | ||
1421 | if (row["loaded_creation_id"] is DBNull) | 1594 | if (row["loaded_creation_id"] is DBNull) |
1422 | newSettings.LoadedCreationID = ""; | 1595 | newSettings.LoadedCreationID = ""; |
1423 | else | 1596 | else |
1424 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; | 1597 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; |
1425 | 1598 | ||
1426 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); | 1599 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); |
1427 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1600 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1428 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1601 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1429 | 1602 | ||
1603 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1604 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1605 | |||
1430 | return newSettings; | 1606 | return newSettings; |
1431 | } | 1607 | } |
1432 | 1608 | ||
@@ -1503,6 +1679,13 @@ namespace OpenSim.Data.MySQL | |||
1503 | 1679 | ||
1504 | newData.ParcelAccessList = new List<LandAccessEntry>(); | 1680 | newData.ParcelAccessList = new List<LandAccessEntry>(); |
1505 | 1681 | ||
1682 | if (!(row["SeeAVs"] is System.DBNull)) | ||
1683 | newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false; | ||
1684 | if (!(row["AnyAVSounds"] is System.DBNull)) | ||
1685 | newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false; | ||
1686 | if (!(row["GroupAVSounds"] is System.DBNull)) | ||
1687 | newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false; | ||
1688 | |||
1506 | return newData; | 1689 | return newData; |
1507 | } | 1690 | } |
1508 | 1691 | ||
@@ -1550,6 +1733,7 @@ namespace OpenSim.Data.MySQL | |||
1550 | cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); | 1733 | cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); |
1551 | cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); | 1734 | cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); |
1552 | cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); | 1735 | cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); |
1736 | cmd.Parameters.AddWithValue("RezzerID", prim.RezzerID.ToString()); | ||
1553 | cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); | 1737 | cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); |
1554 | cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); | 1738 | cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); |
1555 | cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); | 1739 | cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); |
@@ -1654,6 +1838,11 @@ namespace OpenSim.Data.MySQL | |||
1654 | else | 1838 | else |
1655 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1839 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1656 | 1840 | ||
1841 | if (prim.PassCollisions) | ||
1842 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1843 | else | ||
1844 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1845 | |||
1657 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1846 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1658 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1847 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1659 | if (prim.AttachedPos != null) | 1848 | if (prim.AttachedPos != null) |
@@ -1668,6 +1857,16 @@ namespace OpenSim.Data.MySQL | |||
1668 | else | 1857 | else |
1669 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1858 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1670 | 1859 | ||
1860 | if (prim.PhysicsInertia != null) | ||
1861 | cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2()); | ||
1862 | else | ||
1863 | cmd.Parameters.AddWithValue("PhysInertia", String.Empty); | ||
1864 | |||
1865 | if (prim.VehicleParams != null) | ||
1866 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1867 | else | ||
1868 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1869 | |||
1671 | if (prim.DynAttrs.CountNamespaces > 0) | 1870 | if (prim.DynAttrs.CountNamespaces > 0) |
1672 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1871 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1673 | else | 1872 | else |
@@ -1678,6 +1877,7 @@ namespace OpenSim.Data.MySQL | |||
1678 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | 1877 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); |
1679 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | 1878 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); |
1680 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); | 1879 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); |
1880 | cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks); | ||
1681 | } | 1881 | } |
1682 | 1882 | ||
1683 | /// <summary> | 1883 | /// <summary> |
@@ -1756,6 +1956,8 @@ namespace OpenSim.Data.MySQL | |||
1756 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1956 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1757 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1957 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1758 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1958 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1959 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1960 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1759 | 1961 | ||
1760 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1962 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1761 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1963 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1813,6 +2015,10 @@ namespace OpenSim.Data.MySQL | |||
1813 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); | 2015 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); |
1814 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); | 2016 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); |
1815 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); | 2017 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); |
2018 | cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0); | ||
2019 | cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0); | ||
2020 | cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0); | ||
2021 | |||
1816 | } | 2022 | } |
1817 | 2023 | ||
1818 | /// <summary> | 2024 | /// <summary> |
@@ -1869,7 +2075,7 @@ namespace OpenSim.Data.MySQL | |||
1869 | 2075 | ||
1870 | s.State = (byte)(int)row["State"]; | 2076 | s.State = (byte)(int)row["State"]; |
1871 | s.LastAttachPoint = (byte)(int)row["LastAttachPoint"]; | 2077 | s.LastAttachPoint = (byte)(int)row["LastAttachPoint"]; |
1872 | 2078 | ||
1873 | if (!(row["Media"] is System.DBNull)) | 2079 | if (!(row["Media"] is System.DBNull)) |
1874 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); | 2080 | s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); |
1875 | 2081 | ||
@@ -1919,7 +2125,7 @@ namespace OpenSim.Data.MySQL | |||
1919 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 2125 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1920 | } | 2126 | } |
1921 | 2127 | ||
1922 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 2128 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1923 | { | 2129 | { |
1924 | lock (m_dbLock) | 2130 | lock (m_dbLock) |
1925 | { | 2131 | { |
@@ -1949,20 +2155,53 @@ namespace OpenSim.Data.MySQL | |||
1949 | "?flags, ?itemID, ?primID, ?assetID, " + | 2155 | "?flags, ?itemID, ?primID, ?assetID, " + |
1950 | "?parentFolderID, ?creatorID, ?ownerID, " + | 2156 | "?parentFolderID, ?creatorID, ?ownerID, " + |
1951 | "?groupID, ?lastOwnerID)"; | 2157 | "?groupID, ?lastOwnerID)"; |
1952 | 2158 | ||
1953 | foreach (TaskInventoryItem item in items) | 2159 | foreach (TaskInventoryItem item in items) |
1954 | { | 2160 | { |
1955 | cmd.Parameters.Clear(); | 2161 | cmd.Parameters.Clear(); |
1956 | 2162 | ||
1957 | FillItemCommand(cmd, item); | 2163 | FillItemCommand(cmd, item); |
1958 | 2164 | ||
1959 | ExecuteNonQuery(cmd); | 2165 | ExecuteNonQuery(cmd); |
1960 | } | 2166 | } |
1961 | } | 2167 | } |
2168 | dbcon.Close(); | ||
1962 | } | 2169 | } |
1963 | } | 2170 | } |
1964 | } | 2171 | } |
1965 | 2172 | ||
2173 | public UUID[] GetObjectIDs(UUID regionID) | ||
2174 | { | ||
2175 | List<UUID> uuids = new List<UUID>(); | ||
2176 | |||
2177 | lock (m_dbLock) | ||
2178 | { | ||
2179 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2180 | { | ||
2181 | dbcon.Open(); | ||
2182 | |||
2183 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2184 | { | ||
2185 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2186 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2187 | |||
2188 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2189 | { | ||
2190 | while (reader.Read()) | ||
2191 | { | ||
2192 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2193 | |||
2194 | uuids.Add(id); | ||
2195 | } | ||
2196 | } | ||
2197 | } | ||
2198 | dbcon.Close(); | ||
2199 | } | ||
2200 | } | ||
2201 | |||
2202 | return uuids.ToArray(); | ||
2203 | } | ||
2204 | |||
1966 | private void LoadSpawnPoints(RegionSettings rs) | 2205 | private void LoadSpawnPoints(RegionSettings rs) |
1967 | { | 2206 | { |
1968 | rs.ClearSpawnPoints(); | 2207 | rs.ClearSpawnPoints(); |
@@ -1992,6 +2231,7 @@ namespace OpenSim.Data.MySQL | |||
1992 | } | 2231 | } |
1993 | } | 2232 | } |
1994 | } | 2233 | } |
2234 | dbcon.Close(); | ||
1995 | } | 2235 | } |
1996 | } | 2236 | } |
1997 | } | 2237 | } |
@@ -2026,6 +2266,7 @@ namespace OpenSim.Data.MySQL | |||
2026 | cmd.Parameters.Clear(); | 2266 | cmd.Parameters.Clear(); |
2027 | } | 2267 | } |
2028 | } | 2268 | } |
2269 | dbcon.Close(); | ||
2029 | } | 2270 | } |
2030 | } | 2271 | } |
2031 | } | 2272 | } |
@@ -2045,6 +2286,7 @@ namespace OpenSim.Data.MySQL | |||
2045 | 2286 | ||
2046 | cmd.ExecuteNonQuery(); | 2287 | cmd.ExecuteNonQuery(); |
2047 | } | 2288 | } |
2289 | dbcon.Close(); | ||
2048 | } | 2290 | } |
2049 | } | 2291 | } |
2050 | 2292 | ||
@@ -2062,6 +2304,7 @@ namespace OpenSim.Data.MySQL | |||
2062 | 2304 | ||
2063 | cmd.ExecuteNonQuery(); | 2305 | cmd.ExecuteNonQuery(); |
2064 | } | 2306 | } |
2307 | dbcon.Close(); | ||
2065 | } | 2308 | } |
2066 | } | 2309 | } |
2067 | 2310 | ||
@@ -2085,6 +2328,7 @@ namespace OpenSim.Data.MySQL | |||
2085 | } | 2328 | } |
2086 | } | 2329 | } |
2087 | } | 2330 | } |
2331 | dbcon.Close(); | ||
2088 | } | 2332 | } |
2089 | 2333 | ||
2090 | return ret; | 2334 | return ret; |