diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 162 |
1 files changed, 95 insertions, 67 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 0b430c7..b1339b6 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | |||
@@ -54,28 +54,16 @@ namespace OpenSim.Data.MSSQL | |||
54 | /// The database manager | 54 | /// The database manager |
55 | /// </summary> | 55 | /// </summary> |
56 | private MSSQLManager _Database; | 56 | private MSSQLManager _Database; |
57 | 57 | private string m_connectionString; | |
58 | /// <summary> | 58 | /// <summary> |
59 | /// Initialises the region datastore | 59 | /// Initialises the region datastore |
60 | /// </summary> | 60 | /// </summary> |
61 | /// <param name="connectionString">The connection string.</param> | 61 | /// <param name="connectionString">The connection string.</param> |
62 | public void Initialise(string connectionString) | 62 | public void Initialise(string connectionString) |
63 | { | 63 | { |
64 | if (!string.IsNullOrEmpty(connectionString)) | 64 | m_connectionString = connectionString; |
65 | { | 65 | _Database = new MSSQLManager(connectionString); |
66 | _Database = new MSSQLManager(connectionString); | 66 | |
67 | } | ||
68 | else | ||
69 | { | ||
70 | IniFile iniFile = new IniFile("mssql_connection.ini"); | ||
71 | string settingDataSource = iniFile.ParseFileReadValue("data_source"); | ||
72 | string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); | ||
73 | string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info"); | ||
74 | string settingUserId = iniFile.ParseFileReadValue("user_id"); | ||
75 | string settingPassword = iniFile.ParseFileReadValue("password"); | ||
76 | |||
77 | _Database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); | ||
78 | } | ||
79 | 67 | ||
80 | //Migration settings | 68 | //Migration settings |
81 | _Database.CheckMigration(_migrationStore); | 69 | _Database.CheckMigration(_migrationStore); |
@@ -102,17 +90,18 @@ namespace OpenSim.Data.MSSQL | |||
102 | SceneObjectGroup grp = null; | 90 | SceneObjectGroup grp = null; |
103 | 91 | ||
104 | 92 | ||
105 | string query = "SELECT *, " + | 93 | string sql = "SELECT *, " + |
106 | "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + | 94 | "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + |
107 | "FROM prims " + | 95 | "FROM prims " + |
108 | "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " + | 96 | "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " + |
109 | "WHERE RegionUUID = @RegionUUID " + | 97 | "WHERE RegionUUID = @RegionUUID " + |
110 | "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc"; | 98 | "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc"; |
111 | 99 | ||
112 | using (AutoClosingSqlCommand command = _Database.Query(query)) | 100 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
101 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
113 | { | 102 | { |
114 | command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); | 103 | command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); |
115 | 104 | conn.Open(); | |
116 | using (SqlDataReader reader = command.ExecuteReader()) | 105 | using (SqlDataReader reader = command.ExecuteReader()) |
117 | { | 106 | { |
118 | while (reader.Read()) | 107 | while (reader.Read()) |
@@ -122,7 +111,7 @@ namespace OpenSim.Data.MSSQL | |||
122 | sceneObjectPart.Shape = PrimitiveBaseShape.Default; | 111 | sceneObjectPart.Shape = PrimitiveBaseShape.Default; |
123 | else | 112 | else |
124 | sceneObjectPart.Shape = BuildShape(reader); | 113 | sceneObjectPart.Shape = BuildShape(reader); |
125 | 114 | ||
126 | prims[sceneObjectPart.UUID] = sceneObjectPart; | 115 | prims[sceneObjectPart.UUID] = sceneObjectPart; |
127 | 116 | ||
128 | UUID groupID = new UUID((Guid)reader["SceneGroupID"]); | 117 | UUID groupID = new UUID((Guid)reader["SceneGroupID"]); |
@@ -133,7 +122,7 @@ namespace OpenSim.Data.MSSQL | |||
133 | objects[grp.UUID] = grp; | 122 | objects[grp.UUID] = grp; |
134 | 123 | ||
135 | lastGroupID = groupID; | 124 | lastGroupID = groupID; |
136 | 125 | ||
137 | // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are | 126 | // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are |
138 | // recorded as the root prim (for which the UUID must equal the persisted group UUID). In | 127 | // recorded as the root prim (for which the UUID must equal the persisted group UUID). In |
139 | // this case, force the UUID to be the same as the group UUID so that at least these can be | 128 | // this case, force the UUID to be the same as the group UUID so that at least these can be |
@@ -142,7 +131,7 @@ namespace OpenSim.Data.MSSQL | |||
142 | if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) | 131 | if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) |
143 | { | 132 | { |
144 | _Log.WarnFormat( | 133 | _Log.WarnFormat( |
145 | "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", | 134 | "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", |
146 | sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); | 135 | sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); |
147 | 136 | ||
148 | sceneObjectPart.UUID = groupID; | 137 | sceneObjectPart.UUID = groupID; |
@@ -174,8 +163,10 @@ namespace OpenSim.Data.MSSQL | |||
174 | // LoadItems only on those | 163 | // LoadItems only on those |
175 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); | 164 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); |
176 | string qry = "select distinct primID from primitems"; | 165 | string qry = "select distinct primID from primitems"; |
177 | using (AutoClosingSqlCommand command = _Database.Query(qry)) | 166 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
167 | using (SqlCommand command = new SqlCommand(qry, conn)) | ||
178 | { | 168 | { |
169 | conn.Open(); | ||
179 | using (SqlDataReader itemReader = command.ExecuteReader()) | 170 | using (SqlDataReader itemReader = command.ExecuteReader()) |
180 | { | 171 | { |
181 | while (itemReader.Read()) | 172 | while (itemReader.Read()) |
@@ -205,14 +196,16 @@ namespace OpenSim.Data.MSSQL | |||
205 | /// <param name="allPrims">all prims with inventory on a region</param> | 196 | /// <param name="allPrims">all prims with inventory on a region</param> |
206 | private void LoadItems(List<SceneObjectPart> allPrimsWithInventory) | 197 | private void LoadItems(List<SceneObjectPart> allPrimsWithInventory) |
207 | { | 198 | { |
208 | 199 | string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID"; | |
209 | using (AutoClosingSqlCommand command = _Database.Query("SELECT * FROM primitems WHERE PrimID = @PrimID")) | 200 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
201 | using (SqlCommand command = new SqlCommand(sql, conn)) | ||
210 | { | 202 | { |
203 | conn.Open(); | ||
211 | foreach (SceneObjectPart objectPart in allPrimsWithInventory) | 204 | foreach (SceneObjectPart objectPart in allPrimsWithInventory) |
212 | { | 205 | { |
213 | command.Parameters.Clear(); | 206 | command.Parameters.Clear(); |
214 | command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); | 207 | command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); |
215 | 208 | ||
216 | List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 209 | List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
217 | 210 | ||
218 | using (SqlDataReader reader = command.ExecuteReader()) | 211 | using (SqlDataReader reader = command.ExecuteReader()) |
@@ -241,8 +234,9 @@ namespace OpenSim.Data.MSSQL | |||
241 | { | 234 | { |
242 | _Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); | 235 | _Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); |
243 | 236 | ||
244 | using (SqlConnection conn = _Database.DatabaseConnection()) | 237 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
245 | { | 238 | { |
239 | conn.Open(); | ||
246 | SqlTransaction transaction = conn.BeginTransaction(); | 240 | SqlTransaction transaction = conn.BeginTransaction(); |
247 | 241 | ||
248 | try | 242 | try |
@@ -437,8 +431,12 @@ ELSE | |||
437 | lock (_Database) | 431 | lock (_Database) |
438 | { | 432 | { |
439 | //Using the non transaction mode. | 433 | //Using the non transaction mode. |
440 | using (AutoClosingSqlCommand cmd = _Database.Query(sqlPrimShapes)) | 434 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
435 | using (SqlCommand cmd = new SqlCommand()) | ||
441 | { | 436 | { |
437 | cmd.Connection = conn; | ||
438 | cmd.CommandText = sqlPrimShapes; | ||
439 | conn.Open(); | ||
442 | cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); | 440 | cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); |
443 | cmd.ExecuteNonQuery(); | 441 | cmd.ExecuteNonQuery(); |
444 | 442 | ||
@@ -466,24 +464,30 @@ ELSE | |||
466 | 464 | ||
467 | //Delete everything from PrimID | 465 | //Delete everything from PrimID |
468 | //TODO add index on PrimID in DB, if not already exist | 466 | //TODO add index on PrimID in DB, if not already exist |
469 | using (AutoClosingSqlCommand cmd = _Database.Query("DELETE PRIMITEMS WHERE primID = @primID")) | 467 | |
468 | string sql = "DELETE PRIMITEMS WHERE primID = @primID"; | ||
469 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
470 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
470 | { | 471 | { |
471 | cmd.Parameters.Add(_Database.CreateParameter("@primID", primID)); | 472 | cmd.Parameters.Add(_Database.CreateParameter("@primID", primID)); |
473 | conn.Open(); | ||
472 | cmd.ExecuteNonQuery(); | 474 | cmd.ExecuteNonQuery(); |
473 | } | 475 | } |
474 | 476 | ||
475 | string sql = | 477 | sql = |
476 | @"INSERT INTO primitems ( | 478 | @"INSERT INTO primitems ( |
477 | itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID, | 479 | itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID, |
478 | nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags) | 480 | nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags) |
479 | VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID, | 481 | VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID, |
480 | @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)"; | 482 | @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)"; |
481 | 483 | ||
482 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 484 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
485 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
483 | { | 486 | { |
484 | foreach (TaskInventoryItem taskItem in items) | 487 | foreach (TaskInventoryItem taskItem in items) |
485 | { | 488 | { |
486 | cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); | 489 | cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); |
490 | conn.Open(); | ||
487 | cmd.ExecuteNonQuery(); | 491 | cmd.ExecuteNonQuery(); |
488 | 492 | ||
489 | cmd.Parameters.Clear(); | 493 | cmd.Parameters.Clear(); |
@@ -505,11 +509,12 @@ ELSE | |||
505 | 509 | ||
506 | string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; | 510 | string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; |
507 | 511 | ||
508 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 512 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
513 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
509 | { | 514 | { |
510 | // MySqlParameter param = new MySqlParameter(); | 515 | // MySqlParameter param = new MySqlParameter(); |
511 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | 516 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); |
512 | 517 | conn.Open(); | |
513 | using (SqlDataReader reader = cmd.ExecuteReader()) | 518 | using (SqlDataReader reader = cmd.ExecuteReader()) |
514 | { | 519 | { |
515 | int rev; | 520 | int rev; |
@@ -549,19 +554,23 @@ ELSE | |||
549 | 554 | ||
550 | //Delete old terrain map | 555 | //Delete old terrain map |
551 | string sql = "delete from terrain where RegionUUID=@RegionUUID"; | 556 | string sql = "delete from terrain where RegionUUID=@RegionUUID"; |
552 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 557 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
558 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
553 | { | 559 | { |
554 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | 560 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); |
561 | conn.Open(); | ||
555 | cmd.ExecuteNonQuery(); | 562 | cmd.ExecuteNonQuery(); |
556 | } | 563 | } |
557 | 564 | ||
558 | sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)"; | 565 | sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)"; |
559 | 566 | ||
560 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 567 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
568 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
561 | { | 569 | { |
562 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); | 570 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); |
563 | cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision)); | 571 | cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision)); |
564 | cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain))); | 572 | cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain))); |
573 | conn.Open(); | ||
565 | cmd.ExecuteNonQuery(); | 574 | cmd.ExecuteNonQuery(); |
566 | } | 575 | } |
567 | 576 | ||
@@ -580,11 +589,12 @@ ELSE | |||
580 | string sql = "select * from land where RegionUUID = @RegionUUID"; | 589 | string sql = "select * from land where RegionUUID = @RegionUUID"; |
581 | 590 | ||
582 | //Retrieve all land data from region | 591 | //Retrieve all land data from region |
583 | using (AutoClosingSqlCommand cmdLandData = _Database.Query(sql)) | 592 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
593 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
584 | { | 594 | { |
585 | cmdLandData.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID)); | 595 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID)); |
586 | 596 | conn.Open(); | |
587 | using (SqlDataReader readerLandData = cmdLandData.ExecuteReader()) | 597 | using (SqlDataReader readerLandData = cmd.ExecuteReader()) |
588 | { | 598 | { |
589 | while (readerLandData.Read()) | 599 | while (readerLandData.Read()) |
590 | { | 600 | { |
@@ -597,10 +607,12 @@ ELSE | |||
597 | foreach (LandData LandData in LandDataForRegion) | 607 | foreach (LandData LandData in LandDataForRegion) |
598 | { | 608 | { |
599 | sql = "select * from landaccesslist where LandUUID = @LandUUID"; | 609 | sql = "select * from landaccesslist where LandUUID = @LandUUID"; |
600 | using (AutoClosingSqlCommand cmdAccessList = _Database.Query(sql)) | 610 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
611 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
601 | { | 612 | { |
602 | cmdAccessList.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID)); | 613 | cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID)); |
603 | using (SqlDataReader readerAccessList = cmdAccessList.ExecuteReader()) | 614 | conn.Open(); |
615 | using (SqlDataReader readerAccessList = cmd.ExecuteReader()) | ||
604 | { | 616 | { |
605 | while (readerAccessList.Read()) | 617 | while (readerAccessList.Read()) |
606 | { | 618 | { |
@@ -632,17 +644,20 @@ ELSE | |||
632 | VALUES | 644 | VALUES |
633 | (@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; | 645 | (@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; |
634 | 646 | ||
635 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 647 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
648 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
636 | { | 649 | { |
637 | cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID)); | 650 | cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID)); |
638 | 651 | conn.Open(); | |
639 | cmd.ExecuteNonQuery(); | 652 | cmd.ExecuteNonQuery(); |
640 | } | 653 | } |
641 | 654 | ||
642 | sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; | 655 | sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; |
643 | 656 | ||
644 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 657 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
658 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
645 | { | 659 | { |
660 | conn.Open(); | ||
646 | foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) | 661 | foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) |
647 | { | 662 | { |
648 | cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); | 663 | cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); |
@@ -659,15 +674,20 @@ VALUES | |||
659 | /// <param name="globalID">UUID of landobject</param> | 674 | /// <param name="globalID">UUID of landobject</param> |
660 | public void RemoveLandObject(UUID globalID) | 675 | public void RemoveLandObject(UUID globalID) |
661 | { | 676 | { |
662 | using (AutoClosingSqlCommand cmd = _Database.Query("delete from land where UUID=@UUID")) | 677 | string sql = "delete from land where UUID=@UUID"; |
678 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
679 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
663 | { | 680 | { |
664 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); | 681 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); |
682 | conn.Open(); | ||
665 | cmd.ExecuteNonQuery(); | 683 | cmd.ExecuteNonQuery(); |
666 | } | 684 | } |
667 | 685 | sql = "delete from landaccesslist where LandUUID=@UUID"; | |
668 | using (AutoClosingSqlCommand cmd = _Database.Query("delete from landaccesslist where LandUUID=@UUID")) | 686 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
687 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
669 | { | 688 | { |
670 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); | 689 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); |
690 | conn.Open(); | ||
671 | cmd.ExecuteNonQuery(); | 691 | cmd.ExecuteNonQuery(); |
672 | } | 692 | } |
673 | } | 693 | } |
@@ -690,9 +710,11 @@ VALUES | |||
690 | { | 710 | { |
691 | string sql = "select * from regionsettings where regionUUID = @regionUUID"; | 711 | string sql = "select * from regionsettings where regionUUID = @regionUUID"; |
692 | RegionSettings regionSettings; | 712 | RegionSettings regionSettings; |
693 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 713 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
714 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
694 | { | 715 | { |
695 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); | 716 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); |
717 | conn.Open(); | ||
696 | using (SqlDataReader reader = cmd.ExecuteReader()) | 718 | using (SqlDataReader reader = cmd.ExecuteReader()) |
697 | { | 719 | { |
698 | if (reader.Read()) | 720 | if (reader.Read()) |
@@ -724,9 +746,12 @@ VALUES | |||
724 | { | 746 | { |
725 | //Little check if regionUUID already exist in DB | 747 | //Little check if regionUUID already exist in DB |
726 | string regionUUID; | 748 | string regionUUID; |
727 | using (AutoClosingSqlCommand cmd = _Database.Query("SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID")) | 749 | string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID"; |
750 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
751 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
728 | { | 752 | { |
729 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); | 753 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); |
754 | conn.Open(); | ||
730 | regionUUID = cmd.ExecuteScalar().ToString(); | 755 | regionUUID = cmd.ExecuteScalar().ToString(); |
731 | } | 756 | } |
732 | 757 | ||
@@ -737,8 +762,8 @@ VALUES | |||
737 | else | 762 | else |
738 | { | 763 | { |
739 | //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB | 764 | //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB |
740 | string sql = | 765 | sql = |
741 | @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage | 766 | @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage |
742 | ,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide | 767 | ,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide |
743 | ,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity | 768 | ,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity |
744 | ,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics | 769 | ,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics |
@@ -750,10 +775,11 @@ VALUES | |||
750 | ,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id | 775 | ,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id |
751 | WHERE [regionUUID] = @regionUUID"; | 776 | WHERE [regionUUID] = @regionUUID"; |
752 | 777 | ||
753 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 778 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
779 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
754 | { | 780 | { |
755 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | 781 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); |
756 | 782 | conn.Open(); | |
757 | cmd.ExecuteNonQuery(); | 783 | cmd.ExecuteNonQuery(); |
758 | } | 784 | } |
759 | } | 785 | } |
@@ -810,9 +836,11 @@ VALUES | |||
810 | @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, | 836 | @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, |
811 | @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; | 837 | @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; |
812 | 838 | ||
813 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 839 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
840 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
814 | { | 841 | { |
815 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | 842 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); |
843 | conn.Open(); | ||
816 | cmd.ExecuteNonQuery(); | 844 | cmd.ExecuteNonQuery(); |
817 | } | 845 | } |
818 | } | 846 | } |
@@ -916,15 +944,15 @@ VALUES | |||
916 | newData.PassHours = Convert.ToSingle(row["PassHours"]); | 944 | newData.PassHours = Convert.ToSingle(row["PassHours"]); |
917 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); | 945 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); |
918 | 946 | ||
919 | // UUID authedbuyer; | 947 | // UUID authedbuyer; |
920 | // UUID snapshotID; | 948 | // UUID snapshotID; |
921 | // | 949 | // |
922 | // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) | 950 | // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) |
923 | // newData.AuthBuyerID = authedbuyer; | 951 | // newData.AuthBuyerID = authedbuyer; |
924 | // | 952 | // |
925 | // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) | 953 | // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) |
926 | // newData.SnapshotID = snapshotID; | 954 | // newData.SnapshotID = snapshotID; |
927 | newData.AuthBuyerID = new UUID((Guid) row["AuthBuyerID"]); | 955 | newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]); |
928 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); | 956 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); |
929 | 957 | ||
930 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); | 958 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); |
@@ -1193,7 +1221,7 @@ VALUES | |||
1193 | #endregion | 1221 | #endregion |
1194 | 1222 | ||
1195 | #region Create parameters methods | 1223 | #region Create parameters methods |
1196 | 1224 | ||
1197 | /// <summary> | 1225 | /// <summary> |
1198 | /// Creates the prim inventory parameters. | 1226 | /// Creates the prim inventory parameters. |
1199 | /// </summary> | 1227 | /// </summary> |
@@ -1477,7 +1505,7 @@ VALUES | |||
1477 | 1505 | ||
1478 | parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); | 1506 | parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); |
1479 | parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); | 1507 | parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); |
1480 | if (prim.PassTouches) | 1508 | if (prim.PassTouches) |
1481 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); | 1509 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); |
1482 | else | 1510 | else |
1483 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | 1511 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); |
@@ -1532,7 +1560,7 @@ VALUES | |||
1532 | 1560 | ||
1533 | return parameters.ToArray(); | 1561 | return parameters.ToArray(); |
1534 | } | 1562 | } |
1535 | 1563 | ||
1536 | #endregion | 1564 | #endregion |
1537 | 1565 | ||
1538 | #endregion | 1566 | #endregion |