diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLRegionData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLRegionData.cs | 82 |
1 files changed, 30 insertions, 52 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 95f6037..5faaec4 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -101,8 +101,6 @@ namespace OpenSim.Data.MSSQL | |||
101 | using (SqlCommand primSelectCmd = new SqlCommand(_PrimSelect, connection)) | 101 | using (SqlCommand primSelectCmd = new SqlCommand(_PrimSelect, connection)) |
102 | { | 102 | { |
103 | primSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); | 103 | primSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); |
104 | //primSelectCmd.Parameters.AddWithValue("@SceneGroupID", "%"); | ||
105 | //primSelectCmd.Parameters.AddWithValue("@UUID", ""); | ||
106 | _PrimDataAdapter = new SqlDataAdapter(primSelectCmd); | 104 | _PrimDataAdapter = new SqlDataAdapter(primSelectCmd); |
107 | 105 | ||
108 | DataTable primDataTable = new DataTable("prims"); | 106 | DataTable primDataTable = new DataTable("prims"); |
@@ -110,8 +108,7 @@ namespace OpenSim.Data.MSSQL | |||
110 | primDataTable.PrimaryKey = new DataColumn[] { primDataTable.Columns["UUID"] }; | 108 | primDataTable.PrimaryKey = new DataColumn[] { primDataTable.Columns["UUID"] }; |
111 | _PrimsDataSet.Tables.Add(primDataTable); | 109 | _PrimsDataSet.Tables.Add(primDataTable); |
112 | 110 | ||
113 | SetupCommands(_PrimDataAdapter); //, connection); | 111 | SetupCommands(_PrimDataAdapter); |
114 | //SetupPrimCommands(_PrimDataAdapter, connection); | ||
115 | 112 | ||
116 | primDataTable.Clear(); | 113 | primDataTable.Clear(); |
117 | } | 114 | } |
@@ -119,8 +116,6 @@ namespace OpenSim.Data.MSSQL | |||
119 | using (SqlCommand shapeSelectCmd = new SqlCommand(_ShapeSelect, connection)) | 116 | using (SqlCommand shapeSelectCmd = new SqlCommand(_ShapeSelect, connection)) |
120 | { | 117 | { |
121 | shapeSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); | 118 | shapeSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); |
122 | //shapeSelectCmd.Parameters.AddWithValue("@SceneGroupID", "%"); | ||
123 | //shapeSelectCmd.Parameters.AddWithValue("@UUID", ""); | ||
124 | _ShapeDataAdapter = new SqlDataAdapter(shapeSelectCmd); | 119 | _ShapeDataAdapter = new SqlDataAdapter(shapeSelectCmd); |
125 | 120 | ||
126 | DataTable shapeDataTable = new DataTable("primshapes"); | 121 | DataTable shapeDataTable = new DataTable("primshapes"); |
@@ -128,8 +123,7 @@ namespace OpenSim.Data.MSSQL | |||
128 | shapeDataTable.PrimaryKey = new DataColumn[] { shapeDataTable.Columns["UUID"] }; | 123 | shapeDataTable.PrimaryKey = new DataColumn[] { shapeDataTable.Columns["UUID"] }; |
129 | _PrimsDataSet.Tables.Add(shapeDataTable); | 124 | _PrimsDataSet.Tables.Add(shapeDataTable); |
130 | 125 | ||
131 | SetupCommands(_ShapeDataAdapter); //, connection); | 126 | SetupCommands(_ShapeDataAdapter); |
132 | //SetupShapeCommands(_ShapeDataAdapter, connection); | ||
133 | 127 | ||
134 | shapeDataTable.Clear(); | 128 | shapeDataTable.Clear(); |
135 | } | 129 | } |
@@ -137,8 +131,6 @@ namespace OpenSim.Data.MSSQL | |||
137 | using (SqlCommand itemSelectCmd = new SqlCommand(_ItemsSelect, connection)) | 131 | using (SqlCommand itemSelectCmd = new SqlCommand(_ItemsSelect, connection)) |
138 | { | 132 | { |
139 | itemSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); | 133 | itemSelectCmd.Parameters.AddWithValue("@RegionUUID", ""); |
140 | //itemSelectCmd.Parameters.AddWithValue("@SceneGroupID", "%"); | ||
141 | //itemSelectCmd.Parameters.AddWithValue("@UUID", ""); | ||
142 | _ItemsDataAdapter = new SqlDataAdapter(itemSelectCmd); | 134 | _ItemsDataAdapter = new SqlDataAdapter(itemSelectCmd); |
143 | 135 | ||
144 | DataTable itemsDataTable = new DataTable("primitems"); | 136 | DataTable itemsDataTable = new DataTable("primitems"); |
@@ -146,8 +138,7 @@ namespace OpenSim.Data.MSSQL | |||
146 | itemsDataTable.PrimaryKey = new DataColumn[] { itemsDataTable.Columns["itemID"] }; | 138 | itemsDataTable.PrimaryKey = new DataColumn[] { itemsDataTable.Columns["itemID"] }; |
147 | _PrimsDataSet.Tables.Add(itemsDataTable); | 139 | _PrimsDataSet.Tables.Add(itemsDataTable); |
148 | 140 | ||
149 | SetupCommands(_ItemsDataAdapter); //, connection); | 141 | SetupCommands(_ItemsDataAdapter); |
150 | //SetupItemsCommands(_ItemsDataAdapter, connection); | ||
151 | 142 | ||
152 | itemsDataTable.Clear(); | 143 | itemsDataTable.Clear(); |
153 | } | 144 | } |
@@ -328,11 +319,6 @@ namespace OpenSim.Data.MSSQL | |||
328 | //Retrieve all values of current region, and current scene/or prims | 319 | //Retrieve all values of current region, and current scene/or prims |
329 | //Build primID's, we use IN so I can select all prims from objgroup | 320 | //Build primID's, we use IN so I can select all prims from objgroup |
330 | string primID = ""; | 321 | string primID = ""; |
331 | // foreach (SceneObjectPart prim in obj.Children.Values) | ||
332 | // { | ||
333 | // primID += prim.UUID + "', '"; | ||
334 | // } | ||
335 | // primID = primID.Remove(primID.LastIndexOf("',")); | ||
336 | 322 | ||
337 | lock (_Database) | 323 | lock (_Database) |
338 | { | 324 | { |
@@ -352,14 +338,12 @@ namespace OpenSim.Data.MSSQL | |||
352 | DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); | 338 | DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); |
353 | if (primRow == null) | 339 | if (primRow == null) |
354 | { | 340 | { |
355 | // _Log.DebugFormat("[REGION DB]: Adding new prim with key: {0}", prim.UUID); | ||
356 | primRow = prims.NewRow(); | 341 | primRow = prims.NewRow(); |
357 | fillPrimRow(primRow, prim, obj.UUID, regionUUID); | 342 | fillPrimRow(primRow, prim, obj.UUID, regionUUID); |
358 | prims.Rows.Add(primRow); | 343 | prims.Rows.Add(primRow); |
359 | } | 344 | } |
360 | else | 345 | else |
361 | { | 346 | { |
362 | // _Log.DebugFormat("[REGION DB]: Changing prim with key: {0}", prim.UUID); | ||
363 | fillPrimRow(primRow, prim, obj.UUID, regionUUID); | 347 | fillPrimRow(primRow, prim, obj.UUID, regionUUID); |
364 | } | 348 | } |
365 | 349 | ||
@@ -440,11 +424,9 @@ namespace OpenSim.Data.MSSQL | |||
440 | 424 | ||
441 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 425 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) |
442 | { | 426 | { |
443 | foreach (TaskInventoryItem newItem in items) | 427 | foreach (TaskInventoryItem taskItem in items) |
444 | { | 428 | { |
445 | // | 429 | cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); |
446 | cmd.Parameters.AddRange(CreatePrimInventoryParameters(newItem)); | ||
447 | |||
448 | cmd.ExecuteNonQuery(); | 430 | cmd.ExecuteNonQuery(); |
449 | 431 | ||
450 | cmd.Parameters.Clear(); | 432 | cmd.Parameters.Clear(); |
@@ -547,7 +529,6 @@ namespace OpenSim.Data.MSSQL | |||
547 | { | 529 | { |
548 | while (readerLandData.Read()) | 530 | while (readerLandData.Read()) |
549 | { | 531 | { |
550 | // LandData data = buildLandData(readerLandData); | ||
551 | landDataForRegion.Add(buildLandData(readerLandData)); | 532 | landDataForRegion.Add(buildLandData(readerLandData)); |
552 | } | 533 | } |
553 | } | 534 | } |
@@ -605,10 +586,9 @@ VALUES | |||
605 | { | 586 | { |
606 | foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.landData.ParcelAccessList) | 587 | foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.landData.ParcelAccessList) |
607 | { | 588 | { |
608 | cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.regionUUID)); | 589 | cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.regionUUID)); |
609 | 590 | ||
610 | cmd.ExecuteNonQuery(); | 591 | cmd.ExecuteNonQuery(); |
611 | |||
612 | cmd.Parameters.Clear(); | 592 | cmd.Parameters.Clear(); |
613 | } | 593 | } |
614 | } | 594 | } |
@@ -699,7 +679,7 @@ VALUES | |||
699 | ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se | 679 | ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se |
700 | ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit | 680 | ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit |
701 | ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position | 681 | ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position |
702 | ,[covenant] = @covenant ,[Sandbox] = @Sandbox WHERE [regionUUID] = @regionUUID"; | 682 | ,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox WHERE [regionUUID] = @regionUUID"; |
703 | 683 | ||
704 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 684 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) |
705 | { | 685 | { |
@@ -779,13 +759,21 @@ VALUES | |||
779 | private void StoreNewRegionSettings(RegionSettings regionSettings) | 759 | private void StoreNewRegionSettings(RegionSettings regionSettings) |
780 | { | 760 | { |
781 | string sql = @"INSERT INTO [regionsettings] | 761 | string sql = @"INSERT INTO [regionsettings] |
782 | ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide],[block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],[terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],[elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],[terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[Sandbox]) VALUES | 762 | ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide], |
783 | (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,@block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,@terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,@elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,@terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@Sandbox)"; | 763 | [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], |
764 | [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], | ||
765 | [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], | ||
766 | [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[Sandbox]) | ||
767 | VALUES | ||
768 | (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, | ||
769 | @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,@terrain_texture_1, | ||
770 | @terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,@elevation_2_ne, | ||
771 | @elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,@terrain_lower_limit, | ||
772 | @use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox)"; | ||
784 | 773 | ||
785 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) | 774 | using (AutoClosingSqlCommand cmd = _Database.Query(sql)) |
786 | { | 775 | { |
787 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); | 776 | cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); |
788 | |||
789 | cmd.ExecuteNonQuery(); | 777 | cmd.ExecuteNonQuery(); |
790 | } | 778 | } |
791 | } | 779 | } |
@@ -835,6 +823,11 @@ VALUES | |||
835 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); | 823 | newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); |
836 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | 824 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); |
837 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | 825 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); |
826 | newSettings.SunVector = new Vector3( | ||
827 | Convert.ToSingle(row["sunvectorx"]), | ||
828 | Convert.ToSingle(row["sunvectory"]), | ||
829 | Convert.ToSingle(row["sunvectorz"]) | ||
830 | ); | ||
838 | newSettings.Covenant = new UUID((String)row["covenant"]); | 831 | newSettings.Covenant = new UUID((String)row["covenant"]); |
839 | 832 | ||
840 | return newSettings; | 833 | return newSettings; |
@@ -1147,7 +1140,6 @@ VALUES | |||
1147 | #endregion | 1140 | #endregion |
1148 | 1141 | ||
1149 | #region Create parameters methods | 1142 | #region Create parameters methods |
1150 | |||
1151 | /// <summary> | 1143 | /// <summary> |
1152 | /// Creates the prim inventory parameters. | 1144 | /// Creates the prim inventory parameters. |
1153 | /// </summary> | 1145 | /// </summary> |
@@ -1189,7 +1181,7 @@ VALUES | |||
1189 | /// <returns></returns> | 1181 | /// <returns></returns> |
1190 | private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings) | 1182 | private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings) |
1191 | { | 1183 | { |
1192 | SqlParameter[] parameters = new SqlParameter[34]; | 1184 | SqlParameter[] parameters = new SqlParameter[37]; |
1193 | 1185 | ||
1194 | parameters[0] = _Database.CreateParameter("regionUUID", settings.RegionUUID); | 1186 | parameters[0] = _Database.CreateParameter("regionUUID", settings.RegionUUID); |
1195 | parameters[1] = _Database.CreateParameter("block_terraform", settings.BlockTerraform); | 1187 | parameters[1] = _Database.CreateParameter("block_terraform", settings.BlockTerraform); |
@@ -1224,7 +1216,10 @@ VALUES | |||
1224 | parameters[30] = _Database.CreateParameter("sandbox", settings.Sandbox); | 1216 | parameters[30] = _Database.CreateParameter("sandbox", settings.Sandbox); |
1225 | parameters[31] = _Database.CreateParameter("fixed_sun", settings.FixedSun); | 1217 | parameters[31] = _Database.CreateParameter("fixed_sun", settings.FixedSun); |
1226 | parameters[32] = _Database.CreateParameter("sun_position", settings.SunPosition); | 1218 | parameters[32] = _Database.CreateParameter("sun_position", settings.SunPosition); |
1227 | parameters[33] = _Database.CreateParameter("covenant", settings.Covenant); | 1219 | parameters[33] = _Database.CreateParameter("sunvectorx", settings.SunVector.X); |
1220 | parameters[34] = _Database.CreateParameter("sunvectory", settings.SunVector.Y); | ||
1221 | parameters[35] = _Database.CreateParameter("sunvectorz", settings.SunVector.Z); | ||
1222 | parameters[36] = _Database.CreateParameter("covenant", settings.Covenant); | ||
1228 | 1223 | ||
1229 | return parameters; | 1224 | return parameters; |
1230 | } | 1225 | } |
@@ -1298,6 +1293,7 @@ VALUES | |||
1298 | } | 1293 | } |
1299 | 1294 | ||
1300 | /// <summary> | 1295 | /// <summary> |
1296 | /// <summary> | ||
1301 | /// Fills/Updates the prim datarow. | 1297 | /// Fills/Updates the prim datarow. |
1302 | /// </summary> | 1298 | /// </summary> |
1303 | /// <param name="row">datarow.</param> | 1299 | /// <param name="row">datarow.</param> |
@@ -1480,34 +1476,16 @@ VALUES | |||
1480 | { | 1476 | { |
1481 | _PrimDataAdapter.SelectCommand.Connection = connection; | 1477 | _PrimDataAdapter.SelectCommand.Connection = connection; |
1482 | _PrimDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); | 1478 | _PrimDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); |
1483 | // if (sceneGroupID != UUID.Zero) | ||
1484 | // _PrimDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = sceneGroupID.ToString(); | ||
1485 | // else | ||
1486 | // _PrimDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = "%"; | ||
1487 | // _PrimDataAdapter.SelectCommand.Parameters["@UUID"].Value = primID; | ||
1488 | |||
1489 | _PrimDataAdapter.Fill(_PrimsDataSet, "prims"); | 1479 | _PrimDataAdapter.Fill(_PrimsDataSet, "prims"); |
1490 | 1480 | ||
1491 | _Log.Debug("Prim row count: " + _PrimsDataSet.Tables["prims"].Rows.Count); | 1481 | _Log.Debug("Prim row count: " + _PrimsDataSet.Tables["prims"].Rows.Count); |
1492 | 1482 | ||
1493 | _ShapeDataAdapter.SelectCommand.Connection = connection; | 1483 | _ShapeDataAdapter.SelectCommand.Connection = connection; |
1494 | _ShapeDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); | 1484 | _ShapeDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); |
1495 | // if (sceneGroupID != UUID.Zero) | ||
1496 | // _ShapeDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = sceneGroupID.ToString(); | ||
1497 | // else | ||
1498 | // _ShapeDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = "%"; | ||
1499 | // _ShapeDataAdapter.SelectCommand.Parameters["@UUID"].Value = primID; | ||
1500 | |||
1501 | _ShapeDataAdapter.Fill(_PrimsDataSet, "primshapes"); | 1485 | _ShapeDataAdapter.Fill(_PrimsDataSet, "primshapes"); |
1502 | 1486 | ||
1503 | _ItemsDataAdapter.SelectCommand.Connection = connection; | 1487 | _ItemsDataAdapter.SelectCommand.Connection = connection; |
1504 | _ItemsDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); | 1488 | _ItemsDataAdapter.SelectCommand.Parameters["@RegionUUID"].Value = regionUUID.ToString(); |
1505 | // if (sceneGroupID != UUID.Zero) | ||
1506 | // _ItemsDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = sceneGroupID.ToString(); | ||
1507 | // else | ||
1508 | // _ItemsDataAdapter.SelectCommand.Parameters["@SceneGroupID"].Value = "%"; | ||
1509 | // _ItemsDataAdapter.SelectCommand.Parameters["@UUID"].Value = primID; | ||
1510 | |||
1511 | _ItemsDataAdapter.Fill(_PrimsDataSet, "primitems"); | 1489 | _ItemsDataAdapter.Fill(_PrimsDataSet, "primitems"); |
1512 | } | 1490 | } |
1513 | } | 1491 | } |