diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLEstateData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index c42c687..86416d1 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL | |||
54 | private Dictionary<string, FieldInfo> m_FieldMap = | 54 | private Dictionary<string, FieldInfo> m_FieldMap = |
55 | new Dictionary<string, FieldInfo>(); | 55 | new Dictionary<string, FieldInfo>(); |
56 | 56 | ||
57 | protected virtual Assembly Assembly | ||
58 | { | ||
59 | get { return GetType().Assembly; } | ||
60 | } | ||
61 | |||
57 | public MySQLEstateStore() | 62 | public MySQLEstateStore() |
58 | { | 63 | { |
59 | } | 64 | } |
@@ -82,8 +87,7 @@ namespace OpenSim.Data.MySQL | |||
82 | { | 87 | { |
83 | dbcon.Open(); | 88 | dbcon.Open(); |
84 | 89 | ||
85 | Assembly assem = GetType().Assembly; | 90 | Migration m = new Migration(dbcon, Assembly, "EstateStore"); |
86 | Migration m = new Migration(dbcon, assem, "EstateStore"); | ||
87 | m.Update(); | 91 | m.Update(); |
88 | 92 | ||
89 | Type t = typeof(EstateSettings); | 93 | Type t = typeof(EstateSettings); |
@@ -409,6 +413,46 @@ namespace OpenSim.Data.MySQL | |||
409 | return DoLoad(cmd, UUID.Zero, false); | 413 | return DoLoad(cmd, UUID.Zero, false); |
410 | } | 414 | } |
411 | } | 415 | } |
416 | |||
417 | public List<EstateSettings> LoadEstateSettingsAll() | ||
418 | { | ||
419 | List<EstateSettings> allEstateSettings = new List<EstateSettings>(); | ||
420 | |||
421 | List<int> allEstateIds = GetEstatesAll(); | ||
422 | |||
423 | foreach (int estateId in allEstateIds) | ||
424 | allEstateSettings.Add(LoadEstateSettings(estateId)); | ||
425 | |||
426 | return allEstateSettings; | ||
427 | } | ||
428 | |||
429 | public List<int> GetEstatesAll() | ||
430 | { | ||
431 | List<int> result = new List<int>(); | ||
432 | |||
433 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
434 | { | ||
435 | dbcon.Open(); | ||
436 | |||
437 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
438 | { | ||
439 | cmd.CommandText = "select estateID from estate_settings"; | ||
440 | |||
441 | using (IDataReader reader = cmd.ExecuteReader()) | ||
442 | { | ||
443 | while (reader.Read()) | ||
444 | { | ||
445 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
446 | } | ||
447 | reader.Close(); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | dbcon.Close(); | ||
452 | } | ||
453 | |||
454 | return result; | ||
455 | } | ||
412 | 456 | ||
413 | public List<int> GetEstates(string search) | 457 | public List<int> GetEstates(string search) |
414 | { | 458 | { |
@@ -440,6 +484,36 @@ namespace OpenSim.Data.MySQL | |||
440 | return result; | 484 | return result; |
441 | } | 485 | } |
442 | 486 | ||
487 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
488 | { | ||
489 | List<int> result = new List<int>(); | ||
490 | |||
491 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
492 | { | ||
493 | dbcon.Open(); | ||
494 | |||
495 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
496 | { | ||
497 | cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner"; | ||
498 | cmd.Parameters.AddWithValue("?EstateOwner", ownerID); | ||
499 | |||
500 | using (IDataReader reader = cmd.ExecuteReader()) | ||
501 | { | ||
502 | while (reader.Read()) | ||
503 | { | ||
504 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
505 | } | ||
506 | reader.Close(); | ||
507 | } | ||
508 | } | ||
509 | |||
510 | |||
511 | dbcon.Close(); | ||
512 | } | ||
513 | |||
514 | return result; | ||
515 | } | ||
516 | |||
443 | public bool LinkRegion(UUID regionID, int estateID) | 517 | public bool LinkRegion(UUID regionID, int estateID) |
444 | { | 518 | { |
445 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 519 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |