diff options
author | StrawberryFride | 2010-02-24 16:42:39 +0000 |
---|---|---|
committer | Melanie | 2010-02-24 15:50:44 +0000 |
commit | 2fa5694ec9857f208b6fe4d0890fd2ab8ac1b8bf (patch) | |
tree | 672ec2bb3e64b8f930faa9a87801ba9042e2d4f7 /OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | |
parent | Fixed typo that was affecting the BasicInventoryAccessModule (diff) | |
download | opensim-SC_OLD-2fa5694ec9857f208b6fe4d0890fd2ab8ac1b8bf.zip opensim-SC_OLD-2fa5694ec9857f208b6fe4d0890fd2ab8ac1b8bf.tar.gz opensim-SC_OLD-2fa5694ec9857f208b6fe4d0890fd2ab8ac1b8bf.tar.bz2 opensim-SC_OLD-2fa5694ec9857f208b6fe4d0890fd2ab8ac1b8bf.tar.xz |
MSSQL Additions for Presence Refactor branch. Most functionality tested and works, some outstanding issues around login location and border crossings on y axis.
Signed-off-by: Melanie <melanie@t-data.com>
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 6371307..c849f38 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 | } |
@@ -681,9 +701,11 @@ VALUES | |||
681 | { | 701 | { |
682 | string sql = "select * from regionsettings where regionUUID = @regionUUID"; | 702 | string sql = "select * from regionsettings where regionUUID = @regionUUID"; |
683 | RegionSettings regionSettings; | 703 | RegionSettings regionSettings; |
684 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 704 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
705 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
685 | { | 706 | { |
686 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); | 707 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); |
708 | conn.Open(); | ||
687 | using (SqlDataReader reader = cmd.ExecuteReader()) | 709 | using (SqlDataReader reader = cmd.ExecuteReader()) |
688 | { | 710 | { |
689 | if (reader.Read()) | 711 | if (reader.Read()) |
@@ -715,9 +737,12 @@ VALUES | |||
715 | { | 737 | { |
716 | //Little check if regionUUID already exist in DB | 738 | //Little check if regionUUID already exist in DB |
717 | string regionUUID; | 739 | string regionUUID; |
718 | using (AutoClosingSqlCommand cmd = _Database.Query("SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID")) | 740 | string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID"; |
741 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
742 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
719 | { | 743 | { |
720 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); | 744 | cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); |
745 | conn.Open(); | ||
721 | regionUUID = cmd.ExecuteScalar().ToString(); | 746 | regionUUID = cmd.ExecuteScalar().ToString(); |
722 | } | 747 | } |
723 | 748 | ||
@@ -728,8 +753,8 @@ VALUES | |||
728 | else | 753 | else |
729 | { | 754 | { |
730 | //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB | 755 | //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB |
731 | string sql = | 756 | sql = |
732 | @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage | 757 | @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage |
733 | ,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide | 758 | ,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide |
734 | ,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity | 759 | ,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity |
735 | ,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics | 760 | ,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics |
@@ -741,10 +766,11 @@ VALUES | |||
741 | ,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id | 766 | ,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id |
742 | WHERE [regionUUID] = @regionUUID"; | 767 | WHERE [regionUUID] = @regionUUID"; |
743 | 768 | ||
744 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 769 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
770 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
745 | { | 771 | { |
746 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | 772 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); |
747 | 773 | conn.Open(); | |
748 | cmd.ExecuteNonQuery(); | 774 | cmd.ExecuteNonQuery(); |
749 | } | 775 | } |
750 | } | 776 | } |
@@ -801,9 +827,11 @@ VALUES | |||
801 | @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, | 827 | @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, |
802 | @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; | 828 | @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; |
803 | 829 | ||
804 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 830 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
831 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
805 | { | 832 | { |
806 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | 833 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); |
834 | conn.Open(); | ||
807 | cmd.ExecuteNonQuery(); | 835 | cmd.ExecuteNonQuery(); |
808 | } | 836 | } |
809 | } | 837 | } |
@@ -907,15 +935,15 @@ VALUES | |||
907 | newData.PassHours = Convert.ToSingle(row["PassHours"]); | 935 | newData.PassHours = Convert.ToSingle(row["PassHours"]); |
908 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); | 936 | newData.PassPrice = Convert.ToInt32(row["PassPrice"]); |
909 | 937 | ||
910 | // UUID authedbuyer; | 938 | // UUID authedbuyer; |
911 | // UUID snapshotID; | 939 | // UUID snapshotID; |
912 | // | 940 | // |
913 | // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) | 941 | // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) |
914 | // newData.AuthBuyerID = authedbuyer; | 942 | // newData.AuthBuyerID = authedbuyer; |
915 | // | 943 | // |
916 | // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) | 944 | // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) |
917 | // newData.SnapshotID = snapshotID; | 945 | // newData.SnapshotID = snapshotID; |
918 | newData.AuthBuyerID = new UUID((Guid) row["AuthBuyerID"]); | 946 | newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]); |
919 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); | 947 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); |
920 | 948 | ||
921 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); | 949 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); |
@@ -1184,7 +1212,7 @@ VALUES | |||
1184 | #endregion | 1212 | #endregion |
1185 | 1213 | ||
1186 | #region Create parameters methods | 1214 | #region Create parameters methods |
1187 | 1215 | ||
1188 | /// <summary> | 1216 | /// <summary> |
1189 | /// Creates the prim inventory parameters. | 1217 | /// Creates the prim inventory parameters. |
1190 | /// </summary> | 1218 | /// </summary> |
@@ -1468,7 +1496,7 @@ VALUES | |||
1468 | 1496 | ||
1469 | parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); | 1497 | parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); |
1470 | parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); | 1498 | parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); |
1471 | if (prim.PassTouches) | 1499 | if (prim.PassTouches) |
1472 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); | 1500 | parameters.Add(_Database.CreateParameter("PassTouches", 1)); |
1473 | else | 1501 | else |
1474 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); | 1502 | parameters.Add(_Database.CreateParameter("PassTouches", 0)); |
@@ -1523,7 +1551,7 @@ VALUES | |||
1523 | 1551 | ||
1524 | return parameters.ToArray(); | 1552 | return parameters.ToArray(); |
1525 | } | 1553 | } |
1526 | 1554 | ||
1527 | #endregion | 1555 | #endregion |
1528 | 1556 | ||
1529 | #endregion | 1557 | #endregion |