diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLRegionData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index c7bddac..6dc62c6 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -280,32 +280,35 @@ namespace OpenSim.Data.MySQL | |||
280 | } | 280 | } |
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 | command += " and ScopeID = ?scopeID"; | ||
289 | |||
290 | MySqlCommand cmd = new MySqlCommand(command); | ||
291 | |||
292 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
293 | |||
294 | return RunCommand(cmd); | ||
295 | } | 288 | } |
296 | 289 | ||
297 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | 290 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) |
298 | { | 291 | { |
299 | string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0"; | 292 | // TODO: distance-sort results |
300 | if (scopeID != UUID.Zero) | 293 | return Get((int)RegionFlags.FallbackRegion, scopeID); |
301 | command += " and ScopeID = ?scopeID"; | 294 | } |
302 | 295 | ||
303 | MySqlCommand cmd = new MySqlCommand(command); | 296 | public List<RegionData> GetHyperlinks(UUID scopeID) |
304 | 297 | { | |
305 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | 298 | return Get((int)RegionFlags.Hyperlink, scopeID); |
306 | 299 | } | |
307 | // TODO: distance-sort results | 300 | |
308 | return RunCommand(cmd); | 301 | private List<RegionData> Get(int regionFlags, UUID scopeID) |
309 | } | 302 | { |
303 | string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0"; | ||
304 | if (scopeID != UUID.Zero) | ||
305 | command += " and ScopeID = ?scopeID"; | ||
306 | |||
307 | MySqlCommand cmd = new MySqlCommand(command); | ||
308 | |||
309 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
310 | |||
311 | return RunCommand(cmd); | ||
312 | } | ||
310 | } | 313 | } |
311 | } | 314 | } |