aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorMelanie2010-08-01 18:00:04 +0100
committerMelanie2010-08-01 18:00:04 +0100
commit5f94b98cb2cbef74d1aea8d38d78d58a5aea2920 (patch)
tree114ccf34f9a444ad909cf44b8cede577425822b1 /OpenSim/Data
parentFix the XmlRpcRouterModule so it reads from the correct config section ([XMLR... (diff)
parentRenamed variables in RemoteAdmin plugin to be closer to the coding standards. (diff)
downloadopensim-SC_OLD-5f94b98cb2cbef74d1aea8d38d78d58a5aea2920.zip
opensim-SC_OLD-5f94b98cb2cbef74d1aea8d38d78d58a5aea2920.tar.gz
opensim-SC_OLD-5f94b98cb2cbef74d1aea8d38d78d58a5aea2920.tar.bz2
opensim-SC_OLD-5f94b98cb2cbef74d1aea8d38d78d58a5aea2920.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/IRegionData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs23
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs25
4 files changed, 39 insertions, 37 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
index 8259f9b..42533c6 100644
--- a/OpenSim/Data/IRegionData.cs
+++ b/OpenSim/Data/IRegionData.cs
@@ -62,6 +62,7 @@ namespace OpenSim.Data
62 62
63 List<RegionData> GetDefaultRegions(UUID scopeID); 63 List<RegionData> GetDefaultRegions(UUID scopeID);
64 List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y); 64 List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
65 List<RegionData> GetHyperlinks(UUID scopeID);
65 } 66 }
66 67
67 [Flags] 68 [Flags]
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 66c3f81..9656be1 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -310,23 +310,23 @@ namespace OpenSim.Data.MSSQL
310 310
311 public List<RegionData> GetDefaultRegions(UUID scopeID) 311 public List<RegionData> GetDefaultRegions(UUID scopeID)
312 { 312 {
313 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0"; 313 return Get((int)RegionFlags.DefaultRegion, scopeID);
314 if (scopeID != UUID.Zero)
315 sql += " AND ScopeID = @scopeID";
316
317 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
318 using (SqlCommand cmd = new SqlCommand(sql, conn))
319 {
320 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
321 conn.Open();
322 return RunCommand(cmd);
323 }
324
325 } 314 }
326 315
327 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 316 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
328 { 317 {
329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0"; 318 // TODO: distance-sort results
319 return Get((int)RegionFlags.FallbackRegion, scopeID);
320 }
321
322 public List<RegionData> GetHyperlinks(UUID scopeID)
323 {
324 return Get((int)RegionFlags.Hyperlink, scopeID);
325 }
326
327 private List<RegionData> Get(int regionFlags, UUID scopeID)
328 {
329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
330 if (scopeID != UUID.Zero) 330 if (scopeID != UUID.Zero)
331 sql += " AND ScopeID = @scopeID"; 331 sql += " AND ScopeID = @scopeID";
332 332
@@ -335,7 +335,6 @@ namespace OpenSim.Data.MSSQL
335 { 335 {
336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); 336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
337 conn.Open(); 337 conn.Open();
338 // TODO: distance-sort results
339 return RunCommand(cmd); 338 return RunCommand(cmd);
340 } 339 }
341 } 340 }
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index c7bddac..aec37e2 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -281,22 +281,26 @@ namespace OpenSim.Data.MySQL
281 281
282 return false; 282 return false;
283 } 283 }
284
284 public List<RegionData> GetDefaultRegions(UUID scopeID) 285 public List<RegionData> GetDefaultRegions(UUID scopeID)
285 { 286 {
286 string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0"; 287 return Get((int)RegionFlags.DefaultRegion, scopeID);
287 if (scopeID != UUID.Zero) 288 }
288 command += " and ScopeID = ?scopeID";
289
290 MySqlCommand cmd = new MySqlCommand(command);
291 289
292 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 290 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
291 {
292 // TODO: distance-sort results
293 return Get((int)RegionFlags.FallbackRegion, scopeID);
294 }
293 295
294 return RunCommand(cmd); 296 public List<RegionData> GetHyperlinks(UUID scopeID)
297 {
298 return Get((int)RegionFlags.Hyperlink, scopeID);
295 } 299 }
296 300
297 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 301 private List<RegionData> Get(int regionFlags, UUID scopeID)
298 { 302 {
299 string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0"; 303 string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
300 if (scopeID != UUID.Zero) 304 if (scopeID != UUID.Zero)
301 command += " and ScopeID = ?scopeID"; 305 command += " and ScopeID = ?scopeID";
302 306
@@ -304,7 +308,6 @@ namespace OpenSim.Data.MySQL
304 308
305 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 309 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
306 310
307 // TODO: distance-sort results
308 return RunCommand(cmd); 311 return RunCommand(cmd);
309 } 312 }
310 } 313 }
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index d596698..f276d10 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -164,30 +164,29 @@ namespace OpenSim.Data.Null
164 164
165 public List<RegionData> GetDefaultRegions(UUID scopeID) 165 public List<RegionData> GetDefaultRegions(UUID scopeID)
166 { 166 {
167 if (Instance != this) 167 return Get((int)RegionFlags.DefaultRegion, scopeID);
168 return Instance.GetDefaultRegions(scopeID); 168 }
169
170 List<RegionData> ret = new List<RegionData>();
171 169
172 foreach (RegionData r in m_regionData.Values) 170 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
173 { 171 {
174 if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0) 172 return Get((int)RegionFlags.FallbackRegion, scopeID);
175 ret.Add(r); 173 }
176 }
177 174
178 return ret; 175 public List<RegionData> GetHyperlinks(UUID scopeID)
176 {
177 return Get((int)RegionFlags.Hyperlink, scopeID);
179 } 178 }
180 179
181 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 180 private List<RegionData> Get(int regionFlags, UUID scopeID)
182 { 181 {
183 if (Instance != this) 182 if (Instance != this)
184 return Instance.GetFallbackRegions(scopeID, x, y); 183 return Instance.Get(regionFlags, scopeID);
185 184
186 List<RegionData> ret = new List<RegionData>(); 185 List<RegionData> ret = new List<RegionData>();
187 186
188 foreach (RegionData r in m_regionData.Values) 187 foreach (RegionData r in m_regionData.Values)
189 { 188 {
190 if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0) 189 if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
191 ret.Add(r); 190 ret.Add(r);
192 } 191 }
193 192