diff options
author | Melanie | 2012-08-15 18:21:28 +0200 |
---|---|---|
committer | Melanie | 2012-08-15 18:58:32 +0100 |
commit | c7f2debd38e35b0f049df9cc33ff8fb4eede40db (patch) | |
tree | 805908e218c873a0ca29bcde2f1d8312aacd8144 /OpenSim/Data | |
parent | Add a skeleton for a name value storage associated with regions (diff) | |
download | opensim-SC-c7f2debd38e35b0f049df9cc33ff8fb4eede40db.zip opensim-SC-c7f2debd38e35b0f049df9cc33ff8fb4eede40db.tar.gz opensim-SC-c7f2debd38e35b0f049df9cc33ff8fb4eede40db.tar.bz2 opensim-SC-c7f2debd38e35b0f049df9cc33ff8fb4eede40db.tar.xz |
Fix and finish the extra parameters storage system for MySQL
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index be985ab..3fc04ee 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -1969,15 +1969,71 @@ namespace OpenSim.Data.MySQL | |||
1969 | 1969 | ||
1970 | public void SaveExtra(UUID regionID, string name, string val) | 1970 | public void SaveExtra(UUID regionID, string name, string val) |
1971 | { | 1971 | { |
1972 | lock (m_dbLock) | ||
1973 | { | ||
1974 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1975 | { | ||
1976 | dbcon.Open(); | ||
1977 | |||
1978 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1979 | { | ||
1980 | cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)"; | ||
1981 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
1982 | cmd.Parameters.AddWithValue("?Name", name); | ||
1983 | cmd.Parameters.AddWithValue("?value", val); | ||
1984 | |||
1985 | cmd.ExecuteNonQuery(); | ||
1986 | } | ||
1987 | } | ||
1988 | } | ||
1972 | } | 1989 | } |
1973 | 1990 | ||
1974 | public void RemoveExtra(UUID regionID, string name) | 1991 | public void RemoveExtra(UUID regionID, string name) |
1975 | { | 1992 | { |
1993 | lock (m_dbLock) | ||
1994 | { | ||
1995 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
1996 | { | ||
1997 | dbcon.Open(); | ||
1998 | |||
1999 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2000 | { | ||
2001 | cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name"; | ||
2002 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
2003 | cmd.Parameters.AddWithValue("?Name", name); | ||
2004 | |||
2005 | cmd.ExecuteNonQuery(); | ||
2006 | } | ||
2007 | } | ||
2008 | } | ||
1976 | } | 2009 | } |
1977 | 2010 | ||
1978 | public Dictionary<string, string> GetExtra(UUID regionID) | 2011 | public Dictionary<string, string> GetExtra(UUID regionID) |
1979 | { | 2012 | { |
1980 | return null; | 2013 | Dictionary<string, string> ret = new Dictionary<string, string>(); |
2014 | |||
2015 | lock (m_dbLock) | ||
2016 | { | ||
2017 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2018 | { | ||
2019 | dbcon.Open(); | ||
2020 | |||
2021 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2022 | { | ||
2023 | cmd.CommandText = "select * from regionextra where RegionID=?RegionID"; | ||
2024 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
2025 | using (IDataReader r = cmd.ExecuteReader()) | ||
2026 | { | ||
2027 | while (r.Read()) | ||
2028 | { | ||
2029 | ret[r["Name"].ToString()] = r["value"].ToString(); | ||
2030 | } | ||
2031 | } | ||
2032 | } | ||
2033 | } | ||
2034 | } | ||
2035 | |||
2036 | return ret; | ||
1981 | } | 2037 | } |
1982 | } | 2038 | } |
1983 | } | 2039 | } |