diff options
Diffstat (limited to 'OpenSim/Framework/Data.MySQL')
4 files changed, 72 insertions, 4 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 3737e48..eefb4e9 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -97,6 +97,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
97 | database.ExecuteResourceSql("CreateRegionsTable.sql"); | 97 | database.ExecuteResourceSql("CreateRegionsTable.sql"); |
98 | return; | 98 | return; |
99 | } | 99 | } |
100 | else if (oldVersion.Contains("Rev. 1")) | ||
101 | { | ||
102 | database.ExecuteResourceSql("UpgradeRegionsTableToVersion2.sql"); | ||
103 | return; | ||
104 | } | ||
100 | } | 105 | } |
101 | 106 | ||
102 | #endregion | 107 | #endregion |
@@ -260,6 +265,27 @@ namespace OpenSim.Framework.Data.MySQL | |||
260 | } | 265 | } |
261 | 266 | ||
262 | /// <summary> | 267 | /// <summary> |
268 | /// Deletes a profile from the database | ||
269 | /// </summary> | ||
270 | /// <param name="profile">The profile to delete</param> | ||
271 | /// <returns>Successful?</returns> | ||
272 | //public DataResponse DeleteProfile(RegionProfileData profile) | ||
273 | public DataResponse DeleteProfile(string uuid) | ||
274 | { | ||
275 | lock (database) | ||
276 | { | ||
277 | if (database.deleteRegion(uuid)) | ||
278 | { | ||
279 | return DataResponse.RESPONSE_OK; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | return DataResponse.RESPONSE_ERROR; | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | |||
288 | /// <summary> | ||
263 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 289 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
264 | /// </summary> | 290 | /// </summary> |
265 | /// <param name="uuid">The UUID of the challenger</param> | 291 | /// <param name="uuid">The UUID of the challenger</param> |
@@ -328,4 +354,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
328 | } | 354 | } |
329 | } | 355 | } |
330 | } | 356 | } |
331 | } \ No newline at end of file | 357 | } |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index ea11aa0..0410643 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs | |||
@@ -301,6 +301,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
301 | 301 | ||
302 | // non-critical parts | 302 | // non-critical parts |
303 | retval.regionName = (string)reader["regionName"]; | 303 | retval.regionName = (string)reader["regionName"]; |
304 | retval.originUUID = new LLUUID((string) reader["originUUID"]); | ||
304 | 305 | ||
305 | // Secrets | 306 | // Secrets |
306 | retval.regionRecvKey = (string) reader["regionRecvKey"]; | 307 | retval.regionRecvKey = (string) reader["regionRecvKey"]; |
@@ -752,13 +753,13 @@ namespace OpenSim.Framework.Data.MySQL | |||
752 | // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, | 753 | // server for the UUID of the region's owner (master avatar). It consists of the addition of the column and value to the relevant sql, |
753 | // as well as the related parameterization | 754 | // as well as the related parameterization |
754 | sql += | 755 | sql += |
755 | "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid) VALUES "; | 756 | "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) VALUES "; |
756 | 757 | ||
757 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; | 758 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; |
758 | sql += | 759 | sql += |
759 | "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; | 760 | "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; |
760 | sql += | 761 | sql += |
761 | "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid)"; | 762 | "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort, ?owner_uuid, ?originUUID)"; |
762 | 763 | ||
763 | if (GRID_ONLY_UPDATE_NECESSARY_DATA) | 764 | if (GRID_ONLY_UPDATE_NECESSARY_DATA) |
764 | { | 765 | { |
@@ -798,6 +799,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
798 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); | 799 | parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); |
799 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); | 800 | parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); |
800 | parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); | 801 | parameters["?owner_uuid"] = regiondata.owner_uuid.ToString(); |
802 | parameters["?originUUID"] = regiondata.originUUID.ToString(); | ||
801 | 803 | ||
802 | bool returnval = false; | 804 | bool returnval = false; |
803 | 805 | ||
@@ -821,5 +823,41 @@ namespace OpenSim.Framework.Data.MySQL | |||
821 | 823 | ||
822 | return returnval; | 824 | return returnval; |
823 | } | 825 | } |
826 | /// <summary> | ||
827 | /// Delete a region from the database | ||
828 | /// </summary> | ||
829 | /// <param name="profile">The region to insert</param> | ||
830 | /// <returns>Success?</returns> | ||
831 | //public bool deleteRegion(RegionProfileData regiondata) | ||
832 | public bool deleteRegion(string uuid) | ||
833 | { | ||
834 | bool returnval = false; | ||
835 | |||
836 | string sql = | ||
837 | "DELETE FROM regions WHERE uuid = ?uuid;"; | ||
838 | |||
839 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
840 | |||
841 | try | ||
842 | { | ||
843 | parameters["?uuid"] = uuid; | ||
844 | |||
845 | IDbCommand result = Query(sql, parameters); | ||
846 | |||
847 | int x; | ||
848 | if ((x = result.ExecuteNonQuery()) > 0) | ||
849 | { | ||
850 | returnval = true; | ||
851 | } | ||
852 | result.Dispose(); | ||
853 | } | ||
854 | catch (Exception e) | ||
855 | { | ||
856 | m_log.Error(e.ToString()); | ||
857 | return false; | ||
858 | } | ||
859 | |||
860 | return returnval; | ||
861 | } | ||
824 | } | 862 | } |
825 | } | 863 | } |
diff --git a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql index 07b0d9b..23535af 100644 --- a/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql +++ b/OpenSim/Framework/Data.MySQL/Resources/CreateRegionsTable.sql | |||
@@ -23,8 +23,9 @@ CREATE TABLE `regions` ( | |||
23 | `regionUserRecvKey` varchar(128) default NULL, | 23 | `regionUserRecvKey` varchar(128) default NULL, |
24 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, | 24 | `regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL, |
25 | `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, | 25 | `serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL, |
26 | `originUUID` varchar(36), | ||
26 | PRIMARY KEY (`uuid`), | 27 | PRIMARY KEY (`uuid`), |
27 | KEY `regionName` (`regionName`), | 28 | KEY `regionName` (`regionName`), |
28 | KEY `regionHandle` (`regionHandle`), | 29 | KEY `regionHandle` (`regionHandle`), |
29 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) | 30 | KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`) |
30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 1'; | 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 2'; |
diff --git a/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql new file mode 100644 index 0000000..5880954 --- /dev/null +++ b/OpenSim/Framework/Data.MySQL/Resources/UpgradeRegionsTableToVersion2.sql | |||
@@ -0,0 +1,3 @@ | |||
1 | ALTER TABLE `regions` | ||
2 | ADD COLUMN `originUUID` varchar(36), | ||
3 | COMMENT='Rev. 2'; | ||