aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorKitto Flora2009-09-30 19:07:18 +0200
committerKitto Flora2009-09-30 19:07:18 +0200
commit07df0e0ab0c69633a6afec8d05cccc117656d3d9 (patch)
tree3048cc38b313e255cbf03fa3e2900e28cadc47c9 /OpenSim/Data/MySQL
parentAnd another merge issue (diff)
parentFix loading modules with alternate configurations and ports into ROBUST. (diff)
downloadopensim-SC_OLD-07df0e0ab0c69633a6afec8d05cccc117656d3d9.zip
opensim-SC_OLD-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.gz
opensim-SC_OLD-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.bz2
opensim-SC_OLD-07df0e0ab0c69633a6afec8d05cccc117656d3d9.tar.xz
Merge branch '0.6.7-post-fixes' into vehicles
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs38
-rw-r--r--OpenSim/Data/MySQL/MySQLUserAccountData.cs2
-rw-r--r--OpenSim/Data/MySQL/Resources/004_GridStore.sql6
3 files changed, 30 insertions, 16 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index ced26a4..06ef624 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL
39 { 39 {
40 private string m_Realm; 40 private string m_Realm;
41 private List<string> m_ColumnNames = null; 41 private List<string> m_ColumnNames = null;
42 private int m_LastExpire = 0; 42// private int m_LastExpire = 0;
43 43
44 public MySqlRegionData(string connectionString, string realm) 44 public MySqlRegionData(string connectionString, string realm)
45 : base(connectionString) 45 : base(connectionString)
@@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL
77 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 77 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
78 78
79 List<RegionData> ret = RunCommand(cmd); 79 List<RegionData> ret = RunCommand(cmd);
80 if (ret == null) 80 if (ret.Count == 0)
81 return null; 81 return null;
82 82
83 return ret[0]; 83 return ret[0];
@@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL
95 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 95 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
96 96
97 List<RegionData> ret = RunCommand(cmd); 97 List<RegionData> ret = RunCommand(cmd);
98 if (ret == null) 98 if (ret.Count == 0)
99 return null; 99 return null;
100 100
101 return ret[0]; 101 return ret[0];
@@ -138,6 +138,8 @@ namespace OpenSim.Data.MySQL
138 ret.RegionName = result["regionName"].ToString(); 138 ret.RegionName = result["regionName"].ToString();
139 ret.posX = Convert.ToInt32(result["locX"]); 139 ret.posX = Convert.ToInt32(result["locX"]);
140 ret.posY = Convert.ToInt32(result["locY"]); 140 ret.posY = Convert.ToInt32(result["locY"]);
141 ret.sizeX = Convert.ToInt32(result["sizeX"]);
142 ret.sizeY = Convert.ToInt32(result["sizeY"]);
141 143
142 if (m_ColumnNames == null) 144 if (m_ColumnNames == null)
143 { 145 {
@@ -170,10 +172,7 @@ namespace OpenSim.Data.MySQL
170 result.Close(); 172 result.Close();
171 CloseReaderCommand(cmd); 173 CloseReaderCommand(cmd);
172 174
173 if (retList.Count > 0) 175 return retList;
174 return retList;
175
176 return null;
177 } 176 }
178 177
179 public bool Store(RegionData data) 178 public bool Store(RegionData data)
@@ -188,21 +187,25 @@ namespace OpenSim.Data.MySQL
188 data.Data.Remove("posX"); 187 data.Data.Remove("posX");
189 if (data.Data.ContainsKey("posY")) 188 if (data.Data.ContainsKey("posY"))
190 data.Data.Remove("posY"); 189 data.Data.Remove("posY");
190 if (data.Data.ContainsKey("sizeX"))
191 data.Data.Remove("sizeX");
192 if (data.Data.ContainsKey("sizeY"))
193 data.Data.Remove("sizeY");
194 if (data.Data.ContainsKey("locX"))
195 data.Data.Remove("locX");
196 if (data.Data.ContainsKey("locY"))
197 data.Data.Remove("locY");
191 198
192 string[] fields = new List<string>(data.Data.Keys).ToArray(); 199 string[] fields = new List<string>(data.Data.Keys).ToArray();
193 200
194 MySqlCommand cmd = new MySqlCommand(); 201 MySqlCommand cmd = new MySqlCommand();
195 202
196 string update = "update `"+m_Realm+"` set "; 203 string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY";
197 bool first = true;
198 foreach (string field in fields) 204 foreach (string field in fields)
199 { 205 {
200 if (!first) 206 update += ", ";
201 update += ", ";
202 update += "`" + field + "` = ?"+field; 207 update += "`" + field + "` = ?"+field;
203 208
204 first = false;
205
206 cmd.Parameters.AddWithValue("?"+field, data.Data[field]); 209 cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
207 } 210 }
208 211
@@ -213,13 +216,18 @@ namespace OpenSim.Data.MySQL
213 216
214 cmd.CommandText = update; 217 cmd.CommandText = update;
215 cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString()); 218 cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString());
219 cmd.Parameters.AddWithValue("?regionName", data.RegionName);
216 cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString()); 220 cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString());
221 cmd.Parameters.AddWithValue("?posX", data.posX.ToString());
222 cmd.Parameters.AddWithValue("?posY", data.posY.ToString());
223 cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString());
224 cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString());
217 225
218 if (ExecuteNonQuery(cmd) < 1) 226 if (ExecuteNonQuery(cmd) < 1)
219 { 227 {
220 string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" + 228 string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" +
221 String.Join("`, `", fields) + 229 String.Join("`, `", fields) +
222 "`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")"; 230 "`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")";
223 231
224 cmd.CommandText = insert; 232 cmd.CommandText = insert;
225 233
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
39 { 39 {
40 private string m_Realm; 40 private string m_Realm;
41 private List<string> m_ColumnNames = null; 41 private List<string> m_ColumnNames = null;
42 private int m_LastExpire = 0; 42// private int m_LastExpire = 0;
43 43
44 public MySqlUserAccountData(string connectionString, string realm) 44 public MySqlUserAccountData(string connectionString, string realm)
45 : base(connectionString) 45 : base(connectionString)
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 @@
1BEGIN;
2
3ALTER TABLE regions add column sizeX integer not null default 0;
4ALTER TABLE regions add column sizeY integer not null default 0;
5
6COMMIT;