diff options
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteEstateData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index bd6b776..9dd4a2e 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Data.SqliteClient; | 33 | using Mono.Data.Sqlite; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite | |||
62 | Migration m = new Migration(m_connection, assem, "EstateStore"); | 62 | Migration m = new Migration(m_connection, assem, "EstateStore"); |
63 | m.Update(); | 63 | m.Update(); |
64 | 64 | ||
65 | m_connection.Close(); | 65 | //m_connection.Close(); |
66 | m_connection.Open(); | 66 | // m_connection.Open(); |
67 | 67 | ||
68 | Type t = typeof(EstateSettings); | 68 | Type t = typeof(EstateSettings); |
69 | m_Fields = t.GetFields(BindingFlags.NonPublic | | 69 | m_Fields = t.GetFields(BindingFlags.NonPublic | |
@@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLite | |||
87 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 87 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
88 | 88 | ||
89 | cmd.CommandText = sql; | 89 | cmd.CommandText = sql; |
90 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 90 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
91 | 91 | ||
92 | return DoLoad(cmd, regionID, create); | 92 | return DoLoad(cmd, regionID, create); |
93 | } | 93 | } |
@@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLite | |||
143 | if (m_FieldMap[name].GetValue(es) is bool) | 143 | if (m_FieldMap[name].GetValue(es) is bool) |
144 | { | 144 | { |
145 | if ((bool)m_FieldMap[name].GetValue(es)) | 145 | if ((bool)m_FieldMap[name].GetValue(es)) |
146 | cmd.Parameters.Add(":"+name, "1"); | 146 | cmd.Parameters.AddWithValue(":"+name, "1"); |
147 | else | 147 | else |
148 | cmd.Parameters.Add(":"+name, "0"); | 148 | cmd.Parameters.AddWithValue(":"+name, "0"); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 152 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLite | |||
167 | r.Close(); | 167 | r.Close(); |
168 | 168 | ||
169 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | 169 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; |
170 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 170 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
171 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 171 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
172 | 172 | ||
173 | // This will throw on dupe key | 173 | // This will throw on dupe key |
174 | try | 174 | try |
@@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLite | |||
211 | if (m_FieldMap[name].GetValue(es) is bool) | 211 | if (m_FieldMap[name].GetValue(es) is bool) |
212 | { | 212 | { |
213 | if ((bool)m_FieldMap[name].GetValue(es)) | 213 | if ((bool)m_FieldMap[name].GetValue(es)) |
214 | cmd.Parameters.Add(":"+name, "1"); | 214 | cmd.Parameters.AddWithValue(":"+name, "1"); |
215 | else | 215 | else |
216 | cmd.Parameters.Add(":"+name, "0"); | 216 | cmd.Parameters.AddWithValue(":"+name, "0"); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | { | 219 | { |
220 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 220 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
@@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLite | |||
236 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 236 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
237 | 237 | ||
238 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; | 238 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; |
239 | cmd.Parameters.Add(":EstateID", es.EstateID); | 239 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID); |
240 | 240 | ||
241 | IDataReader r = cmd.ExecuteReader(); | 241 | IDataReader r = cmd.ExecuteReader(); |
242 | 242 | ||
@@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLite | |||
260 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 260 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
261 | 261 | ||
262 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; | 262 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; |
263 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 263 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
264 | 264 | ||
265 | cmd.ExecuteNonQuery(); | 265 | cmd.ExecuteNonQuery(); |
266 | 266 | ||
@@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLite | |||
270 | 270 | ||
271 | foreach (EstateBan b in es.EstateBans) | 271 | foreach (EstateBan b in es.EstateBans) |
272 | { | 272 | { |
273 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 273 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
274 | cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); | 274 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); |
275 | 275 | ||
276 | cmd.ExecuteNonQuery(); | 276 | cmd.ExecuteNonQuery(); |
277 | cmd.Parameters.Clear(); | 277 | cmd.Parameters.Clear(); |
@@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLite | |||
283 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 283 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
284 | 284 | ||
285 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; | 285 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; |
286 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 286 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
287 | 287 | ||
288 | cmd.ExecuteNonQuery(); | 288 | cmd.ExecuteNonQuery(); |
289 | 289 | ||
@@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLite | |||
293 | 293 | ||
294 | foreach (UUID uuid in data) | 294 | foreach (UUID uuid in data) |
295 | { | 295 | { |
296 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 296 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
297 | cmd.Parameters.Add(":uuid", uuid.ToString()); | 297 | cmd.Parameters.AddWithValue(":uuid", uuid.ToString()); |
298 | 298 | ||
299 | cmd.ExecuteNonQuery(); | 299 | cmd.ExecuteNonQuery(); |
300 | cmd.Parameters.Clear(); | 300 | cmd.Parameters.Clear(); |
@@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite | |||
308 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 308 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
309 | 309 | ||
310 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; | 310 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; |
311 | cmd.Parameters.Add(":EstateID", EstateID); | 311 | cmd.Parameters.AddWithValue(":EstateID", EstateID); |
312 | 312 | ||
313 | IDataReader r = cmd.ExecuteReader(); | 313 | IDataReader r = cmd.ExecuteReader(); |
314 | 314 | ||
@@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLite | |||
333 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 333 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
334 | 334 | ||
335 | cmd.CommandText = sql; | 335 | cmd.CommandText = sql; |
336 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | 336 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); |
337 | 337 | ||
338 | return DoLoad(cmd, UUID.Zero, false); | 338 | return DoLoad(cmd, UUID.Zero, false); |
339 | } | 339 | } |
@@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite | |||
347 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 347 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
348 | 348 | ||
349 | cmd.CommandText = sql; | 349 | cmd.CommandText = sql; |
350 | cmd.Parameters.Add(":EstateName", search); | 350 | cmd.Parameters.AddWithValue(":EstateName", search); |
351 | 351 | ||
352 | IDataReader r = cmd.ExecuteReader(); | 352 | IDataReader r = cmd.ExecuteReader(); |
353 | 353 | ||
@@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLite | |||
365 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 365 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
366 | 366 | ||
367 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | 367 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; |
368 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 368 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
369 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | 369 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); |
370 | 370 | ||
371 | if (cmd.ExecuteNonQuery() == 0) | 371 | if (cmd.ExecuteNonQuery() == 0) |
372 | return false; | 372 | return false; |