diff options
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteEstateData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 1be99ee..643e55d 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 | |
@@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite | |||
90 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 90 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
91 | 91 | ||
92 | cmd.CommandText = sql; | 92 | cmd.CommandText = sql; |
93 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 93 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
94 | 94 | ||
95 | IDataReader r = cmd.ExecuteReader(); | 95 | IDataReader r = cmd.ExecuteReader(); |
96 | 96 | ||
@@ -140,13 +140,13 @@ namespace OpenSim.Data.SQLite | |||
140 | if (m_FieldMap[name].GetValue(es) is bool) | 140 | if (m_FieldMap[name].GetValue(es) is bool) |
141 | { | 141 | { |
142 | if ((bool)m_FieldMap[name].GetValue(es)) | 142 | if ((bool)m_FieldMap[name].GetValue(es)) |
143 | cmd.Parameters.Add(":"+name, "1"); | 143 | cmd.Parameters.AddWithValue(":"+name, "1"); |
144 | else | 144 | else |
145 | cmd.Parameters.Add(":"+name, "0"); | 145 | cmd.Parameters.AddWithValue(":"+name, "0"); |
146 | } | 146 | } |
147 | else | 147 | else |
148 | { | 148 | { |
149 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 149 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
@@ -164,8 +164,8 @@ namespace OpenSim.Data.SQLite | |||
164 | r.Close(); | 164 | r.Close(); |
165 | 165 | ||
166 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | 166 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; |
167 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 167 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
168 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 168 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
169 | 169 | ||
170 | // This will throw on dupe key | 170 | // This will throw on dupe key |
171 | try | 171 | try |
@@ -180,7 +180,7 @@ namespace OpenSim.Data.SQLite | |||
180 | // | 180 | // |
181 | cmd.Parameters.Clear(); | 181 | cmd.Parameters.Clear(); |
182 | cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID"; | 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()); | 183 | cmd.Parameters.AddWithValue(":UUID", regionID.ToString()); |
184 | 184 | ||
185 | try | 185 | try |
186 | { | 186 | { |
@@ -222,13 +222,13 @@ namespace OpenSim.Data.SQLite | |||
222 | if (m_FieldMap[name].GetValue(es) is bool) | 222 | if (m_FieldMap[name].GetValue(es) is bool) |
223 | { | 223 | { |
224 | if ((bool)m_FieldMap[name].GetValue(es)) | 224 | if ((bool)m_FieldMap[name].GetValue(es)) |
225 | cmd.Parameters.Add(":"+name, "1"); | 225 | cmd.Parameters.AddWithValue(":"+name, "1"); |
226 | else | 226 | else |
227 | cmd.Parameters.Add(":"+name, "0"); | 227 | cmd.Parameters.AddWithValue(":"+name, "0"); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | { | 230 | { |
231 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 231 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
@@ -247,7 +247,7 @@ namespace OpenSim.Data.SQLite | |||
247 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 247 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
248 | 248 | ||
249 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; | 249 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; |
250 | cmd.Parameters.Add(":EstateID", es.EstateID); | 250 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID); |
251 | 251 | ||
252 | IDataReader r = cmd.ExecuteReader(); | 252 | IDataReader r = cmd.ExecuteReader(); |
253 | 253 | ||
@@ -271,7 +271,7 @@ namespace OpenSim.Data.SQLite | |||
271 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 271 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
272 | 272 | ||
273 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; | 273 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; |
274 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 274 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
275 | 275 | ||
276 | cmd.ExecuteNonQuery(); | 276 | cmd.ExecuteNonQuery(); |
277 | 277 | ||
@@ -281,8 +281,8 @@ namespace OpenSim.Data.SQLite | |||
281 | 281 | ||
282 | foreach (EstateBan b in es.EstateBans) | 282 | foreach (EstateBan b in es.EstateBans) |
283 | { | 283 | { |
284 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 284 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
285 | cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); | 285 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); |
286 | 286 | ||
287 | cmd.ExecuteNonQuery(); | 287 | cmd.ExecuteNonQuery(); |
288 | cmd.Parameters.Clear(); | 288 | cmd.Parameters.Clear(); |
@@ -294,7 +294,7 @@ namespace OpenSim.Data.SQLite | |||
294 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 294 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
295 | 295 | ||
296 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; | 296 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; |
297 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 297 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
298 | 298 | ||
299 | cmd.ExecuteNonQuery(); | 299 | cmd.ExecuteNonQuery(); |
300 | 300 | ||
@@ -304,8 +304,8 @@ namespace OpenSim.Data.SQLite | |||
304 | 304 | ||
305 | foreach (UUID uuid in data) | 305 | foreach (UUID uuid in data) |
306 | { | 306 | { |
307 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 307 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
308 | cmd.Parameters.Add(":uuid", uuid.ToString()); | 308 | cmd.Parameters.AddWithValue(":uuid", uuid.ToString()); |
309 | 309 | ||
310 | cmd.ExecuteNonQuery(); | 310 | cmd.ExecuteNonQuery(); |
311 | cmd.Parameters.Clear(); | 311 | cmd.Parameters.Clear(); |
@@ -319,7 +319,7 @@ namespace OpenSim.Data.SQLite | |||
319 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 319 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
320 | 320 | ||
321 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; | 321 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; |
322 | cmd.Parameters.Add(":EstateID", EstateID); | 322 | cmd.Parameters.AddWithValue(":EstateID", EstateID); |
323 | 323 | ||
324 | IDataReader r = cmd.ExecuteReader(); | 324 | IDataReader r = cmd.ExecuteReader(); |
325 | 325 | ||
@@ -337,4 +337,4 @@ namespace OpenSim.Data.SQLite | |||
337 | return uuids.ToArray(); | 337 | return uuids.ToArray(); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | } | 340 | } \ No newline at end of file |