diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 26 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/005_GridStore.sql | 6 |
2 files changed, 32 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index b0075e8..d045f61 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -274,5 +274,31 @@ namespace OpenSim.Data.MySQL | |||
274 | 274 | ||
275 | return false; | 275 | return false; |
276 | } | 276 | } |
277 | public List<RegionData> GetDefaultRegions(UUID scopeID) | ||
278 | { | ||
279 | string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0"; | ||
280 | if (scopeID != UUID.Zero) | ||
281 | command += " and ScopeID = ?scopeID"; | ||
282 | |||
283 | MySqlCommand cmd = new MySqlCommand(command); | ||
284 | |||
285 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
286 | |||
287 | return RunCommand(cmd); | ||
288 | } | ||
289 | |||
290 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | ||
291 | { | ||
292 | string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0"; | ||
293 | if (scopeID != UUID.Zero) | ||
294 | command += " and ScopeID = ?scopeID"; | ||
295 | |||
296 | MySqlCommand cmd = new MySqlCommand(command); | ||
297 | |||
298 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
299 | |||
300 | // TODO: distance-sort results | ||
301 | return RunCommand(cmd); | ||
302 | } | ||
277 | } | 303 | } |
278 | } | 304 | } |
diff --git a/OpenSim/Data/MySQL/Resources/005_GridStore.sql b/OpenSim/Data/MySQL/Resources/005_GridStore.sql new file mode 100644 index 0000000..835ba89 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/005_GridStore.sql | |||
@@ -0,0 +1,6 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE `regions` ADD COLUMN `flags` integer NOT NULL DEFAULT 0; | ||
4 | CREATE INDEX flags ON regions(flags); | ||
5 | |||
6 | COMMIT; | ||