diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 35 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullSimulationData.cs | 9 | ||||
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs | 28 |
4 files changed, 105 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 1a57199..ab24b76 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -733,6 +733,41 @@ namespace OpenSim.Data.MySQL | |||
733 | return terrData; | 733 | return terrData; |
734 | } | 734 | } |
735 | 735 | ||
736 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
737 | { | ||
738 | TerrainData terrData = null; | ||
739 | |||
740 | lock (m_dbLock) | ||
741 | { | ||
742 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
743 | { | ||
744 | dbcon.Open(); | ||
745 | |||
746 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
747 | { | ||
748 | cmd.CommandText = "select RegionUUID, Revision, Heightfield " + | ||
749 | "from bakedterrain where RegionUUID = ?RegionUUID "; | ||
750 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
751 | |||
752 | using (IDataReader reader = ExecuteReader(cmd)) | ||
753 | { | ||
754 | while (reader.Read()) | ||
755 | { | ||
756 | int rev = Convert.ToInt32(reader["Revision"]); | ||
757 | if ((reader["Heightfield"] != DBNull.Value)) | ||
758 | { | ||
759 | byte[] blob = (byte[])reader["Heightfield"]; | ||
760 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
761 | } | ||
762 | } | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | } | ||
767 | |||
768 | return terrData; | ||
769 | } | ||
770 | |||
736 | public virtual void RemoveLandObject(UUID globalID) | 771 | public virtual void RemoveLandObject(UUID globalID) |
737 | { | 772 | { |
738 | lock (m_dbLock) | 773 | lock (m_dbLock) |
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 5ea8bfa..7bb6da3 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -175,6 +175,15 @@ namespace OpenSim.Data.Null | |||
175 | return null; | 175 | return null; |
176 | } | 176 | } |
177 | 177 | ||
178 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
179 | { | ||
180 | if (m_bakedterrains.ContainsKey(regionID)) | ||
181 | { | ||
182 | return m_bakedterrains[regionID]; | ||
183 | } | ||
184 | return null; | ||
185 | } | ||
186 | |||
178 | public void RemoveLandObject(UUID globalID) | 187 | public void RemoveLandObject(UUID globalID) |
179 | { | 188 | { |
180 | } | 189 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index e6161a2..902aae0 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -573,6 +573,39 @@ namespace OpenSim.Data.PGSQL | |||
573 | return terrData; | 573 | return terrData; |
574 | } | 574 | } |
575 | 575 | ||
576 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
577 | { | ||
578 | TerrainData terrData = null; | ||
579 | |||
580 | string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain | ||
581 | where ""RegionUUID"" = :RegionUUID; "; | ||
582 | |||
583 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
584 | { | ||
585 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
586 | { | ||
587 | // PGSqlParameter param = new PGSqlParameter(); | ||
588 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
589 | conn.Open(); | ||
590 | using (NpgsqlDataReader reader = cmd.ExecuteReader()) | ||
591 | { | ||
592 | int rev; | ||
593 | if (reader.Read()) | ||
594 | { | ||
595 | rev = Convert.ToInt32(reader["Revision"]); | ||
596 | if ((reader["Heightfield"] != DBNull.Value)) | ||
597 | { | ||
598 | byte[] blob = (byte[])reader["Heightfield"]; | ||
599 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
600 | } | ||
601 | } | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | |||
606 | return terrData; | ||
607 | } | ||
608 | |||
576 | // Legacy entry point for when terrain was always a 256x256 heightmap | 609 | // Legacy entry point for when terrain was always a 256x256 heightmap |
577 | public void StoreTerrain(double[,] terrain, UUID regionID) | 610 | public void StoreTerrain(double[,] terrain, UUID regionID) |
578 | { | 611 | { |
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 76b367a..0d565f7 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -950,6 +950,34 @@ namespace OpenSim.Data.SQLite | |||
950 | return terrData; | 950 | return terrData; |
951 | } | 951 | } |
952 | 952 | ||
953 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
954 | { | ||
955 | TerrainData terrData = null; | ||
956 | |||
957 | lock (ds) | ||
958 | { | ||
959 | String sql = "select RegionUUID, Revision, Heightfield from backedterrain" + | ||
960 | " where RegionUUID=:RegionUUID"; | ||
961 | |||
962 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
963 | { | ||
964 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
965 | |||
966 | using (IDataReader row = cmd.ExecuteReader()) | ||
967 | { | ||
968 | int rev = 0; | ||
969 | if (row.Read()) | ||
970 | { | ||
971 | rev = Convert.ToInt32(row["Revision"]); | ||
972 | byte[] blob = (byte[])row["Heightfield"]; | ||
973 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
974 | } | ||
975 | } | ||
976 | } | ||
977 | } | ||
978 | return terrData; | ||
979 | } | ||
980 | |||
953 | public void RemoveLandObject(UUID globalID) | 981 | public void RemoveLandObject(UUID globalID) |
954 | { | 982 | { |
955 | lock (ds) | 983 | lock (ds) |