diff options
author | BlueWall | 2011-04-13 09:53:44 -0400 |
---|---|---|
committer | BlueWall | 2011-04-13 09:53:44 -0400 |
commit | d3457eae7a33f01a8fa906c4040792cdc4a67857 (patch) | |
tree | f92e60733b8397576b86c486e05aa5219f27d034 /OpenSim/Data/MySQL | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Move example HttpProxy setting to OpenSim.ini.example and tidy (diff) | |
download | opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.zip opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.gz opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.bz2 opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.xz |
Merge branch 'master' of /home/git/repo/OpenSim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 70 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 15 |
2 files changed, 83 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index de72a6a..86416d1 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -413,6 +413,46 @@ namespace OpenSim.Data.MySQL | |||
413 | return DoLoad(cmd, UUID.Zero, false); | 413 | return DoLoad(cmd, UUID.Zero, false); |
414 | } | 414 | } |
415 | } | 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 | } | ||
416 | 456 | ||
417 | public List<int> GetEstates(string search) | 457 | public List<int> GetEstates(string search) |
418 | { | 458 | { |
@@ -444,6 +484,36 @@ namespace OpenSim.Data.MySQL | |||
444 | return result; | 484 | return result; |
445 | } | 485 | } |
446 | 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 | |||
447 | public bool LinkRegion(UUID regionID, int estateID) | 517 | public bool LinkRegion(UUID regionID, int estateID) |
448 | { | 518 | { |
449 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 519 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 8efe4e9..50b6dbe 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL | |||
39 | { | 39 | { |
40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() | 40 | public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new() |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
42 | protected Dictionary<string, FieldInfo> m_Fields = | 44 | protected Dictionary<string, FieldInfo> m_Fields = |
43 | new Dictionary<string, FieldInfo>(); | 45 | new Dictionary<string, FieldInfo>(); |
44 | 46 | ||
@@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL | |||
217 | { | 219 | { |
218 | using (MySqlCommand cmd = new MySqlCommand()) | 220 | using (MySqlCommand cmd = new MySqlCommand()) |
219 | { | 221 | { |
220 | |||
221 | string query = ""; | 222 | string query = ""; |
222 | List<String> names = new List<String>(); | 223 | List<String> names = new List<String>(); |
223 | List<String> values = new List<String>(); | 224 | List<String> values = new List<String>(); |
@@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL | |||
226 | { | 227 | { |
227 | names.Add(fi.Name); | 228 | names.Add(fi.Name); |
228 | values.Add("?" + fi.Name); | 229 | values.Add("?" + fi.Name); |
230 | |||
231 | // Temporarily return more information about what field is unexpectedly null for | ||
232 | // http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the | ||
233 | // InventoryTransferModule or we may be required to substitute a DBNull here. | ||
234 | if (fi.GetValue(row) == null) | ||
235 | throw new NullReferenceException( | ||
236 | string.Format( | ||
237 | "[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null", | ||
238 | fi.Name, row)); | ||
239 | |||
229 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); | 240 | cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString()); |
230 | } | 241 | } |
231 | 242 | ||
@@ -268,4 +279,4 @@ namespace OpenSim.Data.MySQL | |||
268 | } | 279 | } |
269 | } | 280 | } |
270 | } | 281 | } |
271 | } | 282 | } \ No newline at end of file |