aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-08-15 18:21:28 +0200
committerMelanie2012-08-15 18:21:28 +0200
commitde2192942653ede6303cbb67ed990278dcfc9f97 (patch)
tree5726943cba39a926d4781a52ecc85e6d467c4c58
parentAdd a skeleton for a name value storage associated with regions (diff)
downloadopensim-SC-de2192942653ede6303cbb67ed990278dcfc9f97.zip
opensim-SC-de2192942653ede6303cbb67ed990278dcfc9f97.tar.gz
opensim-SC-de2192942653ede6303cbb67ed990278dcfc9f97.tar.bz2
opensim-SC-de2192942653ede6303cbb67ed990278dcfc9f97.tar.xz
Fix and finish the extra parameters storage system for MySQL
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs58
1 files changed, 57 insertions, 1 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 03cfd02..4d7c0c9 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -2097,15 +2097,71 @@ namespace OpenSim.Data.MySQL
2097 2097
2098 public void SaveExtra(UUID regionID, string name, string val) 2098 public void SaveExtra(UUID regionID, string name, string val)
2099 { 2099 {
2100 lock (m_dbLock)
2101 {
2102 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2103 {
2104 dbcon.Open();
2105
2106 using (MySqlCommand cmd = dbcon.CreateCommand())
2107 {
2108 cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)";
2109 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2110 cmd.Parameters.AddWithValue("?Name", name);
2111 cmd.Parameters.AddWithValue("?value", val);
2112
2113 cmd.ExecuteNonQuery();
2114 }
2115 }
2116 }
2100 } 2117 }
2101 2118
2102 public void RemoveExtra(UUID regionID, string name) 2119 public void RemoveExtra(UUID regionID, string name)
2103 { 2120 {
2121 lock (m_dbLock)
2122 {
2123 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2124 {
2125 dbcon.Open();
2126
2127 using (MySqlCommand cmd = dbcon.CreateCommand())
2128 {
2129 cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name";
2130 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2131 cmd.Parameters.AddWithValue("?Name", name);
2132
2133 cmd.ExecuteNonQuery();
2134 }
2135 }
2136 }
2104 } 2137 }
2105 2138
2106 public Dictionary<string, string> GetExtra(UUID regionID) 2139 public Dictionary<string, string> GetExtra(UUID regionID)
2107 { 2140 {
2108 return null; 2141 Dictionary<string, string> ret = new Dictionary<string, string>();
2142
2143 lock (m_dbLock)
2144 {
2145 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
2146 {
2147 dbcon.Open();
2148
2149 using (MySqlCommand cmd = dbcon.CreateCommand())
2150 {
2151 cmd.CommandText = "select * from regionextra where RegionID=?RegionID";
2152 cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
2153 using (IDataReader r = cmd.ExecuteReader())
2154 {
2155 while (r.Read())
2156 {
2157 ret[r["Name"].ToString()] = r["value"].ToString();
2158 }
2159 }
2160 }
2161 }
2162 }
2163
2164 return ret;
2109 } 2165 }
2110 } 2166 }
2111} 2167}