diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 5b6135e..bd6b776 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -82,9 +82,6 @@ namespace OpenSim.Data.SQLite | |||
82 | 82 | ||
83 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | 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()) |
@@ -128,7 +133,7 @@ namespace OpenSim.Data.SQLite | |||
128 | 133 | ||
129 | names.Remove("EstateID"); | 134 | names.Remove("EstateID"); |
130 | 135 | ||
131 | 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())+")"; |
132 | 137 | ||
133 | cmd.CommandText = sql; | 138 | cmd.CommandText = sql; |
134 | cmd.Parameters.Clear(); | 139 | cmd.Parameters.Clear(); |
@@ -323,17 +328,50 @@ namespace OpenSim.Data.SQLite | |||
323 | 328 | ||
324 | public EstateSettings LoadEstateSettings(int estateID) | 329 | public EstateSettings LoadEstateSettings(int estateID) |
325 | { | 330 | { |
326 | return new EstateSettings(); | 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); | ||
327 | } | 339 | } |
328 | 340 | ||
329 | public List<int> GetEstates(string search) | 341 | public List<int> GetEstates(string search) |
330 | { | 342 | { |
331 | return new List<int>(); | 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; | ||
332 | } | 361 | } |
333 | 362 | ||
334 | public bool LinkRegion(UUID regionID, int estateID) | 363 | public bool LinkRegion(UUID regionID, int estateID) |
335 | { | 364 | { |
336 | return false; | 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; | ||
337 | } | 375 | } |
338 | 376 | ||
339 | public List<UUID> GetRegions(int estateID) | 377 | public List<UUID> GetRegions(int estateID) |