aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteEstateData.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-04-30 17:45:00 +0100
committerJustin Clark-Casey (justincc)2010-04-30 17:45:00 +0100
commitcc67de5b86ebcebadbe2ea46872a0dc63d99cae7 (patch)
tree1607da4eee9e63fe45e0abcf05da37ae5e239d70 /OpenSim/Data/SQLite/SQLiteEstateData.cs
parentMake SQLiteNG the default since it actually does work with Mono 2.4 on Linux. (diff)
downloadopensim-SC_OLD-cc67de5b86ebcebadbe2ea46872a0dc63d99cae7.zip
opensim-SC_OLD-cc67de5b86ebcebadbe2ea46872a0dc63d99cae7.tar.gz
opensim-SC_OLD-cc67de5b86ebcebadbe2ea46872a0dc63d99cae7.tar.bz2
opensim-SC_OLD-cc67de5b86ebcebadbe2ea46872a0dc63d99cae7.tar.xz
rename SQLiteNG to SQLite and SQLite to SQLiteLegacy
this seems the least evil way forward since mono 2.6 and later will see increasing usage, and this only works with what was SQLiteNG MAC USERS WILL NEED TO CHANGE REFERENCES TO "OpenSim.Data.SQLite.dll" to "OpenSim.Data.SQLiteLegacy.dll" in OpenSim.ini and config-include/StandaloneCommon.ini (if using standalone) See the OpenSim.ini.example and StandaloneCommon.ini.example files for more details This commit also temporarily changes unsigned ParentEstateID values in the OpenSim.Data.Tests to signed temporarily, since the new plugin enforces creation of signed fields in the database (which is what the SQL actually specifies). And change data columns in sqlite is a pita.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs48
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;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Data.SqliteClient; 33using Mono.Data.Sqlite;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using 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;