diff options
author | Kitto Flora | 2009-09-30 19:07:18 +0200 |
---|---|---|
committer | Kitto Flora | 2009-09-30 19:07:18 +0200 |
commit | 07df0e0ab0c69633a6afec8d05cccc117656d3d9 (patch) | |
tree | 3048cc38b313e255cbf03fa3e2900e28cadc47c9 /OpenSim/Data | |
parent | And another merge issue (diff) | |
parent | Fix loading modules with alternate configurations and ports into ROBUST. (diff) | |
download | opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.zip opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.gz opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.bz2 opensim-SC-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.xz |
Merge branch '0.6.7-post-fixes' into vehicles
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/IRegionData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 38 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserAccountData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/004_GridStore.sql | 6 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullRegionData.cs | 6 |
5 files changed, 34 insertions, 20 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 ced26a4..06ef624 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | private string m_Realm; | 40 | private string m_Realm; |
41 | private List<string> m_ColumnNames = null; | 41 | private List<string> m_ColumnNames = null; |
42 | private int m_LastExpire = 0; | 42 | // private int m_LastExpire = 0; |
43 | 43 | ||
44 | public MySqlRegionData(string connectionString, string realm) | 44 | public MySqlRegionData(string connectionString, string realm) |
45 | : base(connectionString) | 45 | : base(connectionString) |
@@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL | |||
77 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 77 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
78 | 78 | ||
79 | List<RegionData> ret = RunCommand(cmd); | 79 | List<RegionData> ret = RunCommand(cmd); |
80 | if (ret == null) | 80 | if (ret.Count == 0) |
81 | return null; | 81 | return null; |
82 | 82 | ||
83 | return ret[0]; | 83 | return ret[0]; |
@@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL | |||
95 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 95 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); |
96 | 96 | ||
97 | List<RegionData> ret = RunCommand(cmd); | 97 | List<RegionData> ret = RunCommand(cmd); |
98 | if (ret == null) | 98 | if (ret.Count == 0) |
99 | return null; | 99 | return null; |
100 | 100 | ||
101 | return ret[0]; | 101 | return ret[0]; |
@@ -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 | { |
@@ -170,10 +172,7 @@ namespace OpenSim.Data.MySQL | |||
170 | result.Close(); | 172 | result.Close(); |
171 | CloseReaderCommand(cmd); | 173 | CloseReaderCommand(cmd); |
172 | 174 | ||
173 | if (retList.Count > 0) | 175 | return retList; |
174 | return retList; | ||
175 | |||
176 | return null; | ||
177 | } | 176 | } |
178 | 177 | ||
179 | public bool Store(RegionData data) | 178 | public bool Store(RegionData data) |
@@ -188,21 +187,25 @@ namespace OpenSim.Data.MySQL | |||
188 | data.Data.Remove("posX"); | 187 | data.Data.Remove("posX"); |
189 | if (data.Data.ContainsKey("posY")) | 188 | if (data.Data.ContainsKey("posY")) |
190 | data.Data.Remove("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"); | ||
194 | if (data.Data.ContainsKey("locX")) | ||
195 | data.Data.Remove("locX"); | ||
196 | if (data.Data.ContainsKey("locY")) | ||
197 | data.Data.Remove("locY"); | ||
191 | 198 | ||
192 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | 199 | string[] fields = new List<string>(data.Data.Keys).ToArray(); |
193 | 200 | ||
194 | MySqlCommand cmd = new MySqlCommand(); | 201 | MySqlCommand cmd = new MySqlCommand(); |
195 | 202 | ||
196 | string update = "update `"+m_Realm+"` set "; | 203 | string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY"; |
197 | bool first = true; | ||
198 | foreach (string field in fields) | 204 | foreach (string field in fields) |
199 | { | 205 | { |
200 | if (!first) | 206 | update += ", "; |
201 | update += ", "; | ||
202 | update += "`" + field + "` = ?"+field; | 207 | update += "`" + field + "` = ?"+field; |
203 | 208 | ||
204 | first = false; | ||
205 | |||
206 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); | 209 | cmd.Parameters.AddWithValue("?"+field, data.Data[field]); |
207 | } | 210 | } |
208 | 211 | ||
@@ -213,13 +216,18 @@ namespace OpenSim.Data.MySQL | |||
213 | 216 | ||
214 | cmd.CommandText = update; | 217 | cmd.CommandText = update; |
215 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); | 218 | cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); |
219 | cmd.Parameters.AddWithValue("?regionName", data.RegionName); | ||
216 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); | 220 | cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); |
221 | cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); | ||
222 | cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); | ||
223 | cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString()); | ||
224 | cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString()); | ||
217 | 225 | ||
218 | if (ExecuteNonQuery(cmd) < 1) | 226 | if (ExecuteNonQuery(cmd) < 1) |
219 | { | 227 | { |
220 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + | 228 | string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" + |
221 | String.Join("`, `", fields) + | 229 | String.Join("`, `", fields) + |
222 | "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; | 230 | "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")"; |
223 | 231 | ||
224 | cmd.CommandText = insert; | 232 | cmd.CommandText = insert; |
225 | 233 | ||
diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 39d60ca..5352727 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | private string m_Realm; | 40 | private string m_Realm; |
41 | private List<string> m_ColumnNames = null; | 41 | private List<string> m_ColumnNames = null; |
42 | private int m_LastExpire = 0; | 42 | // private int m_LastExpire = 0; |
43 | 43 | ||
44 | public MySqlUserAccountData(string connectionString, string realm) | 44 | public MySqlUserAccountData(string connectionString, string realm) |
45 | : base(connectionString) | 45 | : base(connectionString) |
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; | ||
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 588b8ac..218fcd0 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -40,6 +40,7 @@ namespace OpenSim.Data.Null | |||
40 | 40 | ||
41 | public NullRegionData(string connectionString, string realm) | 41 | public NullRegionData(string connectionString, string realm) |
42 | { | 42 | { |
43 | //Console.WriteLine("[XXX] NullRegionData constructor"); | ||
43 | } | 44 | } |
44 | 45 | ||
45 | public List<RegionData> Get(string regionName, UUID scopeID) | 46 | public List<RegionData> Get(string regionName, UUID scopeID) |
@@ -100,10 +101,7 @@ namespace OpenSim.Data.Null | |||
100 | ret.Add(r); | 101 | ret.Add(r); |
101 | } | 102 | } |
102 | 103 | ||
103 | if (ret.Count > 0) | 104 | return ret; |
104 | return ret; | ||
105 | |||
106 | return null; | ||
107 | } | 105 | } |
108 | 106 | ||
109 | public bool Store(RegionData data) | 107 | public bool Store(RegionData data) |