diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLEstateData.cs | 48 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 195 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/032_RegionStore.sql | 3 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullRegionData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 91 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicEstateTest.cs | 24 |
6 files changed, 251 insertions, 114 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 6f6f076..474f706 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Data.MSSQL | |||
83 | /// </summary> | 83 | /// </summary> |
84 | /// <param name="regionID">region ID.</param> | 84 | /// <param name="regionID">region ID.</param> |
85 | /// <returns></returns> | 85 | /// <returns></returns> |
86 | public EstateSettings LoadEstateSettings(UUID regionID) | 86 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) |
87 | { | 87 | { |
88 | EstateSettings es = new EstateSettings(); | 88 | EstateSettings es = new EstateSettings(); |
89 | 89 | ||
@@ -127,7 +127,7 @@ namespace OpenSim.Data.MSSQL | |||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | if (insertEstate) | 130 | if (insertEstate && create) |
131 | { | 131 | { |
132 | List<string> names = new List<string>(FieldList); | 132 | List<string> names = new List<string>(FieldList); |
133 | 133 | ||
@@ -173,25 +173,6 @@ namespace OpenSim.Data.MSSQL | |||
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | // Munge and transfer the ban list | ||
177 | |||
178 | sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID); | ||
179 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
180 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
181 | { | ||
182 | |||
183 | cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID)); | ||
184 | try | ||
185 | { | ||
186 | conn.Open(); | ||
187 | cmd.ExecuteNonQuery(); | ||
188 | } | ||
189 | catch (Exception) | ||
190 | { | ||
191 | _Log.Debug("[ESTATE DB]: Error setting up estateban from regionban"); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | //TODO check if this is needed?? | 176 | //TODO check if this is needed?? |
196 | es.Save(); | 177 | es.Save(); |
197 | } | 178 | } |
@@ -365,6 +346,31 @@ namespace OpenSim.Data.MSSQL | |||
365 | } | 346 | } |
366 | } | 347 | } |
367 | } | 348 | } |
349 | |||
350 | public EstateSettings LoadEstateSettings(int estateID) | ||
351 | { | ||
352 | return new EstateSettings(); | ||
353 | } | ||
354 | |||
355 | public List<int> GetEstates(string search) | ||
356 | { | ||
357 | return new List<int>(); | ||
358 | } | ||
359 | |||
360 | public bool LinkRegion(UUID regionID, int estateID) | ||
361 | { | ||
362 | return false; | ||
363 | } | ||
364 | |||
365 | public List<UUID> GetRegions(int estateID) | ||
366 | { | ||
367 | return new List<UUID>(); | ||
368 | } | ||
369 | |||
370 | public bool DeleteEstate(int estateID) | ||
371 | { | ||
372 | return false; | ||
373 | } | ||
368 | #endregion | 374 | #endregion |
369 | } | 375 | } |
370 | } | 376 | } |
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 2eae2d8..d0c02f0 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -121,111 +121,110 @@ namespace OpenSim.Data.MySQL | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | public EstateSettings LoadEstateSettings(UUID regionID) | 124 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) |
125 | { | 125 | { |
126 | EstateSettings es = new EstateSettings(); | ||
127 | es.OnSave += StoreEstateSettings; | ||
128 | |||
129 | string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + | 126 | string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + |
130 | " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID"; | 127 | " from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID"; |
131 | 128 | ||
132 | bool migration = true; | 129 | using (MySqlCommand cmd = new MySqlCommand()) |
130 | { | ||
131 | cmd.CommandText = sql; | ||
132 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
133 | |||
134 | return DoLoad(cmd, regionID, create); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | private EstateSettings DoLoad(MySqlCommand cmd, UUID regionID, bool create) | ||
139 | { | ||
140 | EstateSettings es = new EstateSettings(); | ||
141 | es.OnSave += StoreEstateSettings; | ||
133 | 142 | ||
134 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 143 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
135 | { | 144 | { |
136 | dbcon.Open(); | 145 | dbcon.Open(); |
137 | 146 | ||
138 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 147 | cmd.Connection = dbcon; |
139 | { | ||
140 | cmd.CommandText = sql; | ||
141 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | ||
142 | 148 | ||
143 | using (IDataReader r = cmd.ExecuteReader()) | 149 | bool found = false; |
150 | |||
151 | using (IDataReader r = cmd.ExecuteReader()) | ||
152 | { | ||
153 | if (r.Read()) | ||
144 | { | 154 | { |
145 | if (r.Read()) | 155 | found = true; |
146 | { | ||
147 | migration = false; | ||
148 | 156 | ||
149 | foreach (string name in FieldList) | 157 | foreach (string name in FieldList) |
158 | { | ||
159 | if (m_FieldMap[name].GetValue(es) is bool) | ||
150 | { | 160 | { |
151 | if (m_FieldMap[name].GetValue(es) is bool) | 161 | int v = Convert.ToInt32(r[name]); |
152 | { | 162 | if (v != 0) |
153 | int v = Convert.ToInt32(r[name]); | 163 | m_FieldMap[name].SetValue(es, true); |
154 | if (v != 0) | ||
155 | m_FieldMap[name].SetValue(es, true); | ||
156 | else | ||
157 | m_FieldMap[name].SetValue(es, false); | ||
158 | } | ||
159 | else if (m_FieldMap[name].GetValue(es) is UUID) | ||
160 | { | ||
161 | UUID uuid = UUID.Zero; | ||
162 | |||
163 | UUID.TryParse(r[name].ToString(), out uuid); | ||
164 | m_FieldMap[name].SetValue(es, uuid); | ||
165 | } | ||
166 | else | 164 | else |
167 | { | 165 | m_FieldMap[name].SetValue(es, false); |
168 | m_FieldMap[name].SetValue(es, r[name]); | 166 | } |
169 | } | 167 | else if (m_FieldMap[name].GetValue(es) is UUID) |
168 | { | ||
169 | UUID uuid = UUID.Zero; | ||
170 | |||
171 | UUID.TryParse(r[name].ToString(), out uuid); | ||
172 | m_FieldMap[name].SetValue(es, uuid); | ||
173 | } | ||
174 | else | ||
175 | { | ||
176 | m_FieldMap[name].SetValue(es, r[name]); | ||
170 | } | 177 | } |
171 | } | 178 | } |
172 | } | 179 | } |
173 | } | 180 | } |
174 | 181 | ||
175 | if (migration) | 182 | if (!found && create) |
176 | { | 183 | { |
177 | // Migration case | 184 | // Migration case |
178 | List<string> names = new List<string>(FieldList); | 185 | List<string> names = new List<string>(FieldList); |
179 | 186 | ||
180 | names.Remove("EstateID"); | 187 | names.Remove("EstateID"); |
181 | 188 | ||
182 | sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")"; | 189 | string sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")"; |
183 | 190 | ||
184 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 191 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
185 | { | 192 | { |
186 | cmd.CommandText = sql; | 193 | cmd2.CommandText = sql; |
187 | cmd.Parameters.Clear(); | 194 | cmd2.Parameters.Clear(); |
188 | 195 | ||
189 | foreach (string name in FieldList) | 196 | foreach (string name in FieldList) |
190 | { | 197 | { |
191 | if (m_FieldMap[name].GetValue(es) is bool) | 198 | if (m_FieldMap[name].GetValue(es) is bool) |
192 | { | 199 | { |
193 | if ((bool)m_FieldMap[name].GetValue(es)) | 200 | if ((bool)m_FieldMap[name].GetValue(es)) |
194 | cmd.Parameters.AddWithValue("?" + name, "1"); | 201 | cmd2.Parameters.AddWithValue("?" + name, "1"); |
195 | else | 202 | else |
196 | cmd.Parameters.AddWithValue("?" + name, "0"); | 203 | cmd2.Parameters.AddWithValue("?" + name, "0"); |
197 | } | 204 | } |
198 | else | 205 | else |
199 | { | 206 | { |
200 | cmd.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString()); | 207 | cmd2.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString()); |
201 | } | 208 | } |
202 | } | 209 | } |
203 | 210 | ||
204 | cmd.ExecuteNonQuery(); | 211 | cmd2.ExecuteNonQuery(); |
205 | 212 | ||
206 | cmd.CommandText = "select LAST_INSERT_ID() as id"; | 213 | cmd2.CommandText = "select LAST_INSERT_ID() as id"; |
207 | cmd.Parameters.Clear(); | 214 | cmd2.Parameters.Clear(); |
208 | 215 | ||
209 | using (IDataReader r = cmd.ExecuteReader()) | 216 | using (IDataReader r = cmd2.ExecuteReader()) |
210 | { | 217 | { |
211 | r.Read(); | 218 | r.Read(); |
212 | es.EstateID = Convert.ToUInt32(r["id"]); | 219 | es.EstateID = Convert.ToUInt32(r["id"]); |
213 | } | 220 | } |
214 | 221 | ||
215 | cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; | 222 | cmd2.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; |
216 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 223 | cmd2.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
217 | cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); | 224 | cmd2.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); |
218 | 225 | ||
219 | // This will throw on dupe key | 226 | // This will throw on dupe key |
220 | try { cmd.ExecuteNonQuery(); } | 227 | try { cmd2.ExecuteNonQuery(); } |
221 | catch (Exception) { } | ||
222 | |||
223 | // Munge and transfer the ban list | ||
224 | cmd.Parameters.Clear(); | ||
225 | cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID"; | ||
226 | cmd.Parameters.AddWithValue("?UUID", regionID.ToString()); | ||
227 | |||
228 | try { cmd.ExecuteNonQuery(); } | ||
229 | catch (Exception) { } | 228 | catch (Exception) { } |
230 | 229 | ||
231 | es.Save(); | 230 | es.Save(); |
@@ -398,5 +397,89 @@ namespace OpenSim.Data.MySQL | |||
398 | 397 | ||
399 | return uuids.ToArray(); | 398 | return uuids.ToArray(); |
400 | } | 399 | } |
400 | |||
401 | public EstateSettings LoadEstateSettings(int estateID) | ||
402 | { | ||
403 | using (MySqlCommand cmd = new MySqlCommand()) | ||
404 | { | ||
405 | string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = ?EstateID"; | ||
406 | |||
407 | cmd.CommandText = sql; | ||
408 | cmd.Parameters.AddWithValue("?EstateID", estateID); | ||
409 | |||
410 | return DoLoad(cmd, UUID.Zero, false); | ||
411 | } | ||
412 | } | ||
413 | |||
414 | public List<int> GetEstates(string search) | ||
415 | { | ||
416 | List<int> result = new List<int>(); | ||
417 | |||
418 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
419 | { | ||
420 | dbcon.Open(); | ||
421 | |||
422 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
423 | { | ||
424 | cmd.CommandText = "select estateID from estate_settings where EstateName = ?EstateName"; | ||
425 | cmd.Parameters.AddWithValue("?EstateName", search); | ||
426 | |||
427 | using (IDataReader reader = cmd.ExecuteReader()) | ||
428 | { | ||
429 | while (reader.Read()) | ||
430 | { | ||
431 | result.Add(Convert.ToInt32(reader["EstateID"])); | ||
432 | } | ||
433 | reader.Close(); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | |||
438 | dbcon.Close(); | ||
439 | } | ||
440 | |||
441 | return result; | ||
442 | } | ||
443 | |||
444 | public bool LinkRegion(UUID regionID, int estateID) | ||
445 | { | ||
446 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
447 | { | ||
448 | dbcon.Open(); | ||
449 | |||
450 | try | ||
451 | { | ||
452 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
453 | { | ||
454 | cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)"; | ||
455 | cmd.Parameters.AddWithValue("?RegionID", regionID); | ||
456 | cmd.Parameters.AddWithValue("?EstateID", estateID); | ||
457 | |||
458 | int ret = cmd.ExecuteNonQuery(); | ||
459 | dbcon.Close(); | ||
460 | |||
461 | return (ret != 0); | ||
462 | } | ||
463 | } | ||
464 | catch (MySqlException ex) | ||
465 | { | ||
466 | m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message); | ||
467 | } | ||
468 | |||
469 | dbcon.Close(); | ||
470 | } | ||
471 | |||
472 | return false; | ||
473 | } | ||
474 | |||
475 | public List<UUID> GetRegions(int estateID) | ||
476 | { | ||
477 | return new List<UUID>(); | ||
478 | } | ||
479 | |||
480 | public bool DeleteEstate(int estateID) | ||
481 | { | ||
482 | return false; | ||
483 | } | ||
401 | } | 484 | } |
402 | } | 485 | } |
diff --git a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql index b10ffcf..02ac1f5 100644 --- a/OpenSim/Data/MySQL/Resources/032_RegionStore.sql +++ b/OpenSim/Data/MySQL/Resources/032_RegionStore.sql | |||
@@ -67,4 +67,5 @@ CREATE TABLE `regionwindlight` ( | |||
67 | PRIMARY KEY (`region_id`) | 67 | PRIMARY KEY (`region_id`) |
68 | ); | 68 | ); |
69 | 69 | ||
70 | COMMIT; \ No newline at end of file | 70 | ALTER TABLE estate_settings AUTO_INCREMENT = 100; |
71 | COMMIT; | ||
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 5b9898c..30ad747 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Data.Null | |||
40 | { | 40 | { |
41 | private static NullRegionData Instance = null; | 41 | private static NullRegionData Instance = null; |
42 | 42 | ||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); | 45 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); |
46 | 46 | ||
@@ -192,4 +192,4 @@ namespace OpenSim.Data.Null | |||
192 | return ret; | 192 | return ret; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | } | 195 | } \ No newline at end of file |
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 1be99ee..bd6b776 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -80,11 +80,8 @@ namespace OpenSim.Data.SQLite | |||
80 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } | 80 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } |
81 | } | 81 | } |
82 | 82 | ||
83 | public EstateSettings LoadEstateSettings(UUID regionID) | 83 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) |
84 | { | 84 | { |
85 | EstateSettings es = new EstateSettings(); | ||
86 | es.OnSave += StoreEstateSettings; | ||
87 | |||
88 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; | 85 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; |
89 | 86 | ||
90 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 87 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
@@ -92,6 +89,14 @@ namespace OpenSim.Data.SQLite | |||
92 | cmd.CommandText = sql; | 89 | cmd.CommandText = sql; |
93 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 90 | cmd.Parameters.Add(":RegionID", regionID.ToString()); |
94 | 91 | ||
92 | return DoLoad(cmd, regionID, create); | ||
93 | } | ||
94 | |||
95 | private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) | ||
96 | { | ||
97 | EstateSettings es = new EstateSettings(); | ||
98 | es.OnSave += StoreEstateSettings; | ||
99 | |||
95 | IDataReader r = cmd.ExecuteReader(); | 100 | IDataReader r = cmd.ExecuteReader(); |
96 | 101 | ||
97 | if (r.Read()) | 102 | if (r.Read()) |
@@ -120,17 +125,15 @@ namespace OpenSim.Data.SQLite | |||
120 | } | 125 | } |
121 | r.Close(); | 126 | r.Close(); |
122 | } | 127 | } |
123 | else | 128 | else if (create) |
124 | { | 129 | { |
125 | // Migration case | ||
126 | // | ||
127 | r.Close(); | 130 | r.Close(); |
128 | 131 | ||
129 | List<string> names = new List<string>(FieldList); | 132 | List<string> names = new List<string>(FieldList); |
130 | 133 | ||
131 | names.Remove("EstateID"); | 134 | names.Remove("EstateID"); |
132 | 135 | ||
133 | sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; | 136 | string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; |
134 | 137 | ||
135 | cmd.CommandText = sql; | 138 | cmd.CommandText = sql; |
136 | cmd.Parameters.Clear(); | 139 | cmd.Parameters.Clear(); |
@@ -176,20 +179,6 @@ namespace OpenSim.Data.SQLite | |||
176 | { | 179 | { |
177 | } | 180 | } |
178 | 181 | ||
179 | // Munge and transfer the ban list | ||
180 | // | ||
181 | cmd.Parameters.Clear(); | ||
182 | cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID"; | ||
183 | cmd.Parameters.Add(":UUID", regionID.ToString()); | ||
184 | |||
185 | try | ||
186 | { | ||
187 | cmd.ExecuteNonQuery(); | ||
188 | } | ||
189 | catch (Exception) | ||
190 | { | ||
191 | } | ||
192 | |||
193 | es.Save(); | 182 | es.Save(); |
194 | } | 183 | } |
195 | 184 | ||
@@ -336,5 +325,63 @@ namespace OpenSim.Data.SQLite | |||
336 | 325 | ||
337 | return uuids.ToArray(); | 326 | return uuids.ToArray(); |
338 | } | 327 | } |
328 | |||
329 | public EstateSettings LoadEstateSettings(int estateID) | ||
330 | { | ||
331 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; | ||
332 | |||
333 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
334 | |||
335 | cmd.CommandText = sql; | ||
336 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | ||
337 | |||
338 | return DoLoad(cmd, UUID.Zero, false); | ||
339 | } | ||
340 | |||
341 | public List<int> GetEstates(string search) | ||
342 | { | ||
343 | List<int> result = new List<int>(); | ||
344 | |||
345 | string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; | ||
346 | |||
347 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
348 | |||
349 | cmd.CommandText = sql; | ||
350 | cmd.Parameters.Add(":EstateName", search); | ||
351 | |||
352 | IDataReader r = cmd.ExecuteReader(); | ||
353 | |||
354 | while (r.Read()) | ||
355 | { | ||
356 | result.Add(Convert.ToInt32(r["EstateID"])); | ||
357 | } | ||
358 | r.Close(); | ||
359 | |||
360 | return result; | ||
361 | } | ||
362 | |||
363 | public bool LinkRegion(UUID regionID, int estateID) | ||
364 | { | ||
365 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
366 | |||
367 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | ||
368 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | ||
369 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | ||
370 | |||
371 | if (cmd.ExecuteNonQuery() == 0) | ||
372 | return false; | ||
373 | |||
374 | return true; | ||
375 | } | ||
376 | |||
377 | public List<UUID> GetRegions(int estateID) | ||
378 | { | ||
379 | return new List<UUID>(); | ||
380 | } | ||
381 | |||
382 | public bool DeleteEstate(int estateID) | ||
383 | { | ||
384 | return false; | ||
385 | } | ||
339 | } | 386 | } |
340 | } | 387 | } |
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs index 907bb38..d14d405 100644 --- a/OpenSim/Data/Tests/BasicEstateTest.cs +++ b/OpenSim/Data/Tests/BasicEstateTest.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Data.Tests | |||
158 | public void T012_EstateSettingsRandomStorage() | 158 | public void T012_EstateSettingsRandomStorage() |
159 | { | 159 | { |
160 | // Letting estate store generate rows to database for us | 160 | // Letting estate store generate rows to database for us |
161 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 161 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
162 | new PropertyScrambler<EstateSettings>() | 162 | new PropertyScrambler<EstateSettings>() |
163 | .DontScramble(x=>x.EstateID) | 163 | .DontScramble(x=>x.EstateID) |
164 | .Scramble(originalSettings); | 164 | .Scramble(originalSettings); |
@@ -167,7 +167,7 @@ namespace OpenSim.Data.Tests | |||
167 | db.StoreEstateSettings(originalSettings); | 167 | db.StoreEstateSettings(originalSettings); |
168 | 168 | ||
169 | // Loading settings to another instance variable. | 169 | // Loading settings to another instance variable. |
170 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 170 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); |
171 | 171 | ||
172 | // Checking that loaded values are correct. | 172 | // Checking that loaded values are correct. |
173 | Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); | 173 | Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); |
@@ -177,7 +177,7 @@ namespace OpenSim.Data.Tests | |||
177 | public void T020_EstateSettingsManagerList() | 177 | public void T020_EstateSettingsManagerList() |
178 | { | 178 | { |
179 | // Letting estate store generate rows to database for us | 179 | // Letting estate store generate rows to database for us |
180 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 180 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
181 | 181 | ||
182 | originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 }; | 182 | originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 }; |
183 | 183 | ||
@@ -185,7 +185,7 @@ namespace OpenSim.Data.Tests | |||
185 | db.StoreEstateSettings(originalSettings); | 185 | db.StoreEstateSettings(originalSettings); |
186 | 186 | ||
187 | // Loading settings to another instance variable. | 187 | // Loading settings to another instance variable. |
188 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 188 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); |
189 | 189 | ||
190 | Assert.AreEqual(2, loadedSettings.EstateManagers.Length); | 190 | Assert.AreEqual(2, loadedSettings.EstateManagers.Length); |
191 | Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]); | 191 | Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]); |
@@ -196,7 +196,7 @@ namespace OpenSim.Data.Tests | |||
196 | public void T021_EstateSettingsUserList() | 196 | public void T021_EstateSettingsUserList() |
197 | { | 197 | { |
198 | // Letting estate store generate rows to database for us | 198 | // Letting estate store generate rows to database for us |
199 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 199 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
200 | 200 | ||
201 | originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 }; | 201 | originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 }; |
202 | 202 | ||
@@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests | |||
204 | db.StoreEstateSettings(originalSettings); | 204 | db.StoreEstateSettings(originalSettings); |
205 | 205 | ||
206 | // Loading settings to another instance variable. | 206 | // Loading settings to another instance variable. |
207 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 207 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); |
208 | 208 | ||
209 | Assert.AreEqual(2, loadedSettings.EstateAccess.Length); | 209 | Assert.AreEqual(2, loadedSettings.EstateAccess.Length); |
210 | Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]); | 210 | Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]); |
@@ -215,7 +215,7 @@ namespace OpenSim.Data.Tests | |||
215 | public void T022_EstateSettingsGroupList() | 215 | public void T022_EstateSettingsGroupList() |
216 | { | 216 | { |
217 | // Letting estate store generate rows to database for us | 217 | // Letting estate store generate rows to database for us |
218 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 218 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
219 | 219 | ||
220 | originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 }; | 220 | originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 }; |
221 | 221 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.Data.Tests | |||
223 | db.StoreEstateSettings(originalSettings); | 223 | db.StoreEstateSettings(originalSettings); |
224 | 224 | ||
225 | // Loading settings to another instance variable. | 225 | // Loading settings to another instance variable. |
226 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 226 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); |
227 | 227 | ||
228 | Assert.AreEqual(2, loadedSettings.EstateAccess.Length); | 228 | Assert.AreEqual(2, loadedSettings.EstateAccess.Length); |
229 | Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]); | 229 | Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]); |
@@ -234,7 +234,7 @@ namespace OpenSim.Data.Tests | |||
234 | public void T022_EstateSettingsBanList() | 234 | public void T022_EstateSettingsBanList() |
235 | { | 235 | { |
236 | // Letting estate store generate rows to database for us | 236 | // Letting estate store generate rows to database for us |
237 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | 237 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
238 | 238 | ||
239 | EstateBan estateBan1 = new EstateBan(); | 239 | EstateBan estateBan1 = new EstateBan(); |
240 | estateBan1.BannedUserID = DataTestUtil.UUID_MIN; | 240 | estateBan1.BannedUserID = DataTestUtil.UUID_MIN; |
@@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests | |||
248 | db.StoreEstateSettings(originalSettings); | 248 | db.StoreEstateSettings(originalSettings); |
249 | 249 | ||
250 | // Loading settings to another instance variable. | 250 | // Loading settings to another instance variable. |
251 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | 251 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true); |
252 | 252 | ||
253 | Assert.AreEqual(2, loadedSettings.EstateBans.Length); | 253 | Assert.AreEqual(2, loadedSettings.EstateBans.Length); |
254 | Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID); | 254 | Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID); |
@@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests | |||
290 | { | 290 | { |
291 | 291 | ||
292 | // Letting estate store generate rows to database for us | 292 | // Letting estate store generate rows to database for us |
293 | EstateSettings originalSettings = db.LoadEstateSettings(regionId); | 293 | EstateSettings originalSettings = db.LoadEstateSettings(regionId, true); |
294 | 294 | ||
295 | SetEstateSettings( | 295 | SetEstateSettings( |
296 | originalSettings, | 296 | originalSettings, |
@@ -347,7 +347,7 @@ namespace OpenSim.Data.Tests | |||
347 | db.StoreEstateSettings(originalSettings); | 347 | db.StoreEstateSettings(originalSettings); |
348 | 348 | ||
349 | // Loading settings to another instance variable. | 349 | // Loading settings to another instance variable. |
350 | EstateSettings loadedSettings = db.LoadEstateSettings(regionId); | 350 | EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true); |
351 | 351 | ||
352 | // Checking that loaded values are correct. | 352 | // Checking that loaded values are correct. |
353 | ValidateEstateSettings( | 353 | ValidateEstateSettings( |