From 6a5d7650d02979c74abcbbb3595729a4a6b55411 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 18:23:55 -0700 Subject: All tests pass for MySQL/MySQLRegionData. Added OpenSim.GridServer.ini.example that I have been using for testing the ROBUST grid service with the GridClient. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ced26a4..e13e12c 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); List ret = RunCommand(cmd); - if (ret == null) + if (ret.Count == 0) return null; return ret[0]; @@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); List ret = RunCommand(cmd); - if (ret == null) + if (ret.Count == 0) return null; return ret[0]; @@ -170,10 +170,7 @@ namespace OpenSim.Data.MySQL result.Close(); CloseReaderCommand(cmd); - if (retList.Count > 0) - return retList; - - return null; + return retList; } public bool Store(RegionData data) @@ -182,12 +179,6 @@ namespace OpenSim.Data.MySQL data.Data.Remove("uuid"); if (data.Data.ContainsKey("ScopeID")) data.Data.Remove("ScopeID"); - if (data.Data.ContainsKey("regionName")) - data.Data.Remove("regionName"); - if (data.Data.ContainsKey("posX")) - data.Data.Remove("posX"); - if (data.Data.ContainsKey("posY")) - data.Data.Remove("posY"); string[] fields = new List(data.Data.Keys).ToArray(); -- cgit v1.1 From 2995d87d75e3f65b9872aa02edbff0dda70bc03c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Sep 2009 19:29:40 +0100 Subject: minor: remove some mono compiler warnings --- OpenSim/Data/MySQL/MySQLRegionData.cs | 2 +- OpenSim/Data/MySQL/MySQLUserAccountData.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index e13e12c..e8cab4d 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL { private string m_Realm; private List m_ColumnNames = null; - private int m_LastExpire = 0; +// private int m_LastExpire = 0; public MySqlRegionData(string connectionString, string realm) : base(connectionString) diff --git a/OpenSim/Data/MySQL/MySQLUserAccountData.cs b/OpenSim/Data/MySQL/MySQLUserAccountData.cs index 39d60ca..5352727 100644 --- a/OpenSim/Data/MySQL/MySQLUserAccountData.cs +++ b/OpenSim/Data/MySQL/MySQLUserAccountData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL { private string m_Realm; private List m_ColumnNames = null; - private int m_LastExpire = 0; +// private int m_LastExpire = 0; public MySqlUserAccountData(string connectionString, string realm) : base(connectionString) -- cgit v1.1 From 8e091f590375d2b63c100e45a187b6cbfa76e161 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Sep 2009 21:17:23 +0100 Subject: Add the Migration for the regions table --- OpenSim/Data/MySQL/MySQLRegionData.cs | 22 ++++++++++++++-------- OpenSim/Data/MySQL/Resources/004_GridStore.sql | 6 ++++++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/004_GridStore.sql (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ced26a4..0d71c23 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -138,6 +138,8 @@ namespace OpenSim.Data.MySQL ret.RegionName = result["regionName"].ToString(); ret.posX = Convert.ToInt32(result["locX"]); ret.posY = Convert.ToInt32(result["locY"]); + ret.sizeX = Convert.ToInt32(result["sizeX"]); + ret.sizeY = Convert.ToInt32(result["sizeY"]); if (m_ColumnNames == null) { @@ -188,21 +190,21 @@ namespace OpenSim.Data.MySQL data.Data.Remove("posX"); if (data.Data.ContainsKey("posY")) data.Data.Remove("posY"); + if (data.Data.ContainsKey("sizeX")) + data.Data.Remove("sizeX"); + if (data.Data.ContainsKey("sizeY")) + data.Data.Remove("sizeY"); string[] fields = new List(data.Data.Keys).ToArray(); MySqlCommand cmd = new MySqlCommand(); - string update = "update `"+m_Realm+"` set "; - bool first = true; + string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY"; foreach (string field in fields) { - if (!first) - update += ", "; + update += ", "; update += "`" + field + "` = ?"+field; - first = false; - cmd.Parameters.AddWithValue("?"+field, data.Data[field]); } @@ -214,12 +216,16 @@ namespace OpenSim.Data.MySQL cmd.CommandText = update; cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); + cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); + cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); + cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString()); + cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString()); if (ExecuteNonQuery(cmd) < 1) { - string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + + string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `" + String.Join("`, `", fields) + - "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; + "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?" + String.Join(", ?", fields) + ")"; cmd.CommandText = insert; diff --git a/OpenSim/Data/MySQL/Resources/004_GridStore.sql b/OpenSim/Data/MySQL/Resources/004_GridStore.sql new file mode 100644 index 0000000..2238a88 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/004_GridStore.sql @@ -0,0 +1,6 @@ +BEGIN; + +ALTER TABLE regions add column sizeX integer not null default 0; +ALTER TABLE regions add column sizeY integer not null default 0; + +COMMIT; -- cgit v1.1 From 12640d082473d521f5131b640239013e56c8edd2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Sep 2009 21:58:34 +0100 Subject: Prevent manually setting Data["locX"] and Data["locY"], since that would overwrite the posX and posY members of the structure --- OpenSim/Data/MySQL/MySQLRegionData.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 64ac83f..8c99519 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -191,6 +191,10 @@ namespace OpenSim.Data.MySQL data.Data.Remove("sizeX"); if (data.Data.ContainsKey("sizeY")) data.Data.Remove("sizeY"); + if (data.Data.ContainsKey("locX")) + data.Data.Remove("locX"); + if (data.Data.ContainsKey("locY")) + data.Data.Remove("locY"); string[] fields = new List(data.Data.Keys).ToArray(); -- cgit v1.1 From 42746e99bdad71f81c9693d8638ffdf6bc3dd87a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Sep 2009 23:02:40 +0100 Subject: Make the RegionData plugin store the RegionName --- OpenSim/Data/MySQL/MySQLRegionData.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 8c99519..06ef624 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -216,6 +216,7 @@ namespace OpenSim.Data.MySQL cmd.CommandText = update; cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); + cmd.Parameters.AddWithValue("?regionName", data.RegionName); cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); cmd.Parameters.AddWithValue("?posX", data.posX.ToString()); cmd.Parameters.AddWithValue("?posY", data.posY.ToString()); @@ -224,9 +225,9 @@ namespace OpenSim.Data.MySQL if (ExecuteNonQuery(cmd) < 1) { - string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `" + + string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" + String.Join("`, `", fields) + - "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?" + String.Join(", ?", fields) + ")"; + "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")"; cmd.CommandText = insert; -- cgit v1.1