diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ced26a4..0d71c23 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -138,6 +138,8 @@ namespace OpenSim.Data.MySQL | |||
138 | ret.RegionName = result["regionName"].ToString(); | 138 | ret.RegionName = result["regionName"].ToString(); |
139 | ret.posX = Convert.ToInt32(result["locX"]); | 139 | ret.posX = Convert.ToInt32(result["locX"]); |
140 | ret.posY = Convert.ToInt32(result["locY"]); | 140 | ret.posY = Convert.ToInt32(result["locY"]); |
141 | ret.sizeX = Convert.ToInt32(result["sizeX"]); | ||
142 | ret.sizeY = Convert.ToInt32(result["sizeY"]); | ||
141 | 143 | ||
142 | if (m_ColumnNames == null) | 144 | if (m_ColumnNames == null) |
143 | { | 145 | { |
@@ -188,21 +190,21 @@ namespace OpenSim.Data.MySQL | |||
188 | data.Data.Remove("posX"); | 190 | data.Data.Remove("posX"); |
189 | if (data.Data.ContainsKey("posY")) | 191 | if (data.Data.ContainsKey("posY")) |
190 | data.Data.Remove("posY"); | 192 | data.Data.Remove("posY"); |
193 | if (data.Data.ContainsKey("sizeX")) | ||
194 | data.Data.Remove("sizeX"); | ||
195 | if (data.Data.ContainsKey("sizeY")) | ||
196 | data.Data.Remove("sizeY"); | ||
191 | 197 | ||
192 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 198 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
193 | 199 | ||
194 | MySqlCommand cmd = new MySqlCommand(); | 200 | MySqlCommand cmd = new MySqlCommand(); |
195 | 201 | ||
196 | string update = "update `"+m_Realm+"` set "; | 202 | string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY"; |
197 | bool first = true; | ||
198 | foreach (string field in fields) | 203 | foreach (string field in fields) |
199 | { | 204 | { |
200 | if (!first) | 205 | update += ", "; |
201 | update += ", "; | ||
202 | update += "`" + field + "` = ?"+field; | 206 | update += "`" + field + "` = ?"+field; |
203 | 207 | ||
204 | first = false; | ||
205 | |||
206 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 208 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
207 | } | 209 | } |
208 | 210 | ||
@@ -214,12 +216,16 @@ namespace OpenSim.Data.MySQL | |||
214 | cmd.CommandText = update; | 216 | cmd.CommandText = update; |
215 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); | 217 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); |
216 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | 218 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); |
219 | cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); | ||
220 | cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); | ||
221 | cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString()); | ||
222 | cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString()); | ||
217 | 223 | ||
218 | if (ExecuteNonQuery(cmd) < 1) | 224 | if (ExecuteNonQuery(cmd) < 1) |
219 | { | 225 | { |
220 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + | 226 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `" + |
221 | String.Join("`, `", fields) + | 227 | String.Join("`, `", fields) + |
222 | "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 228 | "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?" + String.Join(", ?", fields) + ")"; |
223 | 229 | ||
224 | cmd.CommandText = insert; | 230 | cmd.CommandText = insert; |
225 | 231 | ||