From bc543c1797c629a8584dd2e74d3c5f7a67de96c9 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Wed, 23 May 2012 21:06:25 +0200 Subject: Environment Module - allows Environment settings for Viewer3 warning: includes database region store migrations for mssql, mysql, sqlite enable/disable this module: Cap_EnvironmentSettings = "localhost" (for enable) Cap_EnvironmentSettings = "" (for disable) at ClientStack.LindenCaps section (OpenSimDefaults.ini file) or owerwrite in OpenSim.ini mantis: http://opensimulator.org/mantis/view.php?id=5860 Signed-off-by: BlueWall --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'OpenSim/Data/MSSQL/MSSQLSimulationData.cs') diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index d9dfe86..3f29f5b 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -1181,6 +1181,72 @@ VALUES // } #endregion } + + #region Environment Settings + public string LoadRegionEnvironmentSettings(UUID regionUUID) + { + string sql = "select * from [regionenvironment] where region_id = @region_id"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); + conn.Open(); + using (SqlDataReader result = cmd.ExecuteReader()) + { + if (!result.Read()) + { + return String.Empty; + } + else + { + return Convert.ToString(result["llsd_settings"]); + } + } + } + } + + public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) + { + { + string sql = "DELETE FROM [regionenvironment] WHERE region_id = @region_id"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + + sql = "INSERT INTO [regionenvironment] (region_id, llsd_settings) VALUES (@region_id, @llsd_settings)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); + cmd.Parameters.Add(_Database.CreateParameter("@llsd_settings", settings)); + + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + } + + public void RemoveRegionEnvironmentSettings(UUID regionUUID) + { + string sql = "delete from [regionenvironment] where region_id = @region_id"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID)); + + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + #endregion + /// /// Loads the settings of a region. /// -- cgit v1.1