aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorSean McNamara2011-04-10 18:28:54 -0400
committerSean McNamara2011-04-10 18:28:54 -0400
commit9c0f3c73b1fd56ac145e866af0316a3285ddb689 (patch)
tree03541a853c2ecf5829ac296537b14d4553ad4b2e /OpenSim/Data/MySQL
parentMerge git://opensimulator.org/git/opensim (diff)
parentminor: remove mono compiler warnings (diff)
downloadopensim-SC_OLD-9c0f3c73b1fd56ac145e866af0316a3285ddb689.zip
opensim-SC_OLD-9c0f3c73b1fd56ac145e866af0316a3285ddb689.tar.gz
opensim-SC_OLD-9c0f3c73b1fd56ac145e866af0316a3285ddb689.tar.bz2
opensim-SC_OLD-9c0f3c73b1fd56ac145e866af0316a3285ddb689.tar.xz
Merge git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs10
-rw-r--r--OpenSim/Data/MySQL/MySQLAuthenticationData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs78
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs9
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs8
6 files changed, 109 insertions, 11 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index ed92f3e..e740232 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -47,6 +47,11 @@ namespace OpenSim.Data.MySQL
47 private string m_connectionString; 47 private string m_connectionString;
48 private object m_dbLock = new object(); 48 private object m_dbLock = new object();
49 49
50 protected virtual Assembly Assembly
51 {
52 get { return GetType().Assembly; }
53 }
54
50 #region IPlugin Members 55 #region IPlugin Members
51 56
52 public override string Version { get { return "1.0.0.0"; } } 57 public override string Version { get { return "1.0.0.0"; } }
@@ -66,13 +71,10 @@ namespace OpenSim.Data.MySQL
66 { 71 {
67 m_connectionString = connect; 72 m_connectionString = connect;
68 73
69 // This actually does the roll forward assembly stuff
70 Assembly assem = GetType().Assembly;
71
72 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 74 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
73 { 75 {
74 dbcon.Open(); 76 dbcon.Open();
75 Migration m = new Migration(dbcon, assem, "AssetStore"); 77 Migration m = new Migration(dbcon, Assembly, "AssetStore");
76 m.Update(); 78 m.Update();
77 } 79 }
78 } 80 }
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index 5056aee..8d82f61 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
31using System.Data; 32using System.Data;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -42,6 +43,11 @@ namespace OpenSim.Data.MySQL
42 private int m_LastExpire; 43 private int m_LastExpire;
43 // private string m_connectionString; 44 // private string m_connectionString;
44 45
46 protected virtual Assembly Assembly
47 {
48 get { return GetType().Assembly; }
49 }
50
45 public MySqlAuthenticationData(string connectionString, string realm) 51 public MySqlAuthenticationData(string connectionString, string realm)
46 : base(connectionString) 52 : base(connectionString)
47 { 53 {
@@ -51,7 +57,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 58 {
53 dbcon.Open(); 59 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); 60 Migration m = new Migration(dbcon, Assembly, "AuthStore");
55 m.Update(); 61 m.Update();
56 } 62 }
57 } 63 }
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))
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 7c23a47..8efe4e9 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Data.MySQL
46 protected string m_Realm; 46 protected string m_Realm;
47 protected FieldInfo m_DataField = null; 47 protected FieldInfo m_DataField = null;
48 48
49 protected virtual Assembly Assembly
50 {
51 get { return GetType().Assembly; }
52 }
53
49 public MySQLGenericTableHandler(string connectionString, 54 public MySQLGenericTableHandler(string connectionString,
50 string realm, string storeName) : base(connectionString) 55 string realm, string storeName) : base(connectionString)
51 { 56 {
@@ -57,7 +62,7 @@ namespace OpenSim.Data.MySQL
57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
58 { 63 {
59 dbcon.Open(); 64 dbcon.Open();
60 Migration m = new Migration(dbcon, GetType().Assembly, storeName); 65 Migration m = new Migration(dbcon, Assembly, storeName);
61 m.Update(); 66 m.Update();
62 } 67 }
63 } 68 }
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index d04e3dc..c20c392 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Reflection;
33
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Data; 36using OpenSim.Data;
@@ -42,6 +44,11 @@ namespace OpenSim.Data.MySQL
42 private List<string> m_ColumnNames; 44 private List<string> m_ColumnNames;
43 //private string m_connectionString; 45 //private string m_connectionString;
44 46
47 protected virtual Assembly Assembly
48 {
49 get { return GetType().Assembly; }
50 }
51
45 public MySqlRegionData(string connectionString, string realm) 52 public MySqlRegionData(string connectionString, string realm)
46 : base(connectionString) 53 : base(connectionString)
47 { 54 {
@@ -51,7 +58,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 58 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 59 {
53 dbcon.Open(); 60 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "GridStore"); 61 Migration m = new Migration(dbcon, Assembly, "GridStore");
55 m.Update(); 62 m.Update();
56 } 63 }
57 } 64 }
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 02997b3..e14d775 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,6 +52,11 @@ namespace OpenSim.Data.MySQL
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 protected virtual Assembly Assembly
56 {
57 get { return GetType().Assembly; }
58 }
59
55 public MySQLSimulationData() 60 public MySQLSimulationData()
56 { 61 {
57 } 62 }
@@ -71,8 +76,7 @@ namespace OpenSim.Data.MySQL
71 76
72 // Apply new Migrations 77 // Apply new Migrations
73 // 78 //
74 Assembly assem = GetType().Assembly; 79 Migration m = new Migration(dbcon, Assembly, "RegionStore");
75 Migration m = new Migration(dbcon, assem, "RegionStore");
76 m.Update(); 80 m.Update();
77 81
78 // Clean dropped attachments 82 // Clean dropped attachments