diff options
author | Diva Canto | 2009-09-27 14:39:41 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-27 14:39:41 -0700 |
commit | 1980ab31524eb09da1b2cc3c6de4cd294ad272a5 (patch) | |
tree | ea581085c3a4489de086f63df252839977d761f8 | |
parent | Fixed port in GridServer.ini. Added new configs for StandaloneHypergrid.ini (diff) | |
parent | Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-1980ab31524eb09da1b2cc3c6de4cd294ad272a5.zip opensim-SC_OLD-1980ab31524eb09da1b2cc3c6de4cd294ad272a5.tar.gz opensim-SC_OLD-1980ab31524eb09da1b2cc3c6de4cd294ad272a5.tar.bz2 opensim-SC_OLD-1980ab31524eb09da1b2cc3c6de4cd294ad272a5.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/IRegionData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 28 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/004_GridStore.sql | 6 |
3 files changed, 28 insertions, 8 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index c5201ea..7a607ab 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Data | |||
39 | public string RegionName; | 39 | public string RegionName; |
40 | public int posX; | 40 | public int posX; |
41 | public int posY; | 41 | public int posY; |
42 | public int sizeX; | ||
43 | public int sizeY; | ||
42 | public Dictionary<string, object> Data; | 44 | public Dictionary<string, object> Data; |
43 | } | 45 | } |
44 | 46 | ||
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index e8cab4d..64ac83f 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 | { |
@@ -179,21 +181,27 @@ namespace OpenSim.Data.MySQL | |||
179 | data.Data.Remove("uuid"); | 181 | data.Data.Remove("uuid"); |
180 | if (data.Data.ContainsKey("ScopeID")) | 182 | if (data.Data.ContainsKey("ScopeID")) |
181 | data.Data.Remove("ScopeID"); | 183 | data.Data.Remove("ScopeID"); |
184 | if (data.Data.ContainsKey("regionName")) | ||
185 | data.Data.Remove("regionName"); | ||
186 | if (data.Data.ContainsKey("posX")) | ||
187 | data.Data.Remove("posX"); | ||
188 | if (data.Data.ContainsKey("posY")) | ||
189 | data.Data.Remove("posY"); | ||
190 | if (data.Data.ContainsKey("sizeX")) | ||
191 | data.Data.Remove("sizeX"); | ||
192 | if (data.Data.ContainsKey("sizeY")) | ||
193 | data.Data.Remove("sizeY"); | ||
182 | 194 | ||
183 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 195 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
184 | 196 | ||
185 | MySqlCommand cmd = new MySqlCommand(); | 197 | MySqlCommand cmd = new MySqlCommand(); |
186 | 198 | ||
187 | string update = "update `"+m_Realm+"` set "; | 199 | string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY"; |
188 | bool first = true; | ||
189 | foreach (string field in fields) | 200 | foreach (string field in fields) |
190 | { | 201 | { |
191 | if (!first) | 202 | update += ", "; |
192 | update += ", "; | ||
193 | update += "`" + field + "` = ?"+field; | 203 | update += "`" + field + "` = ?"+field; |
194 | 204 | ||
195 | first = false; | ||
196 | |||
197 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 205 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
198 | } | 206 | } |
199 | 207 | ||
@@ -205,12 +213,16 @@ namespace OpenSim.Data.MySQL | |||
205 | cmd.CommandText = update; | 213 | cmd.CommandText = update; |
206 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); | 214 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); |
207 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | 215 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); |
216 | cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); | ||
217 | cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); | ||
218 | cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString()); | ||
219 | cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString()); | ||
208 | 220 | ||
209 | if (ExecuteNonQuery(cmd) < 1) | 221 | if (ExecuteNonQuery(cmd) < 1) |
210 | { | 222 | { |
211 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + | 223 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `" + |
212 | String.Join("`, `", fields) + | 224 | String.Join("`, `", fields) + |
213 | "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 225 | "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?" + String.Join(", ?", fields) + ")"; |
214 | 226 | ||
215 | cmd.CommandText = insert; | 227 | cmd.CommandText = insert; |
216 | 228 | ||
diff --git a/OpenSim/Data/MySQL/Resources/004_GridStore.sql b/OpenSim/Data/MySQL/Resources/004_GridStore.sql new file mode 100644 index 0000000..2238a88 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/004_GridStore.sql | |||
@@ -0,0 +1,6 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE regions add column sizeX integer not null default 0; | ||
4 | ALTER TABLE regions add column sizeY integer not null default 0; | ||
5 | |||
6 | COMMIT; | ||