diff options
author | Justin Clark-Casey (justincc) | 2010-04-30 17:45:00 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-04-30 19:28:28 +0100 |
commit | 56fe4c24b8c67ec3b6a5a897c35ab19507bd1077 (patch) | |
tree | 8feccd68058c70da1b96d8b6e804aa4afa6dc723 /OpenSim | |
parent | add Mono.Data.Sqlite.dll (diff) | |
download | opensim-SC_OLD-56fe4c24b8c67ec3b6a5a897c35ab19507bd1077.zip opensim-SC_OLD-56fe4c24b8c67ec3b6a5a897c35ab19507bd1077.tar.gz opensim-SC_OLD-56fe4c24b8c67ec3b6a5a897c35ab19507bd1077.tar.bz2 opensim-SC_OLD-56fe4c24b8c67ec3b6a5a897c35ab19507bd1077.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 'OpenSim')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAuthenticationData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteEstateData.cs | 101 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteFramework.cs | 29 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteFriendsData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | 26 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 25 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 259 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserAccountData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs) | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUtils.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs (renamed from OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql (renamed from OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml (renamed from OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml) | 0 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAssetData.cs) | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs | 262 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs) | 10 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteEstateData.cs) | 50 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteFramework.cs) | 16 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs | 70 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs) | 20 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs) | 15 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteRegionData.cs) | 261 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs | 81 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteUtils.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs (renamed from OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Data/Tests/DataTestUtil.cs | 3 |
69 files changed, 902 insertions, 366 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index c52f60b..373c903 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -30,7 +30,7 @@ using System.Data; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
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 | 36 | ||
@@ -339,4 +339,4 @@ namespace OpenSim.Data.SQLite | |||
339 | 339 | ||
340 | #endregion | 340 | #endregion |
341 | } | 341 | } |
342 | } \ No newline at end of file | 342 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index 4a5dc2e..086ac0a 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | |||
@@ -33,7 +33,7 @@ using OpenMetaverse; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using Mono.Data.Sqlite; | 34 | using Mono.Data.Sqlite; |
35 | 35 | ||
36 | namespace OpenSim.Data.SQLiteNG | 36 | namespace OpenSim.Data.SQLite |
37 | { | 37 | { |
38 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData | 38 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData |
39 | { | 39 | { |
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 1be99ee..ad4e2a2 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 |
@@ -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 | ||
@@ -336,5 +336,66 @@ namespace OpenSim.Data.SQLite | |||
336 | 336 | ||
337 | return uuids.ToArray(); | 337 | return uuids.ToArray(); |
338 | } | 338 | } |
339 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteEstateData.cs | ||
340 | ======= | ||
341 | |||
342 | public EstateSettings LoadEstateSettings(int estateID) | ||
343 | { | ||
344 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; | ||
345 | |||
346 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
347 | |||
348 | cmd.CommandText = sql; | ||
349 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); | ||
350 | |||
351 | return DoLoad(cmd, UUID.Zero, false); | ||
352 | } | ||
353 | |||
354 | public List<int> GetEstates(string search) | ||
355 | { | ||
356 | List<int> result = new List<int>(); | ||
357 | |||
358 | string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; | ||
359 | |||
360 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
361 | |||
362 | cmd.CommandText = sql; | ||
363 | cmd.Parameters.AddWithValue(":EstateName", search); | ||
364 | |||
365 | IDataReader r = cmd.ExecuteReader(); | ||
366 | |||
367 | while (r.Read()) | ||
368 | { | ||
369 | result.Add(Convert.ToInt32(r["EstateID"])); | ||
370 | } | ||
371 | r.Close(); | ||
372 | |||
373 | return result; | ||
374 | } | ||
375 | |||
376 | public bool LinkRegion(UUID regionID, int estateID) | ||
377 | { | ||
378 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | ||
379 | |||
380 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | ||
381 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); | ||
382 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); | ||
383 | |||
384 | if (cmd.ExecuteNonQuery() == 0) | ||
385 | return false; | ||
386 | |||
387 | return true; | ||
388 | } | ||
389 | |||
390 | public List<UUID> GetRegions(int estateID) | ||
391 | { | ||
392 | return new List<UUID>(); | ||
393 | } | ||
394 | |||
395 | public bool DeleteEstate(int estateID) | ||
396 | { | ||
397 | return false; | ||
398 | } | ||
399 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteEstateData.cs | ||
339 | } | 400 | } |
340 | } | 401 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs index 12b2750..79eaab3 100644 --- a/OpenSim/Data/SQLite/SQLiteFramework.cs +++ b/OpenSim/Data/SQLite/SQLiteFramework.cs | |||
@@ -31,7 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Data; | 31 | using System.Data; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using Mono.Data.SqliteClient; | 34 | using Mono.Data.Sqlite; |
35 | 35 | ||
36 | namespace OpenSim.Data.SQLite | 36 | namespace OpenSim.Data.SQLite |
37 | { | 37 | { |
@@ -57,7 +57,19 @@ namespace OpenSim.Data.SQLite | |||
57 | { | 57 | { |
58 | lock (m_Connection) | 58 | lock (m_Connection) |
59 | { | 59 | { |
60 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteFramework.cs | ||
60 | cmd.Connection = m_Connection; | 61 | cmd.Connection = m_Connection; |
62 | ======= | ||
63 | /* | ||
64 | SqliteConnection newConnection = | ||
65 | (SqliteConnection)((ICloneable)connection).Clone(); | ||
66 | newConnection.Open(); | ||
67 | |||
68 | cmd.Connection = newConnection; | ||
69 | */ | ||
70 | cmd.Connection = connection; | ||
71 | //Console.WriteLine("XXX " + cmd.CommandText); | ||
72 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteFramework.cs | ||
61 | 73 | ||
62 | return cmd.ExecuteNonQuery(); | 74 | return cmd.ExecuteNonQuery(); |
63 | } | 75 | } |
@@ -65,12 +77,27 @@ namespace OpenSim.Data.SQLite | |||
65 | 77 | ||
66 | protected IDataReader ExecuteReader(SqliteCommand cmd) | 78 | protected IDataReader ExecuteReader(SqliteCommand cmd) |
67 | { | 79 | { |
80 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteFramework.cs | ||
68 | SqliteConnection newConnection = | 81 | SqliteConnection newConnection = |
69 | (SqliteConnection)((ICloneable)m_Connection).Clone(); | 82 | (SqliteConnection)((ICloneable)m_Connection).Clone(); |
70 | newConnection.Open(); | 83 | newConnection.Open(); |
71 | 84 | ||
72 | cmd.Connection = newConnection; | 85 | cmd.Connection = newConnection; |
73 | return cmd.ExecuteReader(); | 86 | return cmd.ExecuteReader(); |
87 | ======= | ||
88 | lock (connection) | ||
89 | { | ||
90 | //SqliteConnection newConnection = | ||
91 | // (SqliteConnection)((ICloneable)connection).Clone(); | ||
92 | //newConnection.Open(); | ||
93 | |||
94 | //cmd.Connection = newConnection; | ||
95 | cmd.Connection = connection; | ||
96 | //Console.WriteLine("XXX " + cmd.CommandText); | ||
97 | |||
98 | return cmd.ExecuteReader(); | ||
99 | } | ||
100 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteFramework.cs | ||
74 | } | 101 | } |
75 | 102 | ||
76 | protected void CloseReaderCommand(SqliteCommand cmd) | 103 | protected void CloseReaderCommand(SqliteCommand cmd) |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs index 702a1d8..b06853c 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs +++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs | |||
@@ -33,7 +33,7 @@ using OpenMetaverse; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using Mono.Data.Sqlite; | 34 | using Mono.Data.Sqlite; |
35 | 35 | ||
36 | namespace OpenSim.Data.SQLiteNG | 36 | namespace OpenSim.Data.SQLite |
37 | { | 37 | { |
38 | public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData | 38 | public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData |
39 | { | 39 | { |
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs index 8e91693..918cb3d 100644 --- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.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; |
@@ -54,7 +54,27 @@ namespace OpenSim.Data.SQLite | |||
54 | m_Realm = realm; | 54 | m_Realm = realm; |
55 | if (storeName != String.Empty) | 55 | if (storeName != String.Empty) |
56 | { | 56 | { |
57 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | ||
57 | Assembly assem = GetType().Assembly; | 58 | Assembly assem = GetType().Assembly; |
59 | ======= | ||
60 | m_Connection = new SqliteConnection(connectionString); | ||
61 | Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString)); | ||
62 | m_Connection.Open(); | ||
63 | |||
64 | if (storeName != String.Empty) | ||
65 | { | ||
66 | Assembly assem = GetType().Assembly; | ||
67 | //SqliteConnection newConnection = | ||
68 | // (SqliteConnection)((ICloneable)m_Connection).Clone(); | ||
69 | //newConnection.Open(); | ||
70 | |||
71 | //Migration m = new Migration(newConnection, assem, storeName); | ||
72 | Migration m = new Migration(m_Connection, assem, storeName); | ||
73 | m.Update(); | ||
74 | //newConnection.Close(); | ||
75 | //newConnection.Dispose(); | ||
76 | } | ||
77 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | ||
58 | 78 | ||
59 | Migration m = new Migration(m_Connection, assem, storeName); | 79 | Migration m = new Migration(m_Connection, assem, storeName); |
60 | m.Update(); | 80 | m.Update(); |
@@ -180,7 +200,11 @@ namespace OpenSim.Data.SQLite | |||
180 | result.Add(row); | 200 | result.Add(row); |
181 | } | 201 | } |
182 | 202 | ||
203 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | ||
183 | CloseReaderCommand(cmd); | 204 | CloseReaderCommand(cmd); |
205 | ======= | ||
206 | //CloseCommand(cmd); | ||
207 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | ||
184 | 208 | ||
185 | return result.ToArray(); | 209 | return result.ToArray(); |
186 | } | 210 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 64591fd..0149838 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.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 | 36 | ||
@@ -89,6 +89,7 @@ namespace OpenSim.Data.SQLite | |||
89 | 89 | ||
90 | ds = new DataSet(); | 90 | ds = new DataSet(); |
91 | 91 | ||
92 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteInventoryStore.cs | ||
92 | ds.Tables.Add(createInventoryFoldersTable()); | 93 | ds.Tables.Add(createInventoryFoldersTable()); |
93 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); | 94 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); |
94 | setupFoldersCommands(invFoldersDa, conn); | 95 | setupFoldersCommands(invFoldersDa, conn); |
@@ -98,6 +99,19 @@ namespace OpenSim.Data.SQLite | |||
98 | invItemsDa.Fill(ds.Tables["inventoryitems"]); | 99 | invItemsDa.Fill(ds.Tables["inventoryitems"]); |
99 | setupItemsCommands(invItemsDa, conn); | 100 | setupItemsCommands(invItemsDa, conn); |
100 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); | 101 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); |
102 | ======= | ||
103 | ds.Tables.Add(createInventoryFoldersTable()); | ||
104 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); | ||
105 | setupFoldersCommands(invFoldersDa, conn); | ||
106 | CreateDataSetMapping(invFoldersDa, "inventoryfolders"); | ||
107 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); | ||
108 | |||
109 | ds.Tables.Add(createInventoryItemsTable()); | ||
110 | invItemsDa.Fill(ds.Tables["inventoryitems"]); | ||
111 | setupItemsCommands(invItemsDa, conn); | ||
112 | CreateDataSetMapping(invItemsDa, "inventoryitems"); | ||
113 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); | ||
114 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteInventoryStore.cs | ||
101 | 115 | ||
102 | ds.AcceptChanges(); | 116 | ds.AcceptChanges(); |
103 | } | 117 | } |
@@ -721,6 +735,15 @@ namespace OpenSim.Data.SQLite | |||
721 | * | 735 | * |
722 | **********************************************************************/ | 736 | **********************************************************************/ |
723 | 737 | ||
738 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
739 | { | ||
740 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
741 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
742 | { | ||
743 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
744 | } | ||
745 | } | ||
746 | |||
724 | /// <summary> | 747 | /// <summary> |
725 | /// Create the "inventoryitems" table | 748 | /// Create the "inventoryitems" table |
726 | /// </summary> | 749 | /// </summary> |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 5a4ee2a..85368ab 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -32,7 +32,7 @@ using System.Drawing; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Data.SqliteClient; | 35 | using Mono.Data.Sqlite; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
@@ -87,119 +87,142 @@ namespace OpenSim.Data.SQLite | |||
87 | /// <param name="connectionString">the connection string</param> | 87 | /// <param name="connectionString">the connection string</param> |
88 | public void Initialise(string connectionString) | 88 | public void Initialise(string connectionString) |
89 | { | 89 | { |
90 | m_connectionString = connectionString; | 90 | try |
91 | { | ||
92 | m_connectionString = connectionString; | ||
91 | 93 | ||
92 | ds = new DataSet(); | 94 | ds = new DataSet("Region"); |
93 | 95 | ||
94 | m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); | 96 | m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); |
95 | m_conn = new SqliteConnection(m_connectionString); | 97 | m_conn = new SqliteConnection(m_connectionString); |
96 | m_conn.Open(); | 98 | m_conn.Open(); |
97 | 99 | ||
100 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | ||
101 | primDa = new SqliteDataAdapter(primSelectCmd); | ||
98 | 102 | ||
103 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | ||
104 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | ||
105 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
99 | 106 | ||
100 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | 107 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); |
101 | primDa = new SqliteDataAdapter(primSelectCmd); | 108 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); |
102 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
103 | 109 | ||
104 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | 110 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); |
105 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | 111 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); |
106 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
107 | 112 | ||
108 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); | 113 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); |
109 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); | 114 | landDa = new SqliteDataAdapter(landSelectCmd); |
110 | 115 | ||
111 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); | 116 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); |
112 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); | 117 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); |
113 | 118 | ||
114 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); | 119 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); |
115 | landDa = new SqliteDataAdapter(landSelectCmd); | 120 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); |
121 | // This actually does the roll forward assembly stuff | ||
122 | Assembly assem = GetType().Assembly; | ||
123 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
124 | m.Update(); | ||
116 | 125 | ||
117 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); | 126 | lock (ds) |
118 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); | 127 | { |
128 | ds.Tables.Add(createPrimTable()); | ||
129 | setupPrimCommands(primDa, m_conn); | ||
119 | 130 | ||
120 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); | 131 | ds.Tables.Add(createShapeTable()); |
121 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); | 132 | setupShapeCommands(shapeDa, m_conn); |
122 | // This actually does the roll forward assembly stuff | ||
123 | Assembly assem = GetType().Assembly; | ||
124 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
125 | m.Update(); | ||
126 | 133 | ||
127 | lock (ds) | 134 | ds.Tables.Add(createItemsTable()); |
128 | { | 135 | setupItemsCommands(itemsDa, m_conn); |
129 | ds.Tables.Add(createPrimTable()); | ||
130 | setupPrimCommands(primDa, m_conn); | ||
131 | primDa.Fill(ds.Tables["prims"]); | ||
132 | 136 | ||
133 | ds.Tables.Add(createShapeTable()); | 137 | ds.Tables.Add(createTerrainTable()); |
134 | setupShapeCommands(shapeDa, m_conn); | 138 | setupTerrainCommands(terrainDa, m_conn); |
135 | 139 | ||
136 | ds.Tables.Add(createItemsTable()); | 140 | ds.Tables.Add(createLandTable()); |
137 | setupItemsCommands(itemsDa, m_conn); | 141 | setupLandCommands(landDa, m_conn); |
138 | itemsDa.Fill(ds.Tables["primitems"]); | ||
139 | 142 | ||
140 | ds.Tables.Add(createTerrainTable()); | 143 | ds.Tables.Add(createLandAccessListTable()); |
141 | setupTerrainCommands(terrainDa, m_conn); | 144 | setupLandAccessCommands(landAccessListDa, m_conn); |
142 | 145 | ||
143 | ds.Tables.Add(createLandTable()); | 146 | ds.Tables.Add(createRegionSettingsTable()); |
144 | setupLandCommands(landDa, m_conn); | 147 | setupRegionSettingsCommands(regionSettingsDa, m_conn); |
145 | 148 | ||
146 | ds.Tables.Add(createLandAccessListTable()); | 149 | // WORKAROUND: This is a work around for sqlite on |
147 | setupLandAccessCommands(landAccessListDa, m_conn); | 150 | // windows, which gets really unhappy with blob columns |
151 | // that have no sample data in them. At some point we | ||
152 | // need to actually find a proper way to handle this. | ||
153 | try | ||
154 | { | ||
155 | primDa.Fill(ds.Tables["prims"]); | ||
156 | } | ||
157 | catch (Exception) | ||
158 | { | ||
159 | m_log.Info("[REGION DB]: Caught fill error on prims table"); | ||
160 | } | ||
148 | 161 | ||
149 | ds.Tables.Add(createRegionSettingsTable()); | 162 | try |
150 | 163 | { | |
151 | setupRegionSettingsCommands(regionSettingsDa, m_conn); | 164 | shapeDa.Fill(ds.Tables["primshapes"]); |
165 | } | ||
166 | catch (Exception) | ||
167 | { | ||
168 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
169 | } | ||
152 | 170 | ||
153 | // WORKAROUND: This is a work around for sqlite on | 171 | try |
154 | // windows, which gets really unhappy with blob columns | 172 | { |
155 | // that have no sample data in them. At some point we | 173 | terrainDa.Fill(ds.Tables["terrain"]); |
156 | // need to actually find a proper way to handle this. | 174 | } |
157 | try | 175 | catch (Exception) |
158 | { | 176 | { |
159 | shapeDa.Fill(ds.Tables["primshapes"]); | 177 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); |
160 | } | 178 | } |
161 | catch (Exception) | ||
162 | { | ||
163 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
164 | } | ||
165 | 179 | ||
166 | try | 180 | try |
167 | { | 181 | { |
168 | terrainDa.Fill(ds.Tables["terrain"]); | 182 | landDa.Fill(ds.Tables["land"]); |
169 | } | 183 | } |
170 | catch (Exception) | 184 | catch (Exception) |
171 | { | 185 | { |
172 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); | 186 | m_log.Info("[REGION DB]: Caught fill error on land table"); |
173 | } | 187 | } |
174 | 188 | ||
175 | try | 189 | try |
176 | { | 190 | { |
177 | landDa.Fill(ds.Tables["land"]); | 191 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); |
178 | } | 192 | } |
179 | catch (Exception) | 193 | catch (Exception) |
180 | { | 194 | { |
181 | m_log.Info("[REGION DB]: Caught fill error on land table"); | 195 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); |
182 | } | 196 | } |
183 | 197 | ||
184 | try | 198 | try |
185 | { | 199 | { |
186 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); | 200 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); |
187 | } | 201 | } |
188 | catch (Exception) | 202 | catch (Exception) |
189 | { | 203 | { |
190 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); | 204 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); |
191 | } | 205 | } |
192 | 206 | ||
193 | try | 207 | // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! |
194 | { | 208 | // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 |
195 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); | 209 | // Possibly because we manually set up our own DataTables before connecting to the database |
196 | } | 210 | CreateDataSetMapping(primDa, "prims"); |
197 | catch (Exception) | 211 | CreateDataSetMapping(shapeDa, "primshapes"); |
198 | { | 212 | CreateDataSetMapping(itemsDa, "primitems"); |
199 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); | 213 | CreateDataSetMapping(terrainDa, "terrain"); |
214 | CreateDataSetMapping(landDa, "land"); | ||
215 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); | ||
216 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); | ||
200 | } | 217 | } |
201 | return; | ||
202 | } | 218 | } |
219 | catch (Exception e) | ||
220 | { | ||
221 | m_log.Error(e); | ||
222 | Environment.Exit(23); | ||
223 | } | ||
224 | |||
225 | return; | ||
203 | } | 226 | } |
204 | 227 | ||
205 | public void Dispose() | 228 | public void Dispose() |
@@ -594,7 +617,7 @@ namespace OpenSim.Data.SQLite | |||
594 | } | 617 | } |
595 | } | 618 | } |
596 | } | 619 | } |
597 | rev = (int) row["Revision"]; | 620 | rev = Convert.ToInt32(row["Revision"]); |
598 | } | 621 | } |
599 | else | 622 | else |
600 | { | 623 | { |
@@ -746,6 +769,7 @@ namespace OpenSim.Data.SQLite | |||
746 | /// </summary> | 769 | /// </summary> |
747 | public void Commit() | 770 | public void Commit() |
748 | { | 771 | { |
772 | m_log.Debug("[SQLITE]: Starting commit"); | ||
749 | lock (ds) | 773 | lock (ds) |
750 | { | 774 | { |
751 | primDa.Update(ds, "prims"); | 775 | primDa.Update(ds, "prims"); |
@@ -760,18 +784,11 @@ namespace OpenSim.Data.SQLite | |||
760 | { | 784 | { |
761 | regionSettingsDa.Update(ds, "regionsettings"); | 785 | regionSettingsDa.Update(ds, "regionsettings"); |
762 | } | 786 | } |
763 | catch (SqliteExecutionException SqlEx) | 787 | catch (SqliteException SqlEx) |
764 | { | 788 | { |
765 | if (SqlEx.Message.Contains("logic error")) | 789 | throw new Exception( |
766 | { | 790 | "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", |
767 | throw new Exception( | 791 | SqlEx); |
768 | "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", | ||
769 | SqlEx); | ||
770 | } | ||
771 | else | ||
772 | { | ||
773 | throw SqlEx; | ||
774 | } | ||
775 | } | 792 | } |
776 | ds.AcceptChanges(); | 793 | ds.AcceptChanges(); |
777 | } | 794 | } |
@@ -793,6 +810,15 @@ namespace OpenSim.Data.SQLite | |||
793 | * | 810 | * |
794 | **********************************************************************/ | 811 | **********************************************************************/ |
795 | 812 | ||
813 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
814 | { | ||
815 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
816 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
817 | { | ||
818 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
819 | } | ||
820 | } | ||
821 | |||
796 | /// <summary> | 822 | /// <summary> |
797 | /// | 823 | /// |
798 | /// </summary> | 824 | /// </summary> |
@@ -1955,6 +1981,7 @@ namespace OpenSim.Data.SQLite | |||
1955 | sql += ") values (:"; | 1981 | sql += ") values (:"; |
1956 | sql += String.Join(", :", cols); | 1982 | sql += String.Join(", :", cols); |
1957 | sql += ")"; | 1983 | sql += ")"; |
1984 | m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); | ||
1958 | SqliteCommand cmd = new SqliteCommand(sql); | 1985 | SqliteCommand cmd = new SqliteCommand(sql); |
1959 | 1986 | ||
1960 | // this provides the binding for all our parameters, so | 1987 | // this provides the binding for all our parameters, so |
@@ -2250,6 +2277,36 @@ namespace OpenSim.Data.SQLite | |||
2250 | return DbType.String; | 2277 | return DbType.String; |
2251 | } | 2278 | } |
2252 | } | 2279 | } |
2280 | |||
2281 | static void PrintDataSet(DataSet ds) | ||
2282 | { | ||
2283 | // Print out any name and extended properties. | ||
2284 | Console.WriteLine("DataSet is named: {0}", ds.DataSetName); | ||
2285 | foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) | ||
2286 | { | ||
2287 | Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); | ||
2288 | } | ||
2289 | Console.WriteLine(); | ||
2290 | foreach (DataTable dt in ds.Tables) | ||
2291 | { | ||
2292 | Console.WriteLine("=> {0} Table:", dt.TableName); | ||
2293 | // Print out the column names. | ||
2294 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2295 | { | ||
2296 | Console.Write(dt.Columns[curCol].ColumnName + "\t"); | ||
2297 | } | ||
2298 | Console.WriteLine("\n----------------------------------"); | ||
2299 | // Print the DataTable. | ||
2300 | for (int curRow = 0; curRow < dt.Rows.Count; curRow++) | ||
2301 | { | ||
2302 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2303 | { | ||
2304 | Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); | ||
2305 | } | ||
2306 | Console.WriteLine(); | ||
2307 | } | ||
2308 | } | ||
2309 | } | ||
2253 | 2310 | ||
2254 | } | 2311 | } |
2255 | } | 2312 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs index f77159c..893f105 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserAccountData.cs | |||
@@ -33,7 +33,7 @@ using OpenMetaverse; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using Mono.Data.Sqlite; | 34 | using Mono.Data.Sqlite; |
35 | 35 | ||
36 | namespace OpenSim.Data.SQLiteNG | 36 | namespace OpenSim.Data.SQLite |
37 | { | 37 | { |
38 | public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData | 38 | public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData |
39 | { | 39 | { |
diff --git a/OpenSim/Data/SQLite/SQLiteUtils.cs b/OpenSim/Data/SQLite/SQLiteUtils.cs index 4a835ce..07c6b69 100644 --- a/OpenSim/Data/SQLite/SQLiteUtils.cs +++ b/OpenSim/Data/SQLite/SQLiteUtils.cs | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Data; | 29 | using System.Data; |
30 | using Mono.Data.SqliteClient; | 30 | using Mono.Data.Sqlite; |
31 | 31 | ||
32 | namespace OpenSim.Data.SQLite | 32 | namespace OpenSim.Data.SQLite |
33 | { | 33 | { |
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 5c93f88..0650a86 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |||
@@ -29,7 +29,7 @@ using System; | |||
29 | using System.Data; | 29 | using System.Data; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using Mono.Data.SqliteClient; | 32 | using Mono.Data.Sqlite; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -147,7 +147,11 @@ namespace OpenSim.Data.SQLite | |||
147 | } | 147 | } |
148 | 148 | ||
149 | reader.Close(); | 149 | reader.Close(); |
150 | <<<<<<< HEAD:OpenSim/Data/SQLite/SQLiteXInventoryData.cs | ||
150 | CloseReaderCommand(cmd); | 151 | CloseReaderCommand(cmd); |
152 | ======= | ||
153 | //CloseCommand(cmd); | ||
154 | >>>>>>> cc67de5... rename SQLiteNG to SQLite and SQLite to SQLiteLegacy:OpenSim/Data/SQLite/SQLiteXInventoryData.cs | ||
151 | 155 | ||
152 | return perms; | 156 | return perms; |
153 | } | 157 | } |
diff --git a/OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs b/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs index 4aeb67b..609a024 100644 --- a/OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs +++ b/OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs | |||
@@ -32,11 +32,11 @@ using System.Runtime.InteropServices; | |||
32 | // set of attributes. Change these attribute values to modify the information | 32 | // set of attributes. Change these attribute values to modify the information |
33 | // associated with an assembly. | 33 | // associated with an assembly. |
34 | 34 | ||
35 | [assembly : AssemblyTitle("OpenSim.Data.SQLiteNG")] | 35 | [assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")] |
36 | [assembly : AssemblyDescription("")] | 36 | [assembly : AssemblyDescription("")] |
37 | [assembly : AssemblyConfiguration("")] | 37 | [assembly : AssemblyConfiguration("")] |
38 | [assembly : AssemblyCompany("http://opensimulator.org")] | 38 | [assembly : AssemblyCompany("http://opensimulator.org")] |
39 | [assembly : AssemblyProduct("OpenSim.Data.SQLiteNG")] | 39 | [assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")] |
40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] | 40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] |
41 | [assembly : AssemblyTrademark("")] | 41 | [assembly : AssemblyTrademark("")] |
42 | [assembly : AssemblyCulture("")] | 42 | [assembly : AssemblyCulture("")] |
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql index 2e026ca..2e026ca 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_AssetStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql index 468567d..468567d 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_AuthStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_AuthStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql index 7ec906b..7ec906b 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_Avatar.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_Avatar.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql index f1b9ab9..f1b9ab9 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_FriendsStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_FriendsStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql index 554d5c2..554d5c2 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_InventoryStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql index 39e8180..39e8180 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql index c38d9a7..c38d9a7 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_UserAccount.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_UserAccount.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql index b584594..b584594 100644 --- a/OpenSim/Data/SQLiteNG/Resources/001_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql index 5339b84..5339b84 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_AssetStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql index 3237b68..3237b68 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_AuthStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_AuthStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql index 6733502..6733502 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_FriendsStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_FriendsStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql index 01951d6..01951d6 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_InventoryStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_InventoryStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql index c5c7c99..c5c7c99 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql index c7a6293..c7a6293 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_UserAccount.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_UserAccount.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql index 48fc680..48fc680 100644 --- a/OpenSim/Data/SQLiteNG/Resources/002_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql index f54f8d9..f54f8d9 100644 --- a/OpenSim/Data/SQLiteNG/Resources/003_AssetStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql index 4c6da91..4c6da91 100644 --- a/OpenSim/Data/SQLiteNG/Resources/003_InventoryStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/003_InventoryStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql index 4db2f75..4db2f75 100644 --- a/OpenSim/Data/SQLiteNG/Resources/003_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql index 6f890ee..6f890ee 100644 --- a/OpenSim/Data/SQLiteNG/Resources/003_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql index 39421c4..39421c4 100644 --- a/OpenSim/Data/SQLiteNG/Resources/004_AssetStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql index e8f4d46..e8f4d46 100644 --- a/OpenSim/Data/SQLiteNG/Resources/004_InventoryStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql index de328cb..de328cb 100644 --- a/OpenSim/Data/SQLiteNG/Resources/004_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql index 03142af..03142af 100644 --- a/OpenSim/Data/SQLiteNG/Resources/004_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql index 1f6d1bd..1f6d1bd 100644 --- a/OpenSim/Data/SQLiteNG/Resources/005_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql index e45c09a..e45c09a 100644 --- a/OpenSim/Data/SQLiteNG/Resources/005_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql index 94ed818..94ed818 100644 --- a/OpenSim/Data/SQLiteNG/Resources/006_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql index f9454c5..f9454c5 100644 --- a/OpenSim/Data/SQLiteNG/Resources/006_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql index 1c813a0..1c813a0 100644 --- a/OpenSim/Data/SQLiteNG/Resources/007_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql index 8b0cd28..8b0cd28 100644 --- a/OpenSim/Data/SQLiteNG/Resources/007_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql index 28bfbf5..28bfbf5 100644 --- a/OpenSim/Data/SQLiteNG/Resources/008_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql index 97da818..97da818 100644 --- a/OpenSim/Data/SQLiteNG/Resources/008_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql index 1f40548..1f40548 100644 --- a/OpenSim/Data/SQLiteNG/Resources/009_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql index 8ab03ef..8ab03ef 100644 --- a/OpenSim/Data/SQLiteNG/Resources/009_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql index b91ccf0..b91ccf0 100644 --- a/OpenSim/Data/SQLiteNG/Resources/010_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql index 5f956da..5f956da 100644 --- a/OpenSim/Data/SQLiteNG/Resources/010_UserStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql index 42bef89..42bef89 100644 --- a/OpenSim/Data/SQLiteNG/Resources/011_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql index d952b78..d952b78 100644 --- a/OpenSim/Data/SQLiteNG/Resources/012_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql index 11529cd..11529cd 100644 --- a/OpenSim/Data/SQLiteNG/Resources/013_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql index c59b27e..c59b27e 100644 --- a/OpenSim/Data/SQLiteNG/Resources/014_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql index c43f356..c43f356 100644 --- a/OpenSim/Data/SQLiteNG/Resources/015_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql index 52f160c..52f160c 100644 --- a/OpenSim/Data/SQLiteNG/Resources/016_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql index 6c6b7b5..6c6b7b5 100644 --- a/OpenSim/Data/SQLiteNG/Resources/017_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql b/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql index 6a390c2..6a390c2 100644 --- a/OpenSim/Data/SQLiteNG/Resources/018_RegionStore.sql +++ b/OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql | |||
diff --git a/OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml b/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml index e6764fa..e6764fa 100644 --- a/OpenSim/Data/SQLiteNG/Resources/OpenSim.Data.SQLite.addin.xml +++ b/OpenSim/Data/SQLiteLegacy/Resources/OpenSim.Data.SQLite.addin.xml | |||
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs index 9b34a21..0d63dea 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs | |||
@@ -30,11 +30,11 @@ using System.Data; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Data.Sqlite; | 33 | using Mono.Data.SqliteClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | 36 | ||
37 | namespace OpenSim.Data.SQLiteNG | 37 | namespace OpenSim.Data.SQLiteLegacy |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// An asset storage interface for the SQLite database system | 40 | /// An asset storage interface for the SQLite database system |
@@ -137,7 +137,7 @@ namespace OpenSim.Data.SQLiteNG | |||
137 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 137 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
138 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 138 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
139 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 139 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
140 | 140 | ||
141 | cmd.ExecuteNonQuery(); | 141 | cmd.ExecuteNonQuery(); |
142 | } | 142 | } |
143 | } | 143 | } |
@@ -340,4 +340,4 @@ namespace OpenSim.Data.SQLiteNG | |||
340 | 340 | ||
341 | #endregion | 341 | #endregion |
342 | } | 342 | } |
343 | } | 343 | } \ No newline at end of file |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs new file mode 100644 index 0000000..c64830a --- /dev/null +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs | |||
@@ -0,0 +1,262 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData | ||
39 | { | ||
40 | private string m_Realm; | ||
41 | private List<string> m_ColumnNames; | ||
42 | private int m_LastExpire; | ||
43 | private string m_connectionString; | ||
44 | |||
45 | protected static SqliteConnection m_Connection; | ||
46 | private static bool m_initialized = false; | ||
47 | |||
48 | public SQLiteAuthenticationData(string connectionString, string realm) | ||
49 | : base(connectionString) | ||
50 | { | ||
51 | m_Realm = realm; | ||
52 | m_connectionString = connectionString; | ||
53 | |||
54 | if (!m_initialized) | ||
55 | { | ||
56 | m_Connection = new SqliteConnection(connectionString); | ||
57 | m_Connection.Open(); | ||
58 | |||
59 | using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone()) | ||
60 | { | ||
61 | dbcon.Open(); | ||
62 | Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); | ||
63 | m.Update(); | ||
64 | dbcon.Close(); | ||
65 | } | ||
66 | |||
67 | m_initialized = true; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | public AuthenticationData Get(UUID principalID) | ||
72 | { | ||
73 | AuthenticationData ret = new AuthenticationData(); | ||
74 | ret.Data = new Dictionary<string, object>(); | ||
75 | |||
76 | SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID"); | ||
77 | cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString())); | ||
78 | |||
79 | IDataReader result = ExecuteReader(cmd, m_Connection); | ||
80 | |||
81 | try | ||
82 | { | ||
83 | if (result.Read()) | ||
84 | { | ||
85 | ret.PrincipalID = principalID; | ||
86 | |||
87 | if (m_ColumnNames == null) | ||
88 | { | ||
89 | m_ColumnNames = new List<string>(); | ||
90 | |||
91 | DataTable schemaTable = result.GetSchemaTable(); | ||
92 | foreach (DataRow row in schemaTable.Rows) | ||
93 | m_ColumnNames.Add(row["ColumnName"].ToString()); | ||
94 | } | ||
95 | |||
96 | foreach (string s in m_ColumnNames) | ||
97 | { | ||
98 | if (s == "UUID") | ||
99 | continue; | ||
100 | |||
101 | ret.Data[s] = result[s].ToString(); | ||
102 | } | ||
103 | |||
104 | return ret; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | return null; | ||
109 | } | ||
110 | } | ||
111 | catch | ||
112 | { | ||
113 | } | ||
114 | finally | ||
115 | { | ||
116 | CloseCommand(cmd); | ||
117 | } | ||
118 | |||
119 | return null; | ||
120 | } | ||
121 | |||
122 | public bool Store(AuthenticationData data) | ||
123 | { | ||
124 | if (data.Data.ContainsKey("UUID")) | ||
125 | data.Data.Remove("UUID"); | ||
126 | |||
127 | string[] fields = new List<string>(data.Data.Keys).ToArray(); | ||
128 | string[] values = new string[data.Data.Count]; | ||
129 | int i = 0; | ||
130 | foreach (object o in data.Data.Values) | ||
131 | values[i++] = o.ToString(); | ||
132 | |||
133 | SqliteCommand cmd = new SqliteCommand(); | ||
134 | |||
135 | if (Get(data.PrincipalID) != null) | ||
136 | { | ||
137 | |||
138 | |||
139 | string update = "update `" + m_Realm + "` set "; | ||
140 | bool first = true; | ||
141 | foreach (string field in fields) | ||
142 | { | ||
143 | if (!first) | ||
144 | update += ", "; | ||
145 | update += "`" + field + "` = :" + field; | ||
146 | cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field])); | ||
147 | |||
148 | first = false; | ||
149 | } | ||
150 | |||
151 | update += " where UUID = :UUID"; | ||
152 | cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString())); | ||
153 | |||
154 | cmd.CommandText = update; | ||
155 | try | ||
156 | { | ||
157 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | ||
158 | { | ||
159 | CloseCommand(cmd); | ||
160 | return false; | ||
161 | } | ||
162 | } | ||
163 | catch (Exception e) | ||
164 | { | ||
165 | Console.WriteLine(e.ToString()); | ||
166 | CloseCommand(cmd); | ||
167 | return false; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | else | ||
172 | { | ||
173 | string insert = "insert into `" + m_Realm + "` (`UUID`, `" + | ||
174 | String.Join("`, `", fields) + | ||
175 | "`) values (:UUID, :" + String.Join(", :", fields) + ")"; | ||
176 | |||
177 | cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString())); | ||
178 | foreach (string field in fields) | ||
179 | cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field])); | ||
180 | |||
181 | cmd.CommandText = insert; | ||
182 | |||
183 | try | ||
184 | { | ||
185 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | ||
186 | { | ||
187 | CloseCommand(cmd); | ||
188 | return false; | ||
189 | } | ||
190 | } | ||
191 | catch (Exception e) | ||
192 | { | ||
193 | Console.WriteLine(e.ToString()); | ||
194 | CloseCommand(cmd); | ||
195 | return false; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | CloseCommand(cmd); | ||
200 | |||
201 | return true; | ||
202 | } | ||
203 | |||
204 | public bool SetDataItem(UUID principalID, string item, string value) | ||
205 | { | ||
206 | SqliteCommand cmd = new SqliteCommand("update `" + m_Realm + | ||
207 | "` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'"); | ||
208 | |||
209 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
210 | return true; | ||
211 | |||
212 | return false; | ||
213 | } | ||
214 | |||
215 | public bool SetToken(UUID principalID, string token, int lifetime) | ||
216 | { | ||
217 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
218 | DoExpire(); | ||
219 | |||
220 | SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + | ||
221 | "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))"); | ||
222 | |||
223 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
224 | { | ||
225 | cmd.Dispose(); | ||
226 | return true; | ||
227 | } | ||
228 | |||
229 | cmd.Dispose(); | ||
230 | return false; | ||
231 | } | ||
232 | |||
233 | public bool CheckToken(UUID principalID, string token, int lifetime) | ||
234 | { | ||
235 | if (System.Environment.TickCount - m_LastExpire > 30000) | ||
236 | DoExpire(); | ||
237 | |||
238 | SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + | ||
239 | " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"); | ||
240 | |||
241 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
242 | { | ||
243 | cmd.Dispose(); | ||
244 | return true; | ||
245 | } | ||
246 | |||
247 | cmd.Dispose(); | ||
248 | |||
249 | return false; | ||
250 | } | ||
251 | |||
252 | private void DoExpire() | ||
253 | { | ||
254 | SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')"); | ||
255 | ExecuteNonQuery(cmd, m_Connection); | ||
256 | |||
257 | cmd.Dispose(); | ||
258 | |||
259 | m_LastExpire = System.Environment.TickCount; | ||
260 | } | ||
261 | } | ||
262 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs index d0fd49c..660632c 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs | |||
@@ -33,9 +33,9 @@ using System.Threading; | |||
33 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using Mono.Data.Sqlite; | 36 | using Mono.Data.SqliteClient; |
37 | 37 | ||
38 | namespace OpenSim.Data.SQLiteNG | 38 | namespace OpenSim.Data.SQLiteLegacy |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// A SQLite Interface for Avatar Data | 41 | /// A SQLite Interface for Avatar Data |
@@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLiteNG | |||
55 | SqliteCommand cmd = new SqliteCommand(); | 55 | SqliteCommand cmd = new SqliteCommand(); |
56 | 56 | ||
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); | 57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); |
58 | cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); | 58 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); |
59 | cmd.Parameters.AddWithValue(":Name", name); | 59 | cmd.Parameters.Add(":Name", name); |
60 | 60 | ||
61 | try | 61 | try |
62 | { | 62 | { |
@@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLiteNG | |||
67 | } | 67 | } |
68 | finally | 68 | finally |
69 | { | 69 | { |
70 | //CloseCommand(cmd); | 70 | CloseCommand(cmd); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index 2e2d717..e135eaa 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | |||
@@ -30,12 +30,12 @@ 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.Sqlite; | 33 | using Mono.Data.SqliteClient; |
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; |
37 | 37 | ||
38 | namespace OpenSim.Data.SQLiteNG | 38 | namespace OpenSim.Data.SQLiteLegacy |
39 | { | 39 | { |
40 | public class SQLiteEstateStore : IEstateDataStore | 40 | public class SQLiteEstateStore : IEstateDataStore |
41 | { | 41 | { |
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLiteNG | |||
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.SQLiteNG | |||
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.AddWithValue(":RegionID", regionID.ToString()); | 90 | cmd.Parameters.Add(":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.SQLiteNG | |||
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.AddWithValue(":"+name, "1"); | 146 | cmd.Parameters.Add(":"+name, "1"); |
147 | else | 147 | else |
148 | cmd.Parameters.AddWithValue(":"+name, "0"); | 148 | cmd.Parameters.Add(":"+name, "0"); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 152 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLiteNG | |||
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.AddWithValue(":RegionID", regionID.ToString()); | 170 | cmd.Parameters.Add(":RegionID", regionID.ToString()); |
171 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); | 171 | cmd.Parameters.Add(":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.SQLiteNG | |||
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.AddWithValue(":"+name, "1"); | 214 | cmd.Parameters.Add(":"+name, "1"); |
215 | else | 215 | else |
216 | cmd.Parameters.AddWithValue(":"+name, "0"); | 216 | cmd.Parameters.Add(":"+name, "0"); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | { | 219 | { |
220 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 220 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
@@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLiteNG | |||
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.AddWithValue(":EstateID", es.EstateID); | 239 | cmd.Parameters.Add(":EstateID", es.EstateID); |
240 | 240 | ||
241 | IDataReader r = cmd.ExecuteReader(); | 241 | IDataReader r = cmd.ExecuteReader(); |
242 | 242 | ||
@@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLiteNG | |||
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.AddWithValue(":EstateID", es.EstateID.ToString()); | 263 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); |
264 | 264 | ||
265 | cmd.ExecuteNonQuery(); | 265 | cmd.ExecuteNonQuery(); |
266 | 266 | ||
@@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLiteNG | |||
270 | 270 | ||
271 | foreach (EstateBan b in es.EstateBans) | 271 | foreach (EstateBan b in es.EstateBans) |
272 | { | 272 | { |
273 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); | 273 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); |
274 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); | 274 | cmd.Parameters.Add(":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.SQLiteNG | |||
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.AddWithValue(":EstateID", EstateID.ToString()); | 286 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); |
287 | 287 | ||
288 | cmd.ExecuteNonQuery(); | 288 | cmd.ExecuteNonQuery(); |
289 | 289 | ||
@@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLiteNG | |||
293 | 293 | ||
294 | foreach (UUID uuid in data) | 294 | foreach (UUID uuid in data) |
295 | { | 295 | { |
296 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); | 296 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); |
297 | cmd.Parameters.AddWithValue(":uuid", uuid.ToString()); | 297 | cmd.Parameters.Add(":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.SQLiteNG | |||
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.AddWithValue(":EstateID", EstateID); | 311 | cmd.Parameters.Add(":EstateID", EstateID); |
312 | 312 | ||
313 | IDataReader r = cmd.ExecuteReader(); | 313 | IDataReader r = cmd.ExecuteReader(); |
314 | 314 | ||
@@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLiteNG | |||
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.AddWithValue(":EstateID", estateID.ToString()); | 336 | cmd.Parameters.Add(":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.SQLiteNG | |||
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.AddWithValue(":EstateName", search); | 350 | cmd.Parameters.Add(":EstateName", search); |
351 | 351 | ||
352 | IDataReader r = cmd.ExecuteReader(); | 352 | IDataReader r = cmd.ExecuteReader(); |
353 | 353 | ||
@@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLiteNG | |||
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.AddWithValue(":RegionID", regionID.ToString()); | 368 | cmd.Parameters.Add(":RegionID", regionID.ToString()); |
369 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); | 369 | cmd.Parameters.Add(":EstateID", estateID.ToString()); |
370 | 370 | ||
371 | if (cmd.ExecuteNonQuery() == 0) | 371 | if (cmd.ExecuteNonQuery() == 0) |
372 | return false; | 372 | return false; |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs index f0ddc59..606478e 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs | |||
@@ -31,9 +31,9 @@ using System.Collections.Generic; | |||
31 | using System.Data; | 31 | using System.Data; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using Mono.Data.Sqlite; | 34 | using Mono.Data.SqliteClient; |
35 | 35 | ||
36 | namespace OpenSim.Data.SQLiteNG | 36 | namespace OpenSim.Data.SQLiteLegacy |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// A database interface class to a user profile storage system | 39 | /// A database interface class to a user profile storage system |
@@ -55,14 +55,11 @@ namespace OpenSim.Data.SQLiteNG | |||
55 | { | 55 | { |
56 | lock (connection) | 56 | lock (connection) |
57 | { | 57 | { |
58 | /* | ||
59 | SqliteConnection newConnection = | 58 | SqliteConnection newConnection = |
60 | (SqliteConnection)((ICloneable)connection).Clone(); | 59 | (SqliteConnection)((ICloneable)connection).Clone(); |
61 | newConnection.Open(); | 60 | newConnection.Open(); |
62 | 61 | ||
63 | cmd.Connection = newConnection; | 62 | cmd.Connection = newConnection; |
64 | */ | ||
65 | cmd.Connection = connection; | ||
66 | //Console.WriteLine("XXX " + cmd.CommandText); | 63 | //Console.WriteLine("XXX " + cmd.CommandText); |
67 | 64 | ||
68 | return cmd.ExecuteNonQuery(); | 65 | return cmd.ExecuteNonQuery(); |
@@ -73,12 +70,11 @@ namespace OpenSim.Data.SQLiteNG | |||
73 | { | 70 | { |
74 | lock (connection) | 71 | lock (connection) |
75 | { | 72 | { |
76 | //SqliteConnection newConnection = | 73 | SqliteConnection newConnection = |
77 | // (SqliteConnection)((ICloneable)connection).Clone(); | 74 | (SqliteConnection)((ICloneable)connection).Clone(); |
78 | //newConnection.Open(); | 75 | newConnection.Open(); |
79 | 76 | ||
80 | //cmd.Connection = newConnection; | 77 | cmd.Connection = newConnection; |
81 | cmd.Connection = connection; | ||
82 | //Console.WriteLine("XXX " + cmd.CommandText); | 78 | //Console.WriteLine("XXX " + cmd.CommandText); |
83 | 79 | ||
84 | return cmd.ExecuteReader(); | 80 | return cmd.ExecuteReader(); |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs new file mode 100644 index 0000000..d529d4d --- /dev/null +++ b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData | ||
39 | { | ||
40 | public SQLiteFriendsData(string connectionString, string realm) | ||
41 | : base(connectionString, realm, "FriendsStore") | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public FriendsData[] GetFriends(UUID userID) | ||
46 | { | ||
47 | SqliteCommand cmd = new SqliteCommand(); | ||
48 | |||
49 | cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm); | ||
50 | cmd.Parameters.Add(":PrincipalID", userID.ToString()); | ||
51 | |||
52 | return DoQuery(cmd); | ||
53 | |||
54 | } | ||
55 | |||
56 | public bool Delete(UUID principalID, string friend) | ||
57 | { | ||
58 | SqliteCommand cmd = new SqliteCommand(); | ||
59 | |||
60 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); | ||
61 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | ||
62 | cmd.Parameters.Add(":Friend", friend); | ||
63 | |||
64 | ExecuteNonQuery(cmd, cmd.Connection); | ||
65 | |||
66 | return true; | ||
67 | } | ||
68 | |||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs index 632c5bf..1c1fe8c 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs | |||
@@ -30,12 +30,12 @@ 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.Sqlite; | 33 | using Mono.Data.SqliteClient; |
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; |
37 | 37 | ||
38 | namespace OpenSim.Data.SQLiteNG | 38 | namespace OpenSim.Data.SQLiteLegacy |
39 | { | 39 | { |
40 | public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new() | 40 | public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new() |
41 | { | 41 | { |
@@ -59,21 +59,19 @@ namespace OpenSim.Data.SQLiteNG | |||
59 | if (!m_initialized) | 59 | if (!m_initialized) |
60 | { | 60 | { |
61 | m_Connection = new SqliteConnection(connectionString); | 61 | m_Connection = new SqliteConnection(connectionString); |
62 | Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString)); | ||
63 | m_Connection.Open(); | 62 | m_Connection.Open(); |
64 | 63 | ||
65 | if (storeName != String.Empty) | 64 | if (storeName != String.Empty) |
66 | { | 65 | { |
67 | Assembly assem = GetType().Assembly; | 66 | Assembly assem = GetType().Assembly; |
68 | //SqliteConnection newConnection = | 67 | SqliteConnection newConnection = |
69 | // (SqliteConnection)((ICloneable)m_Connection).Clone(); | 68 | (SqliteConnection)((ICloneable)m_Connection).Clone(); |
70 | //newConnection.Open(); | 69 | newConnection.Open(); |
71 | 70 | ||
72 | //Migration m = new Migration(newConnection, assem, storeName); | 71 | Migration m = new Migration(newConnection, assem, storeName); |
73 | Migration m = new Migration(m_Connection, assem, storeName); | ||
74 | m.Update(); | 72 | m.Update(); |
75 | //newConnection.Close(); | 73 | newConnection.Close(); |
76 | //newConnection.Dispose(); | 74 | newConnection.Dispose(); |
77 | } | 75 | } |
78 | 76 | ||
79 | m_initialized = true; | 77 | m_initialized = true; |
@@ -199,7 +197,7 @@ namespace OpenSim.Data.SQLiteNG | |||
199 | result.Add(row); | 197 | result.Add(row); |
200 | } | 198 | } |
201 | 199 | ||
202 | //CloseCommand(cmd); | 200 | CloseCommand(cmd); |
203 | 201 | ||
204 | return result.ToArray(); | 202 | return result.ToArray(); |
205 | } | 203 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs index 9207ca3..726703b 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs | |||
@@ -30,11 +30,11 @@ 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.Sqlite; | 33 | using Mono.Data.SqliteClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | 36 | ||
37 | namespace OpenSim.Data.SQLiteNG | 37 | namespace OpenSim.Data.SQLiteLegacy |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// An Inventory Interface to the SQLite database | 40 | /// An Inventory Interface to the SQLite database |
@@ -98,13 +98,11 @@ namespace OpenSim.Data.SQLiteNG | |||
98 | ds.Tables.Add(createInventoryFoldersTable()); | 98 | ds.Tables.Add(createInventoryFoldersTable()); |
99 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); | 99 | invFoldersDa.Fill(ds.Tables["inventoryfolders"]); |
100 | setupFoldersCommands(invFoldersDa, conn); | 100 | setupFoldersCommands(invFoldersDa, conn); |
101 | CreateDataSetMapping(invFoldersDa, "inventoryfolders"); | ||
102 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); | 101 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); |
103 | 102 | ||
104 | ds.Tables.Add(createInventoryItemsTable()); | 103 | ds.Tables.Add(createInventoryItemsTable()); |
105 | invItemsDa.Fill(ds.Tables["inventoryitems"]); | 104 | invItemsDa.Fill(ds.Tables["inventoryitems"]); |
106 | setupItemsCommands(invItemsDa, conn); | 105 | setupItemsCommands(invItemsDa, conn); |
107 | CreateDataSetMapping(invItemsDa, "inventoryitems"); | ||
108 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); | 106 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); |
109 | 107 | ||
110 | ds.AcceptChanges(); | 108 | ds.AcceptChanges(); |
@@ -730,15 +728,6 @@ namespace OpenSim.Data.SQLiteNG | |||
730 | * | 728 | * |
731 | **********************************************************************/ | 729 | **********************************************************************/ |
732 | 730 | ||
733 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
734 | { | ||
735 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
736 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
737 | { | ||
738 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
739 | } | ||
740 | } | ||
741 | |||
742 | /// <summary> | 731 | /// <summary> |
743 | /// Create the "inventoryitems" table | 732 | /// Create the "inventoryitems" table |
744 | /// </summary> | 733 | /// </summary> |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index 289d626..eb78037 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | |||
@@ -32,13 +32,13 @@ using System.Drawing; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Data.Sqlite; | 35 | using Mono.Data.SqliteClient; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | 40 | ||
41 | namespace OpenSim.Data.SQLiteNG | 41 | namespace OpenSim.Data.SQLiteLegacy |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// A RegionData Interface to the SQLite database | 44 | /// A RegionData Interface to the SQLite database |
@@ -87,142 +87,119 @@ namespace OpenSim.Data.SQLiteNG | |||
87 | /// <param name="connectionString">the connection string</param> | 87 | /// <param name="connectionString">the connection string</param> |
88 | public void Initialise(string connectionString) | 88 | public void Initialise(string connectionString) |
89 | { | 89 | { |
90 | try | 90 | m_connectionString = connectionString; |
91 | { | ||
92 | m_connectionString = connectionString; | ||
93 | 91 | ||
94 | ds = new DataSet("Region"); | 92 | ds = new DataSet(); |
95 | 93 | ||
96 | m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); | 94 | m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); |
97 | m_conn = new SqliteConnection(m_connectionString); | 95 | m_conn = new SqliteConnection(m_connectionString); |
98 | m_conn.Open(); | 96 | m_conn.Open(); |
99 | 97 | ||
100 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | ||
101 | primDa = new SqliteDataAdapter(primSelectCmd); | ||
102 | 98 | ||
103 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | ||
104 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | ||
105 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
106 | 99 | ||
107 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); | 100 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); |
108 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); | 101 | primDa = new SqliteDataAdapter(primSelectCmd); |
102 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
109 | 103 | ||
110 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); | 104 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); |
111 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); | 105 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); |
106 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
112 | 107 | ||
113 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); | 108 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); |
114 | landDa = new SqliteDataAdapter(landSelectCmd); | 109 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); |
115 | 110 | ||
116 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); | 111 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); |
117 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); | 112 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); |
118 | 113 | ||
119 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); | 114 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); |
120 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); | 115 | landDa = new SqliteDataAdapter(landSelectCmd); |
121 | // This actually does the roll forward assembly stuff | ||
122 | Assembly assem = GetType().Assembly; | ||
123 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
124 | m.Update(); | ||
125 | 116 | ||
126 | lock (ds) | 117 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); |
127 | { | 118 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); |
128 | ds.Tables.Add(createPrimTable()); | ||
129 | setupPrimCommands(primDa, m_conn); | ||
130 | 119 | ||
131 | ds.Tables.Add(createShapeTable()); | 120 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); |
132 | setupShapeCommands(shapeDa, m_conn); | 121 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); |
122 | // This actually does the roll forward assembly stuff | ||
123 | Assembly assem = GetType().Assembly; | ||
124 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
125 | m.Update(); | ||
133 | 126 | ||
134 | ds.Tables.Add(createItemsTable()); | 127 | lock (ds) |
135 | setupItemsCommands(itemsDa, m_conn); | 128 | { |
129 | ds.Tables.Add(createPrimTable()); | ||
130 | setupPrimCommands(primDa, m_conn); | ||
131 | primDa.Fill(ds.Tables["prims"]); | ||
136 | 132 | ||
137 | ds.Tables.Add(createTerrainTable()); | 133 | ds.Tables.Add(createShapeTable()); |
138 | setupTerrainCommands(terrainDa, m_conn); | 134 | setupShapeCommands(shapeDa, m_conn); |
139 | 135 | ||
140 | ds.Tables.Add(createLandTable()); | 136 | ds.Tables.Add(createItemsTable()); |
141 | setupLandCommands(landDa, m_conn); | 137 | setupItemsCommands(itemsDa, m_conn); |
138 | itemsDa.Fill(ds.Tables["primitems"]); | ||
142 | 139 | ||
143 | ds.Tables.Add(createLandAccessListTable()); | 140 | ds.Tables.Add(createTerrainTable()); |
144 | setupLandAccessCommands(landAccessListDa, m_conn); | 141 | setupTerrainCommands(terrainDa, m_conn); |
145 | 142 | ||
146 | ds.Tables.Add(createRegionSettingsTable()); | 143 | ds.Tables.Add(createLandTable()); |
147 | setupRegionSettingsCommands(regionSettingsDa, m_conn); | 144 | setupLandCommands(landDa, m_conn); |
148 | 145 | ||
149 | // WORKAROUND: This is a work around for sqlite on | 146 | ds.Tables.Add(createLandAccessListTable()); |
150 | // windows, which gets really unhappy with blob columns | 147 | setupLandAccessCommands(landAccessListDa, m_conn); |
151 | // that have no sample data in them. At some point we | ||
152 | // need to actually find a proper way to handle this. | ||
153 | try | ||
154 | { | ||
155 | primDa.Fill(ds.Tables["prims"]); | ||
156 | } | ||
157 | catch (Exception) | ||
158 | { | ||
159 | m_log.Info("[REGION DB]: Caught fill error on prims table"); | ||
160 | } | ||
161 | 148 | ||
162 | try | 149 | ds.Tables.Add(createRegionSettingsTable()); |
163 | { | 150 | |
164 | shapeDa.Fill(ds.Tables["primshapes"]); | 151 | setupRegionSettingsCommands(regionSettingsDa, m_conn); |
165 | } | ||
166 | catch (Exception) | ||
167 | { | ||
168 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
169 | } | ||
170 | 152 | ||
171 | try | 153 | // WORKAROUND: This is a work around for sqlite on |
172 | { | 154 | // windows, which gets really unhappy with blob columns |
173 | terrainDa.Fill(ds.Tables["terrain"]); | 155 | // that have no sample data in them. At some point we |
174 | } | 156 | // need to actually find a proper way to handle this. |
175 | catch (Exception) | 157 | try |
176 | { | 158 | { |
177 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); | 159 | shapeDa.Fill(ds.Tables["primshapes"]); |
178 | } | 160 | } |
161 | catch (Exception) | ||
162 | { | ||
163 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
164 | } | ||
179 | 165 | ||
180 | try | 166 | try |
181 | { | 167 | { |
182 | landDa.Fill(ds.Tables["land"]); | 168 | terrainDa.Fill(ds.Tables["terrain"]); |
183 | } | 169 | } |
184 | catch (Exception) | 170 | catch (Exception) |
185 | { | 171 | { |
186 | m_log.Info("[REGION DB]: Caught fill error on land table"); | 172 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); |
187 | } | 173 | } |
188 | 174 | ||
189 | try | 175 | try |
190 | { | 176 | { |
191 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); | 177 | landDa.Fill(ds.Tables["land"]); |
192 | } | 178 | } |
193 | catch (Exception) | 179 | catch (Exception) |
194 | { | 180 | { |
195 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); | 181 | m_log.Info("[REGION DB]: Caught fill error on land table"); |
196 | } | 182 | } |
197 | 183 | ||
198 | try | 184 | try |
199 | { | 185 | { |
200 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); | 186 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); |
201 | } | 187 | } |
202 | catch (Exception) | 188 | catch (Exception) |
203 | { | 189 | { |
204 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); | 190 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); |
205 | } | 191 | } |
206 | 192 | ||
207 | // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! | 193 | try |
208 | // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 | 194 | { |
209 | // Possibly because we manually set up our own DataTables before connecting to the database | 195 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); |
210 | CreateDataSetMapping(primDa, "prims"); | ||
211 | CreateDataSetMapping(shapeDa, "primshapes"); | ||
212 | CreateDataSetMapping(itemsDa, "primitems"); | ||
213 | CreateDataSetMapping(terrainDa, "terrain"); | ||
214 | CreateDataSetMapping(landDa, "land"); | ||
215 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); | ||
216 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); | ||
217 | } | 196 | } |
197 | catch (Exception) | ||
198 | { | ||
199 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); | ||
200 | } | ||
201 | return; | ||
218 | } | 202 | } |
219 | catch (Exception e) | ||
220 | { | ||
221 | m_log.Error(e); | ||
222 | Environment.Exit(23); | ||
223 | } | ||
224 | |||
225 | return; | ||
226 | } | 203 | } |
227 | 204 | ||
228 | public void Dispose() | 205 | public void Dispose() |
@@ -626,7 +603,7 @@ namespace OpenSim.Data.SQLiteNG | |||
626 | } | 603 | } |
627 | } | 604 | } |
628 | } | 605 | } |
629 | rev = Convert.ToInt32(row["Revision"]); | 606 | rev = (int) row["Revision"]; |
630 | } | 607 | } |
631 | else | 608 | else |
632 | { | 609 | { |
@@ -778,7 +755,6 @@ namespace OpenSim.Data.SQLiteNG | |||
778 | /// </summary> | 755 | /// </summary> |
779 | public void Commit() | 756 | public void Commit() |
780 | { | 757 | { |
781 | m_log.Debug("[SQLITE]: Starting commit"); | ||
782 | lock (ds) | 758 | lock (ds) |
783 | { | 759 | { |
784 | primDa.Update(ds, "prims"); | 760 | primDa.Update(ds, "prims"); |
@@ -793,11 +769,18 @@ namespace OpenSim.Data.SQLiteNG | |||
793 | { | 769 | { |
794 | regionSettingsDa.Update(ds, "regionsettings"); | 770 | regionSettingsDa.Update(ds, "regionsettings"); |
795 | } | 771 | } |
796 | catch (SqliteException SqlEx) | 772 | catch (SqliteExecutionException SqlEx) |
797 | { | 773 | { |
798 | throw new Exception( | 774 | if (SqlEx.Message.Contains("logic error")) |
799 | "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", | 775 | { |
800 | SqlEx); | 776 | throw new Exception( |
777 | "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", | ||
778 | SqlEx); | ||
779 | } | ||
780 | else | ||
781 | { | ||
782 | throw SqlEx; | ||
783 | } | ||
801 | } | 784 | } |
802 | ds.AcceptChanges(); | 785 | ds.AcceptChanges(); |
803 | } | 786 | } |
@@ -819,15 +802,6 @@ namespace OpenSim.Data.SQLiteNG | |||
819 | * | 802 | * |
820 | **********************************************************************/ | 803 | **********************************************************************/ |
821 | 804 | ||
822 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
823 | { | ||
824 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
825 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
826 | { | ||
827 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
828 | } | ||
829 | } | ||
830 | |||
831 | /// <summary> | 805 | /// <summary> |
832 | /// | 806 | /// |
833 | /// </summary> | 807 | /// </summary> |
@@ -1990,7 +1964,6 @@ namespace OpenSim.Data.SQLiteNG | |||
1990 | sql += ") values (:"; | 1964 | sql += ") values (:"; |
1991 | sql += String.Join(", :", cols); | 1965 | sql += String.Join(", :", cols); |
1992 | sql += ")"; | 1966 | sql += ")"; |
1993 | m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); | ||
1994 | SqliteCommand cmd = new SqliteCommand(sql); | 1967 | SqliteCommand cmd = new SqliteCommand(sql); |
1995 | 1968 | ||
1996 | // this provides the binding for all our parameters, so | 1969 | // this provides the binding for all our parameters, so |
@@ -2286,36 +2259,6 @@ namespace OpenSim.Data.SQLiteNG | |||
2286 | return DbType.String; | 2259 | return DbType.String; |
2287 | } | 2260 | } |
2288 | } | 2261 | } |
2289 | |||
2290 | static void PrintDataSet(DataSet ds) | ||
2291 | { | ||
2292 | // Print out any name and extended properties. | ||
2293 | Console.WriteLine("DataSet is named: {0}", ds.DataSetName); | ||
2294 | foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) | ||
2295 | { | ||
2296 | Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); | ||
2297 | } | ||
2298 | Console.WriteLine(); | ||
2299 | foreach (DataTable dt in ds.Tables) | ||
2300 | { | ||
2301 | Console.WriteLine("=> {0} Table:", dt.TableName); | ||
2302 | // Print out the column names. | ||
2303 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2304 | { | ||
2305 | Console.Write(dt.Columns[curCol].ColumnName + "\t"); | ||
2306 | } | ||
2307 | Console.WriteLine("\n----------------------------------"); | ||
2308 | // Print the DataTable. | ||
2309 | for (int curRow = 0; curRow < dt.Rows.Count; curRow++) | ||
2310 | { | ||
2311 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2312 | { | ||
2313 | Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); | ||
2314 | } | ||
2315 | Console.WriteLine(); | ||
2316 | } | ||
2317 | } | ||
2318 | } | ||
2319 | 2262 | ||
2320 | } | 2263 | } |
2321 | } | 2264 | } |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs new file mode 100644 index 0000000..27553c6 --- /dev/null +++ b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Data; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | |||
36 | namespace OpenSim.Data.SQLiteLegacy | ||
37 | { | ||
38 | public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData | ||
39 | { | ||
40 | public SQLiteUserAccountData(string connectionString, string realm) | ||
41 | : base(connectionString, realm, "UserAccount") | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public UserAccountData[] GetUsers(UUID scopeID, string query) | ||
46 | { | ||
47 | string[] words = query.Split(new char[] {' '}); | ||
48 | |||
49 | for (int i = 0 ; i < words.Length ; i++) | ||
50 | { | ||
51 | if (words[i].Length < 3) | ||
52 | { | ||
53 | if (i != words.Length - 1) | ||
54 | Array.Copy(words, i + 1, words, i, words.Length - i - 1); | ||
55 | Array.Resize(ref words, words.Length - 1); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (words.Length == 0) | ||
60 | return new UserAccountData[0]; | ||
61 | |||
62 | if (words.Length > 2) | ||
63 | return new UserAccountData[0]; | ||
64 | |||
65 | SqliteCommand cmd = new SqliteCommand(); | ||
66 | |||
67 | if (words.Length == 1) | ||
68 | { | ||
69 | cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')", | ||
70 | m_Realm, scopeID.ToString(), words[0]); | ||
71 | } | ||
72 | else | ||
73 | { | ||
74 | cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')", | ||
75 | m_Realm, scopeID.ToString(), words[0], words[1]); | ||
76 | } | ||
77 | |||
78 | return DoQuery(cmd); | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs index 82a2e37..095a262 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs | |||
@@ -27,9 +27,9 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Data; | 29 | using System.Data; |
30 | using Mono.Data.Sqlite; | 30 | using Mono.Data.SqliteClient; |
31 | 31 | ||
32 | namespace OpenSim.Data.SQLiteNG | 32 | namespace OpenSim.Data.SQLiteLegacy |
33 | { | 33 | { |
34 | /// <summary> | 34 | /// <summary> |
35 | /// A base class for methods needed by all SQLite database classes | 35 | /// A base class for methods needed by all SQLite database classes |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs index a0c17f8..5422cbf 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs | |||
@@ -29,12 +29,12 @@ using System; | |||
29 | using System.Data; | 29 | using System.Data; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using Mono.Data.Sqlite; | 32 | using Mono.Data.SqliteClient; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | 36 | ||
37 | namespace OpenSim.Data.SQLiteNG | 37 | namespace OpenSim.Data.SQLiteLegacy |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// A MySQL Interface for the Asset Server | 40 | /// A MySQL Interface for the Asset Server |
@@ -147,7 +147,7 @@ namespace OpenSim.Data.SQLiteNG | |||
147 | } | 147 | } |
148 | 148 | ||
149 | reader.Close(); | 149 | reader.Close(); |
150 | //CloseCommand(cmd); | 150 | CloseCommand(cmd); |
151 | 151 | ||
152 | return perms; | 152 | return perms; |
153 | } | 153 | } |
diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs index d211ab3..5393529 100644 --- a/OpenSim/Data/Tests/DataTestUtil.cs +++ b/OpenSim/Data/Tests/DataTestUtil.cs | |||
@@ -39,7 +39,8 @@ namespace OpenSim.Data.Tests | |||
39 | public class DataTestUtil | 39 | public class DataTestUtil |
40 | { | 40 | { |
41 | public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; | 41 | public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; |
42 | public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue; | 42 | //public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue; |
43 | public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX; | ||
43 | 44 | ||
44 | public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue | 45 | public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue |
45 | public const int INTEGER_MAX = int.MaxValue; | 46 | public const int INTEGER_MAX = int.MaxValue; |