diff options
author | Melanie | 2012-02-18 22:21:10 +0000 |
---|---|---|
committer | Melanie | 2012-02-18 22:21:10 +0000 |
commit | 985526b662f47404404281a3ef4a35afa607bfbf (patch) | |
tree | cbda3c3003b6f456498f0ee3ec6edfc10b5fd64a /OpenSim/Data | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-985526b662f47404404281a3ef4a35afa607bfbf.zip opensim-SC-985526b662f47404404281a3ef4a35afa607bfbf.tar.gz opensim-SC-985526b662f47404404281a3ef4a35afa607bfbf.tar.bz2 opensim-SC-985526b662f47404404281a3ef4a35afa607bfbf.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/SQLite/Resources/RegionStore.migrations | 24 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs | 105 |
2 files changed, 128 insertions, 1 deletions
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 0f40cdc..1ceddf9 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations | |||
@@ -541,4 +541,26 @@ CREATE TABLE regionwindlight ( | |||
541 | cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0', | 541 | cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0', |
542 | draw_classic_clouds INTEGER NOT NULL DEFAULT '1'); | 542 | draw_classic_clouds INTEGER NOT NULL DEFAULT '1'); |
543 | 543 | ||
544 | COMMIT; \ No newline at end of file | 544 | COMMIT; |
545 | |||
546 | |||
547 | :VERSION 24 | ||
548 | |||
549 | BEGIN; | ||
550 | |||
551 | CREATE TABLE IF NOT EXISTS `spawn_points` ( | ||
552 | `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', | ||
553 | `Yaw` float NOT NULL, | ||
554 | `Pitch` float NOT NULL, | ||
555 | `Distance` float NOT NULL | ||
556 | ); | ||
557 | |||
558 | ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
559 | |||
560 | COMMIT; | ||
561 | |||
562 | :VERSION 25 | ||
563 | |||
564 | BEGIN; | ||
565 | ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; | ||
566 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index ce1b7b4..6295113 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite | |||
61 | private const string regionbanListSelect = "select * from regionban"; | 61 | private const string regionbanListSelect = "select * from regionban"; |
62 | private const string regionSettingsSelect = "select * from regionsettings"; | 62 | private const string regionSettingsSelect = "select * from regionsettings"; |
63 | private const string regionWindlightSelect = "select * from regionwindlight"; | 63 | private const string regionWindlightSelect = "select * from regionwindlight"; |
64 | private const string regionSpawnPointsSelect = "select * from spawn_points"; | ||
64 | 65 | ||
65 | private DataSet ds; | 66 | private DataSet ds; |
66 | private SqliteDataAdapter primDa; | 67 | private SqliteDataAdapter primDa; |
@@ -71,6 +72,7 @@ namespace OpenSim.Data.SQLite | |||
71 | private SqliteDataAdapter landAccessListDa; | 72 | private SqliteDataAdapter landAccessListDa; |
72 | private SqliteDataAdapter regionSettingsDa; | 73 | private SqliteDataAdapter regionSettingsDa; |
73 | private SqliteDataAdapter regionWindlightDa; | 74 | private SqliteDataAdapter regionWindlightDa; |
75 | private SqliteDataAdapter regionSpawnPointsDa; | ||
74 | 76 | ||
75 | private SqliteConnection m_conn; | 77 | private SqliteConnection m_conn; |
76 | private String m_connectionString; | 78 | private String m_connectionString; |
@@ -140,6 +142,10 @@ namespace OpenSim.Data.SQLite | |||
140 | 142 | ||
141 | SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); | 143 | SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); |
142 | regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); | 144 | regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); |
145 | |||
146 | SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn); | ||
147 | regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd); | ||
148 | |||
143 | // This actually does the roll forward assembly stuff | 149 | // This actually does the roll forward assembly stuff |
144 | Migration m = new Migration(m_conn, Assembly, "RegionStore"); | 150 | Migration m = new Migration(m_conn, Assembly, "RegionStore"); |
145 | m.Update(); | 151 | m.Update(); |
@@ -170,6 +176,9 @@ namespace OpenSim.Data.SQLite | |||
170 | ds.Tables.Add(createRegionWindlightTable()); | 176 | ds.Tables.Add(createRegionWindlightTable()); |
171 | setupRegionWindlightCommands(regionWindlightDa, m_conn); | 177 | setupRegionWindlightCommands(regionWindlightDa, m_conn); |
172 | 178 | ||
179 | ds.Tables.Add(createRegionSpawnPointsTable()); | ||
180 | setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn); | ||
181 | |||
173 | // WORKAROUND: This is a work around for sqlite on | 182 | // WORKAROUND: This is a work around for sqlite on |
174 | // windows, which gets really unhappy with blob columns | 183 | // windows, which gets really unhappy with blob columns |
175 | // that have no sample data in them. At some point we | 184 | // that have no sample data in them. At some point we |
@@ -246,6 +255,15 @@ namespace OpenSim.Data.SQLite | |||
246 | m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message); | 255 | m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message); |
247 | } | 256 | } |
248 | 257 | ||
258 | try | ||
259 | { | ||
260 | regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]); | ||
261 | } | ||
262 | catch (Exception e) | ||
263 | { | ||
264 | m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on spawn_points table :{0}", e.Message); | ||
265 | } | ||
266 | |||
249 | // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! | 267 | // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! |
250 | // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 | 268 | // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 |
251 | // Possibly because we manually set up our own DataTables before connecting to the database | 269 | // Possibly because we manually set up our own DataTables before connecting to the database |
@@ -257,6 +275,7 @@ namespace OpenSim.Data.SQLite | |||
257 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); | 275 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); |
258 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); | 276 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); |
259 | CreateDataSetMapping(regionWindlightDa, "regionwindlight"); | 277 | CreateDataSetMapping(regionWindlightDa, "regionwindlight"); |
278 | CreateDataSetMapping(regionSpawnPointsDa, "spawn_points"); | ||
260 | } | 279 | } |
261 | } | 280 | } |
262 | catch (Exception e) | 281 | catch (Exception e) |
@@ -319,6 +338,11 @@ namespace OpenSim.Data.SQLite | |||
319 | regionWindlightDa.Dispose(); | 338 | regionWindlightDa.Dispose(); |
320 | regionWindlightDa = null; | 339 | regionWindlightDa = null; |
321 | } | 340 | } |
341 | if (regionSpawnPointsDa != null) | ||
342 | { | ||
343 | regionSpawnPointsDa.Dispose(); | ||
344 | regionWindlightDa = null; | ||
345 | } | ||
322 | } | 346 | } |
323 | 347 | ||
324 | public void StoreRegionSettings(RegionSettings rs) | 348 | public void StoreRegionSettings(RegionSettings rs) |
@@ -339,8 +363,43 @@ namespace OpenSim.Data.SQLite | |||
339 | fillRegionSettingsRow(settingsRow, rs); | 363 | fillRegionSettingsRow(settingsRow, rs); |
340 | } | 364 | } |
341 | 365 | ||
366 | StoreSpawnPoints(rs); | ||
367 | |||
342 | Commit(); | 368 | Commit(); |
343 | } | 369 | } |
370 | |||
371 | } | ||
372 | |||
373 | public void StoreSpawnPoints(RegionSettings rs) | ||
374 | { | ||
375 | lock (ds) | ||
376 | { | ||
377 | // DataTable spawnpoints = ds.Tables["spawn_points"]; | ||
378 | |||
379 | // remove region's spawnpoints | ||
380 | using ( | ||
381 | SqliteCommand cmd = | ||
382 | new SqliteCommand("delete from spawn_points where RegionID=:RegionID", | ||
383 | m_conn)) | ||
384 | { | ||
385 | |||
386 | cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString())); | ||
387 | cmd.ExecuteNonQuery(); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | foreach (SpawnPoint sp in rs.SpawnPoints()) | ||
392 | { | ||
393 | using (SqliteCommand cmd = new SqliteCommand("insert into spawn_points(RegionID, Yaw, Pitch, Distance)" + | ||
394 | "values ( :RegionID, :Yaw, :Pitch, :Distance)", m_conn)) | ||
395 | { | ||
396 | cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString())); | ||
397 | cmd.Parameters.Add(new SqliteParameter(":Yaw", sp.Yaw)); | ||
398 | cmd.Parameters.Add(new SqliteParameter(":Pitch", sp.Pitch)); | ||
399 | cmd.Parameters.Add(new SqliteParameter(":Distance", sp.Distance)); | ||
400 | cmd.ExecuteNonQuery(); | ||
401 | } | ||
402 | } | ||
344 | } | 403 | } |
345 | 404 | ||
346 | /// <summary> | 405 | /// <summary> |
@@ -435,10 +494,31 @@ namespace OpenSim.Data.SQLite | |||
435 | RegionSettings newSettings = buildRegionSettings(row); | 494 | RegionSettings newSettings = buildRegionSettings(row); |
436 | newSettings.OnSave += StoreRegionSettings; | 495 | newSettings.OnSave += StoreRegionSettings; |
437 | 496 | ||
497 | LoadSpawnPoints(newSettings); | ||
498 | |||
438 | return newSettings; | 499 | return newSettings; |
439 | } | 500 | } |
440 | } | 501 | } |
441 | 502 | ||
503 | private void LoadSpawnPoints(RegionSettings rs) | ||
504 | { | ||
505 | rs.ClearSpawnPoints(); | ||
506 | |||
507 | DataTable spawnpoints = ds.Tables["spawn_points"]; | ||
508 | string byRegion = "RegionID = '" + rs.RegionUUID + "'"; | ||
509 | DataRow[] spForRegion = spawnpoints.Select(byRegion); | ||
510 | |||
511 | foreach (DataRow spRow in spForRegion) | ||
512 | { | ||
513 | SpawnPoint sp = new SpawnPoint(); | ||
514 | sp.Pitch = (float)spRow["Pitch"]; | ||
515 | sp.Yaw = (float)spRow["Yaw"]; | ||
516 | sp.Distance = (float)spRow["Distance"]; | ||
517 | |||
518 | rs.AddSpawnPoint(sp); | ||
519 | } | ||
520 | } | ||
521 | |||
442 | /// <summary> | 522 | /// <summary> |
443 | /// Adds an object into region storage | 523 | /// Adds an object into region storage |
444 | /// </summary> | 524 | /// </summary> |
@@ -1265,6 +1345,8 @@ namespace OpenSim.Data.SQLite | |||
1265 | createCol(regionsettings, "covenant", typeof(String)); | 1345 | createCol(regionsettings, "covenant", typeof(String)); |
1266 | createCol(regionsettings, "covenant_datetime", typeof(Int32)); | 1346 | createCol(regionsettings, "covenant_datetime", typeof(Int32)); |
1267 | createCol(regionsettings, "map_tile_ID", typeof(String)); | 1347 | createCol(regionsettings, "map_tile_ID", typeof(String)); |
1348 | createCol(regionsettings, "TelehubObject", typeof(String)); | ||
1349 | createCol(regionsettings, "parcel_tile_ID", typeof(String)); | ||
1268 | regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; | 1350 | regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; |
1269 | return regionsettings; | 1351 | return regionsettings; |
1270 | } | 1352 | } |
@@ -1345,6 +1427,17 @@ namespace OpenSim.Data.SQLite | |||
1345 | return regionwindlight; | 1427 | return regionwindlight; |
1346 | } | 1428 | } |
1347 | 1429 | ||
1430 | private static DataTable createRegionSpawnPointsTable() | ||
1431 | { | ||
1432 | DataTable spawn_points = new DataTable("spawn_points"); | ||
1433 | createCol(spawn_points, "regionID", typeof(String)); | ||
1434 | createCol(spawn_points, "Yaw", typeof(float)); | ||
1435 | createCol(spawn_points, "Pitch", typeof(float)); | ||
1436 | createCol(spawn_points, "Distance", typeof(float)); | ||
1437 | |||
1438 | return spawn_points; | ||
1439 | } | ||
1440 | |||
1348 | /*********************************************************************** | 1441 | /*********************************************************************** |
1349 | * | 1442 | * |
1350 | * Convert between ADO.NET <=> OpenSim Objects | 1443 | * Convert between ADO.NET <=> OpenSim Objects |
@@ -1666,6 +1759,8 @@ namespace OpenSim.Data.SQLite | |||
1666 | newSettings.Covenant = new UUID((String)row["covenant"]); | 1759 | newSettings.Covenant = new UUID((String)row["covenant"]); |
1667 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); | 1760 | newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); |
1668 | newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); | 1761 | newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); |
1762 | newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); | ||
1763 | newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]); | ||
1669 | 1764 | ||
1670 | return newSettings; | 1765 | return newSettings; |
1671 | } | 1766 | } |
@@ -2068,6 +2163,8 @@ namespace OpenSim.Data.SQLite | |||
2068 | row["covenant"] = settings.Covenant.ToString(); | 2163 | row["covenant"] = settings.Covenant.ToString(); |
2069 | row["covenant_datetime"] = settings.CovenantChangedDateTime; | 2164 | row["covenant_datetime"] = settings.CovenantChangedDateTime; |
2070 | row["map_tile_ID"] = settings.TerrainImageID.ToString(); | 2165 | row["map_tile_ID"] = settings.TerrainImageID.ToString(); |
2166 | row["TelehubObject"] = settings.TelehubObject.ToString(); | ||
2167 | row["parcel_tile_ID"] = settings.ParcelImageID.ToString(); | ||
2071 | } | 2168 | } |
2072 | 2169 | ||
2073 | /// <summary> | 2170 | /// <summary> |
@@ -2591,6 +2688,14 @@ namespace OpenSim.Data.SQLite | |||
2591 | da.UpdateCommand.Connection = conn; | 2688 | da.UpdateCommand.Connection = conn; |
2592 | } | 2689 | } |
2593 | 2690 | ||
2691 | private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn) | ||
2692 | { | ||
2693 | da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]); | ||
2694 | da.InsertCommand.Connection = conn; | ||
2695 | da.UpdateCommand = createUpdateCommand("spawn_points", "RegionID=:RegionID", ds.Tables["spawn_points"]); | ||
2696 | da.UpdateCommand.Connection = conn; | ||
2697 | } | ||
2698 | |||
2594 | /// <summary> | 2699 | /// <summary> |
2595 | /// | 2700 | /// |
2596 | /// </summary> | 2701 | /// </summary> |