diff options
author | Chris Hart | 2012-03-04 16:46:54 -0500 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-06 00:27:49 +0000 |
commit | 413bc1e77e07f586f418b14f47fc72ac5b803fa0 (patch) | |
tree | 1cb29f2835a0f400e348493190d2f10964763c6a /OpenSim/Data/MSSQL | |
parent | Add WebProfiles config to other config example (diff) | |
download | opensim-SC-413bc1e77e07f586f418b14f47fc72ac5b803fa0.zip opensim-SC-413bc1e77e07f586f418b14f47fc72ac5b803fa0.tar.gz opensim-SC-413bc1e77e07f586f418b14f47fc72ac5b803fa0.tar.bz2 opensim-SC-413bc1e77e07f586f418b14f47fc72ac5b803fa0.tar.xz |
Updates to MSSQL store for 0.7.3 to include:
* Telehub support
* Bugfix to Friends lookups
* Updates to Creator fields to store up to 255 characters for HG item creator storage
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLFriendsData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 83 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/Resources/RegionStore.migrations | 85 |
4 files changed, 169 insertions, 7 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs index 09dde5e..fef6978 100644 --- a/OpenSim/Data/MSSQL/MSSQLFriendsData.cs +++ b/OpenSim/Data/MSSQL/MSSQLFriendsData.cs | |||
@@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL | |||
89 | return DoQuery(cmd); | 89 | return DoQuery(cmd); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | |||
93 | public FriendsData[] GetFriends(Guid principalID) | ||
94 | { | ||
95 | return GetFriends(principalID.ToString()); | ||
96 | } | ||
97 | |||
92 | } | 98 | } |
93 | } | 99 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 4d06377..961593f 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL | |||
813 | { | 813 | { |
814 | try | 814 | try |
815 | { | 815 | { |
816 | using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection)) | 816 | using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection)) |
817 | { | 817 | { |
818 | command.Parameters.Add(database.CreateParameter("folderID", folderID)); | 818 | command.Parameters.Add(database.CreateParameter("folderID", folderID)); |
819 | 819 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index d6b1561..d9dfe86 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -675,7 +675,7 @@ VALUES | |||
675 | cmd.ExecuteNonQuery(); | 675 | cmd.ExecuteNonQuery(); |
676 | } | 676 | } |
677 | 677 | ||
678 | sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; | 678 | sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)"; |
679 | 679 | ||
680 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 680 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
681 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | 681 | using (SqlCommand cmd = new SqlCommand(sql, conn)) |
@@ -1215,6 +1215,8 @@ VALUES | |||
1215 | //Store new values | 1215 | //Store new values |
1216 | StoreNewRegionSettings(regionSettings); | 1216 | StoreNewRegionSettings(regionSettings); |
1217 | 1217 | ||
1218 | LoadSpawnPoints(regionSettings); | ||
1219 | |||
1218 | return regionSettings; | 1220 | return regionSettings; |
1219 | } | 1221 | } |
1220 | 1222 | ||
@@ -1252,7 +1254,7 @@ VALUES | |||
1252 | ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se | 1254 | ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se |
1253 | ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit | 1255 | ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit |
1254 | ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position | 1256 | ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position |
1255 | ,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id | 1257 | ,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID |
1256 | WHERE [regionUUID] = @regionUUID"; | 1258 | WHERE [regionUUID] = @regionUUID"; |
1257 | 1259 | ||
1258 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 1260 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
@@ -1263,6 +1265,7 @@ VALUES | |||
1263 | cmd.ExecuteNonQuery(); | 1265 | cmd.ExecuteNonQuery(); |
1264 | } | 1266 | } |
1265 | } | 1267 | } |
1268 | SaveSpawnPoints(regionSettings); | ||
1266 | } | 1269 | } |
1267 | 1270 | ||
1268 | public void Shutdown() | 1271 | public void Shutdown() |
@@ -1383,6 +1386,11 @@ VALUES | |||
1383 | newSettings.LoadedCreationID = ""; | 1386 | newSettings.LoadedCreationID = ""; |
1384 | else | 1387 | else |
1385 | newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; | 1388 | newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; |
1389 | |||
1390 | newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]); | ||
1391 | newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]); | ||
1392 | newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]); | ||
1393 | |||
1386 | return newSettings; | 1394 | return newSettings; |
1387 | } | 1395 | } |
1388 | 1396 | ||
@@ -1454,6 +1462,13 @@ VALUES | |||
1454 | } | 1462 | } |
1455 | 1463 | ||
1456 | newData.ParcelAccessList = new List<LandAccessEntry>(); | 1464 | newData.ParcelAccessList = new List<LandAccessEntry>(); |
1465 | newData.MediaDescription = (string)row["MediaDescription"]; | ||
1466 | newData.MediaType = (string)row["MediaType"]; | ||
1467 | newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]); | ||
1468 | newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]); | ||
1469 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); | ||
1470 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); | ||
1471 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); | ||
1457 | 1472 | ||
1458 | return newData; | 1473 | return newData; |
1459 | } | 1474 | } |
@@ -1468,7 +1483,7 @@ VALUES | |||
1468 | LandAccessEntry entry = new LandAccessEntry(); | 1483 | LandAccessEntry entry = new LandAccessEntry(); |
1469 | entry.AgentID = new UUID((Guid)row["AccessUUID"]); | 1484 | entry.AgentID = new UUID((Guid)row["AccessUUID"]); |
1470 | entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); | 1485 | entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); |
1471 | entry.Expires = 0; | 1486 | entry.Expires = Convert.ToInt32(row["Expires"]); |
1472 | return entry; | 1487 | return entry; |
1473 | } | 1488 | } |
1474 | 1489 | ||
@@ -1497,7 +1512,8 @@ VALUES | |||
1497 | prim.TouchName = (string)primRow["TouchName"]; | 1512 | prim.TouchName = (string)primRow["TouchName"]; |
1498 | // permissions | 1513 | // permissions |
1499 | prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); | 1514 | prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); |
1500 | prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); | 1515 | //prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); |
1516 | prim.CreatorIdentification = (string)primRow["CreatorID"]; | ||
1501 | prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); | 1517 | prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); |
1502 | prim.GroupID = new UUID((Guid)primRow["GroupID"]); | 1518 | prim.GroupID = new UUID((Guid)primRow["GroupID"]); |
1503 | prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); | 1519 | prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); |
@@ -1691,7 +1707,8 @@ VALUES | |||
1691 | taskItem.Name = (string)inventoryRow["name"]; | 1707 | taskItem.Name = (string)inventoryRow["name"]; |
1692 | taskItem.Description = (string)inventoryRow["description"]; | 1708 | taskItem.Description = (string)inventoryRow["description"]; |
1693 | taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); | 1709 | taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); |
1694 | taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); | 1710 | //taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); |
1711 | taskItem.CreatorIdentification = (string)inventoryRow["creatorID"]; | ||
1695 | taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); | 1712 | taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); |
1696 | taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); | 1713 | taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); |
1697 | taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); | 1714 | taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); |
@@ -1792,6 +1809,9 @@ VALUES | |||
1792 | parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); | 1809 | parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); |
1793 | parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); | 1810 | parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); |
1794 | parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); | 1811 | parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); |
1812 | parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID)); | ||
1813 | parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID)); | ||
1814 | parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject)); | ||
1795 | 1815 | ||
1796 | return parameters.ToArray(); | 1816 | return parameters.ToArray(); |
1797 | } | 1817 | } |
@@ -1859,6 +1879,7 @@ VALUES | |||
1859 | parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); | 1879 | parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); |
1860 | parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); | 1880 | parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); |
1861 | parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); | 1881 | parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); |
1882 | parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires)); | ||
1862 | 1883 | ||
1863 | return parameters.ToArray(); | 1884 | return parameters.ToArray(); |
1864 | } | 1885 | } |
@@ -2063,5 +2084,57 @@ VALUES | |||
2063 | #endregion | 2084 | #endregion |
2064 | 2085 | ||
2065 | #endregion | 2086 | #endregion |
2087 | |||
2088 | private void LoadSpawnPoints(RegionSettings rs) | ||
2089 | { | ||
2090 | rs.ClearSpawnPoints(); | ||
2091 | |||
2092 | string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID"; | ||
2093 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2094 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2095 | { | ||
2096 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString())); | ||
2097 | conn.Open(); | ||
2098 | using (SqlDataReader reader = cmd.ExecuteReader()) | ||
2099 | { | ||
2100 | if (reader.Read()) | ||
2101 | { | ||
2102 | SpawnPoint sp = new SpawnPoint(); | ||
2103 | |||
2104 | sp.Yaw = (float)reader["Yaw"]; | ||
2105 | sp.Pitch = (float)reader["Pitch"]; | ||
2106 | sp.Distance = (float)reader["Distance"]; | ||
2107 | |||
2108 | rs.AddSpawnPoint(sp); | ||
2109 | } | ||
2110 | } | ||
2111 | } | ||
2112 | } | ||
2113 | |||
2114 | private void SaveSpawnPoints(RegionSettings rs) | ||
2115 | { | ||
2116 | string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID"; | ||
2117 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2118 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2119 | { | ||
2120 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); | ||
2121 | conn.Open(); | ||
2122 | cmd.ExecuteNonQuery(); | ||
2123 | } | ||
2124 | foreach (SpawnPoint p in rs.SpawnPoints()) | ||
2125 | { | ||
2126 | sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)"; | ||
2127 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
2128 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
2129 | { | ||
2130 | cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID)); | ||
2131 | cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw)); | ||
2132 | cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch)); | ||
2133 | cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance)); | ||
2134 | conn.Open(); | ||
2135 | cmd.ExecuteNonQuery(); | ||
2136 | } | ||
2137 | } | ||
2138 | } | ||
2066 | } | 2139 | } |
2067 | } | 2140 | } |
diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations index a98690a..d6a3be9 100644 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations | |||
@@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL | |||
1044 | 1044 | ||
1045 | COMMIT | 1045 | COMMIT |
1046 | 1046 | ||
1047 | :VERSION 29 #--------------------- | 1047 | :VERSION 29 #----------------- Region Covenant changed time |
1048 | 1048 | ||
1049 | BEGIN TRANSACTION | 1049 | BEGIN TRANSACTION |
1050 | 1050 | ||
1051 | ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 | 1051 | ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 |
1052 | 1052 | ||
1053 | COMMIT | 1053 | COMMIT |
1054 | |||
1055 | :VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support | ||
1056 | |||
1057 | BEGIN TRANSACTION | ||
1058 | |||
1059 | EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN' | ||
1060 | EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN' | ||
1061 | |||
1062 | COMMIT | ||
1063 | |||
1064 | :VERSION 31 #--------------------- | ||
1065 | |||
1066 | BEGIN TRANSACTION | ||
1067 | |||
1068 | ALTER TABLE prims ADD CreatorID varchar(255) | ||
1069 | ALTER TABLE primitems ADD CreatorID varchar(255) | ||
1070 | |||
1071 | COMMIT | ||
1072 | |||
1073 | :VERSION 32 #--------------------- | ||
1074 | |||
1075 | BEGIN TRANSACTION | ||
1076 | |||
1077 | UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold) | ||
1078 | UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold) | ||
1079 | |||
1080 | COMMIT | ||
1081 | |||
1082 | :VERSION 33 #--------------------- | ||
1083 | |||
1084 | BEGIN TRANSACTION | ||
1085 | |||
1086 | ALTER TABLE prims | ||
1087 | ADD CONSTRAINT DF_prims_CreatorIDNew | ||
1088 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1089 | FOR CreatorID | ||
1090 | |||
1091 | ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL | ||
1092 | |||
1093 | ALTER TABLE primitems | ||
1094 | ADD CONSTRAINT DF_primitems_CreatorIDNew | ||
1095 | DEFAULT '00000000-0000-0000-0000-000000000000' | ||
1096 | FOR CreatorID | ||
1097 | |||
1098 | ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL | ||
1099 | |||
1100 | COMMIT | ||
1101 | |||
1102 | :VERSION 34 #--------------- Telehub support | ||
1103 | |||
1104 | BEGIN TRANSACTION | ||
1105 | |||
1106 | CREATE TABLE [dbo].[Spawn_Points]( | ||
1107 | [RegionUUID] [uniqueidentifier] NOT NULL, | ||
1108 | [Yaw] [float] NOT NULL, | ||
1109 | [Pitch] [float] NOT NULL, | ||
1110 | [Distance] [float] NOT NULL, | ||
1111 | PRIMARY KEY CLUSTERED | ||
1112 | ( | ||
1113 | [RegionUUID] ASC | ||
1114 | )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] | ||
1115 | ) ON [PRIMARY] | ||
1116 | |||
1117 | ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
1118 | |||
1119 | COMMIT | ||
1120 | |||
1121 | :VERSION 35 #---------------- Parcels for sale | ||
1122 | |||
1123 | BEGIN TRANSACTION | ||
1124 | |||
1125 | ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
1126 | |||
1127 | COMMIT | ||
1128 | |||
1129 | :VERSION 36 #---------------- Timed bans/access | ||
1130 | |||
1131 | BEGIN TRANSACTION | ||
1132 | |||
1133 | ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0; | ||
1134 | |||
1135 | COMMIT | ||
1136 | |||