diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteAssetData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs | 23 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteEstateData.cs | 48 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteFramework.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteRegionData.cs | 258 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteUtils.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/Tests/SQLiteAssetTest.cs | 64 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/Tests/SQLiteEstateTest.cs | 65 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/Tests/SQLiteInventoryTest.cs | 66 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteNG/Tests/SQLiteRegionTest.cs | 64 |
16 files changed, 236 insertions, 429 deletions
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs b/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs index a032670..636bf86 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLiteNG/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 | ||
@@ -137,7 +137,7 @@ namespace OpenSim.Data.SQLite | |||
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.SQLite | |||
340 | 340 | ||
341 | #endregion | 341 | #endregion |
342 | } | 342 | } |
343 | } \ No newline at end of file | 343 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs index aa10734..086ac0a 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLiteNG/SQLiteAuthenticationData.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 | { |
@@ -56,13 +56,8 @@ namespace OpenSim.Data.SQLite | |||
56 | m_Connection = new SqliteConnection(connectionString); | 56 | m_Connection = new SqliteConnection(connectionString); |
57 | m_Connection.Open(); | 57 | m_Connection.Open(); |
58 | 58 | ||
59 | using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone()) | 59 | Migration m = new Migration(m_Connection, GetType().Assembly, "AuthStore"); |
60 | { | 60 | m.Update(); |
61 | dbcon.Open(); | ||
62 | Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); | ||
63 | m.Update(); | ||
64 | dbcon.Close(); | ||
65 | } | ||
66 | 61 | ||
67 | m_initialized = true; | 62 | m_initialized = true; |
68 | } | 63 | } |
@@ -113,7 +108,7 @@ namespace OpenSim.Data.SQLite | |||
113 | } | 108 | } |
114 | finally | 109 | finally |
115 | { | 110 | { |
116 | CloseCommand(cmd); | 111 | //CloseCommand(cmd); |
117 | } | 112 | } |
118 | 113 | ||
119 | return null; | 114 | return null; |
@@ -156,14 +151,14 @@ namespace OpenSim.Data.SQLite | |||
156 | { | 151 | { |
157 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | 152 | if (ExecuteNonQuery(cmd, m_Connection) < 1) |
158 | { | 153 | { |
159 | CloseCommand(cmd); | 154 | //CloseCommand(cmd); |
160 | return false; | 155 | return false; |
161 | } | 156 | } |
162 | } | 157 | } |
163 | catch (Exception e) | 158 | catch (Exception e) |
164 | { | 159 | { |
165 | Console.WriteLine(e.ToString()); | 160 | Console.WriteLine(e.ToString()); |
166 | CloseCommand(cmd); | 161 | //CloseCommand(cmd); |
167 | return false; | 162 | return false; |
168 | } | 163 | } |
169 | } | 164 | } |
@@ -184,19 +179,19 @@ namespace OpenSim.Data.SQLite | |||
184 | { | 179 | { |
185 | if (ExecuteNonQuery(cmd, m_Connection) < 1) | 180 | if (ExecuteNonQuery(cmd, m_Connection) < 1) |
186 | { | 181 | { |
187 | CloseCommand(cmd); | 182 | //CloseCommand(cmd); |
188 | return false; | 183 | return false; |
189 | } | 184 | } |
190 | } | 185 | } |
191 | catch (Exception e) | 186 | catch (Exception e) |
192 | { | 187 | { |
193 | Console.WriteLine(e.ToString()); | 188 | Console.WriteLine(e.ToString()); |
194 | CloseCommand(cmd); | 189 | //CloseCommand(cmd); |
195 | return false; | 190 | return false; |
196 | } | 191 | } |
197 | } | 192 | } |
198 | 193 | ||
199 | CloseCommand(cmd); | 194 | //CloseCommand(cmd); |
200 | 195 | ||
201 | return true; | 196 | return true; |
202 | } | 197 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs b/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs index b3f4a4c..c093884 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs +++ b/OpenSim/Data/SQLiteNG/SQLiteAvatarData.cs | |||
@@ -33,7 +33,7 @@ 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.SqliteClient; | 36 | using Mono.Data.Sqlite; |
37 | 37 | ||
38 | namespace OpenSim.Data.SQLite | 38 | namespace OpenSim.Data.SQLite |
39 | { | 39 | { |
@@ -55,8 +55,8 @@ namespace OpenSim.Data.SQLite | |||
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.Add(":PrincipalID", principalID.ToString()); | 58 | cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); |
59 | cmd.Parameters.Add(":Name", name); | 59 | cmd.Parameters.AddWithValue(":Name", name); |
60 | 60 | ||
61 | try | 61 | try |
62 | { | 62 | { |
@@ -67,7 +67,7 @@ namespace OpenSim.Data.SQLite | |||
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/SQLiteNG/SQLiteEstateData.cs index bd6b776..9dd4a2e 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteNG/SQLiteEstateData.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Data; | 30 | using System.Data; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Data.SqliteClient; | 33 | using Mono.Data.Sqlite; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite | |||
62 | Migration m = new Migration(m_connection, assem, "EstateStore"); | 62 | Migration m = new Migration(m_connection, assem, "EstateStore"); |
63 | m.Update(); | 63 | m.Update(); |
64 | 64 | ||
65 | m_connection.Close(); | 65 | //m_connection.Close(); |
66 | m_connection.Open(); | 66 | // m_connection.Open(); |
67 | 67 | ||
68 | Type t = typeof(EstateSettings); | 68 | Type t = typeof(EstateSettings); |
69 | m_Fields = t.GetFields(BindingFlags.NonPublic | | 69 | m_Fields = t.GetFields(BindingFlags.NonPublic | |
@@ -87,7 +87,7 @@ namespace OpenSim.Data.SQLite | |||
87 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 87 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
88 | 88 | ||
89 | cmd.CommandText = sql; | 89 | cmd.CommandText = sql; |
90 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 90 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
91 | 91 | ||
92 | return DoLoad(cmd, regionID, create); | 92 | return DoLoad(cmd, regionID, create); |
93 | } | 93 | } |
@@ -143,13 +143,13 @@ namespace OpenSim.Data.SQLite | |||
143 | if (m_FieldMap[name].GetValue(es) is bool) | 143 | if (m_FieldMap[name].GetValue(es) is bool) |
144 | { | 144 | { |
145 | if ((bool)m_FieldMap[name].GetValue(es)) | 145 | if ((bool)m_FieldMap[name].GetValue(es)) |
146 | cmd.Parameters.Add(":"+name, "1"); | 146 | cmd.Parameters.AddWithValue(":"+name, "1"); |
147 | else | 147 | else |
148 | cmd.Parameters.Add(":"+name, "0"); | 148 | cmd.Parameters.AddWithValue(":"+name, "0"); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 152 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -167,8 +167,8 @@ namespace OpenSim.Data.SQLite | |||
167 | r.Close(); | 167 | r.Close(); |
168 | 168 | ||
169 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | 169 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; |
170 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 170 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
171 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 171 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
172 | 172 | ||
173 | // This will throw on dupe key | 173 | // This will throw on dupe key |
174 | try | 174 | try |
@@ -211,13 +211,13 @@ namespace OpenSim.Data.SQLite | |||
211 | if (m_FieldMap[name].GetValue(es) is bool) | 211 | if (m_FieldMap[name].GetValue(es) is bool) |
212 | { | 212 | { |
213 | if ((bool)m_FieldMap[name].GetValue(es)) | 213 | if ((bool)m_FieldMap[name].GetValue(es)) |
214 | cmd.Parameters.Add(":"+name, "1"); | 214 | cmd.Parameters.AddWithValue(":"+name, "1"); |
215 | else | 215 | else |
216 | cmd.Parameters.Add(":"+name, "0"); | 216 | cmd.Parameters.AddWithValue(":"+name, "0"); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | { | 219 | { |
220 | cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString()); | 220 | cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString()); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
@@ -236,7 +236,7 @@ namespace OpenSim.Data.SQLite | |||
236 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 236 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
237 | 237 | ||
238 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; | 238 | cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID"; |
239 | cmd.Parameters.Add(":EstateID", es.EstateID); | 239 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID); |
240 | 240 | ||
241 | IDataReader r = cmd.ExecuteReader(); | 241 | IDataReader r = cmd.ExecuteReader(); |
242 | 242 | ||
@@ -260,7 +260,7 @@ namespace OpenSim.Data.SQLite | |||
260 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 260 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
261 | 261 | ||
262 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; | 262 | cmd.CommandText = "delete from estateban where EstateID = :EstateID"; |
263 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 263 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
264 | 264 | ||
265 | cmd.ExecuteNonQuery(); | 265 | cmd.ExecuteNonQuery(); |
266 | 266 | ||
@@ -270,8 +270,8 @@ namespace OpenSim.Data.SQLite | |||
270 | 270 | ||
271 | foreach (EstateBan b in es.EstateBans) | 271 | foreach (EstateBan b in es.EstateBans) |
272 | { | 272 | { |
273 | cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); | 273 | cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString()); |
274 | cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString()); | 274 | cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString()); |
275 | 275 | ||
276 | cmd.ExecuteNonQuery(); | 276 | cmd.ExecuteNonQuery(); |
277 | cmd.Parameters.Clear(); | 277 | cmd.Parameters.Clear(); |
@@ -283,7 +283,7 @@ namespace OpenSim.Data.SQLite | |||
283 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 283 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
284 | 284 | ||
285 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; | 285 | cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; |
286 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 286 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
287 | 287 | ||
288 | cmd.ExecuteNonQuery(); | 288 | cmd.ExecuteNonQuery(); |
289 | 289 | ||
@@ -293,8 +293,8 @@ namespace OpenSim.Data.SQLite | |||
293 | 293 | ||
294 | foreach (UUID uuid in data) | 294 | foreach (UUID uuid in data) |
295 | { | 295 | { |
296 | cmd.Parameters.Add(":EstateID", EstateID.ToString()); | 296 | cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString()); |
297 | cmd.Parameters.Add(":uuid", uuid.ToString()); | 297 | cmd.Parameters.AddWithValue(":uuid", uuid.ToString()); |
298 | 298 | ||
299 | cmd.ExecuteNonQuery(); | 299 | cmd.ExecuteNonQuery(); |
300 | cmd.Parameters.Clear(); | 300 | cmd.Parameters.Clear(); |
@@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite | |||
308 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 308 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
309 | 309 | ||
310 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; | 310 | cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID"; |
311 | cmd.Parameters.Add(":EstateID", EstateID); | 311 | cmd.Parameters.AddWithValue(":EstateID", EstateID); |
312 | 312 | ||
313 | IDataReader r = cmd.ExecuteReader(); | 313 | IDataReader r = cmd.ExecuteReader(); |
314 | 314 | ||
@@ -333,7 +333,7 @@ namespace OpenSim.Data.SQLite | |||
333 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 333 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
334 | 334 | ||
335 | cmd.CommandText = sql; | 335 | cmd.CommandText = sql; |
336 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | 336 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); |
337 | 337 | ||
338 | return DoLoad(cmd, UUID.Zero, false); | 338 | return DoLoad(cmd, UUID.Zero, false); |
339 | } | 339 | } |
@@ -347,7 +347,7 @@ namespace OpenSim.Data.SQLite | |||
347 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 347 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
348 | 348 | ||
349 | cmd.CommandText = sql; | 349 | cmd.CommandText = sql; |
350 | cmd.Parameters.Add(":EstateName", search); | 350 | cmd.Parameters.AddWithValue(":EstateName", search); |
351 | 351 | ||
352 | IDataReader r = cmd.ExecuteReader(); | 352 | IDataReader r = cmd.ExecuteReader(); |
353 | 353 | ||
@@ -365,8 +365,8 @@ namespace OpenSim.Data.SQLite | |||
365 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); | 365 | SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); |
366 | 366 | ||
367 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; | 367 | cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)"; |
368 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 368 | cmd.Parameters.AddWithValue(":RegionID", regionID.ToString()); |
369 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | 369 | cmd.Parameters.AddWithValue(":EstateID", estateID.ToString()); |
370 | 370 | ||
371 | if (cmd.ExecuteNonQuery() == 0) | 371 | if (cmd.ExecuteNonQuery() == 0) |
372 | return false; | 372 | return false; |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs b/OpenSim/Data/SQLiteNG/SQLiteFramework.cs index 20b5085..cf114d1 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteFramework.cs +++ b/OpenSim/Data/SQLiteNG/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 | { |
@@ -55,11 +55,14 @@ namespace OpenSim.Data.SQLite | |||
55 | { | 55 | { |
56 | lock (connection) | 56 | lock (connection) |
57 | { | 57 | { |
58 | /* | ||
58 | SqliteConnection newConnection = | 59 | SqliteConnection newConnection = |
59 | (SqliteConnection)((ICloneable)connection).Clone(); | 60 | (SqliteConnection)((ICloneable)connection).Clone(); |
60 | newConnection.Open(); | 61 | newConnection.Open(); |
61 | 62 | ||
62 | cmd.Connection = newConnection; | 63 | cmd.Connection = newConnection; |
64 | */ | ||
65 | cmd.Connection = connection; | ||
63 | //Console.WriteLine("XXX " + cmd.CommandText); | 66 | //Console.WriteLine("XXX " + cmd.CommandText); |
64 | 67 | ||
65 | return cmd.ExecuteNonQuery(); | 68 | return cmd.ExecuteNonQuery(); |
@@ -70,11 +73,12 @@ namespace OpenSim.Data.SQLite | |||
70 | { | 73 | { |
71 | lock (connection) | 74 | lock (connection) |
72 | { | 75 | { |
73 | SqliteConnection newConnection = | 76 | //SqliteConnection newConnection = |
74 | (SqliteConnection)((ICloneable)connection).Clone(); | 77 | // (SqliteConnection)((ICloneable)connection).Clone(); |
75 | newConnection.Open(); | 78 | //newConnection.Open(); |
76 | 79 | ||
77 | cmd.Connection = newConnection; | 80 | //cmd.Connection = newConnection; |
81 | cmd.Connection = connection; | ||
78 | //Console.WriteLine("XXX " + cmd.CommandText); | 82 | //Console.WriteLine("XXX " + cmd.CommandText); |
79 | 83 | ||
80 | return cmd.ExecuteReader(); | 84 | return cmd.ExecuteReader(); |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs b/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs index 0b12182..b06853c 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteFriendsData.cs +++ b/OpenSim/Data/SQLiteNG/SQLiteFriendsData.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 | { |
@@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite | |||
47 | SqliteCommand cmd = new SqliteCommand(); | 47 | SqliteCommand cmd = new SqliteCommand(); |
48 | 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); | 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()); | 50 | cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString()); |
51 | 51 | ||
52 | return DoQuery(cmd); | 52 | return DoQuery(cmd); |
53 | 53 | ||
@@ -58,8 +58,8 @@ namespace OpenSim.Data.SQLite | |||
58 | SqliteCommand cmd = new SqliteCommand(); | 58 | SqliteCommand cmd = new SqliteCommand(); |
59 | 59 | ||
60 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); | 60 | cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm); |
61 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | 61 | cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); |
62 | cmd.Parameters.Add(":Friend", friend); | 62 | cmd.Parameters.AddWithValue(":Friend", friend); |
63 | 63 | ||
64 | ExecuteNonQuery(cmd, cmd.Connection); | 64 | ExecuteNonQuery(cmd, cmd.Connection); |
65 | 65 | ||
diff --git a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs index b39bb19..3c70aef 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLiteNG/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; |
@@ -59,19 +59,21 @@ namespace OpenSim.Data.SQLite | |||
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)); | ||
62 | m_Connection.Open(); | 63 | m_Connection.Open(); |
63 | 64 | ||
64 | if (storeName != String.Empty) | 65 | if (storeName != String.Empty) |
65 | { | 66 | { |
66 | Assembly assem = GetType().Assembly; | 67 | Assembly assem = GetType().Assembly; |
67 | SqliteConnection newConnection = | 68 | //SqliteConnection newConnection = |
68 | (SqliteConnection)((ICloneable)m_Connection).Clone(); | 69 | // (SqliteConnection)((ICloneable)m_Connection).Clone(); |
69 | newConnection.Open(); | 70 | //newConnection.Open(); |
70 | 71 | ||
71 | Migration m = new Migration(newConnection, assem, storeName); | 72 | //Migration m = new Migration(newConnection, assem, storeName); |
73 | Migration m = new Migration(m_Connection, assem, storeName); | ||
72 | m.Update(); | 74 | m.Update(); |
73 | newConnection.Close(); | 75 | //newConnection.Close(); |
74 | newConnection.Dispose(); | 76 | //newConnection.Dispose(); |
75 | } | 77 | } |
76 | 78 | ||
77 | m_initialized = true; | 79 | m_initialized = true; |
@@ -197,7 +199,7 @@ namespace OpenSim.Data.SQLite | |||
197 | result.Add(row); | 199 | result.Add(row); |
198 | } | 200 | } |
199 | 201 | ||
200 | CloseCommand(cmd); | 202 | //CloseCommand(cmd); |
201 | 203 | ||
202 | return result.ToArray(); | 204 | return result.ToArray(); |
203 | } | 205 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs b/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs index a5e0517..ece2495 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLiteNG/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 | ||
@@ -98,11 +98,13 @@ namespace OpenSim.Data.SQLite | |||
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"); | ||
101 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); | 102 | m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions"); |
102 | 103 | ||
103 | ds.Tables.Add(createInventoryItemsTable()); | 104 | ds.Tables.Add(createInventoryItemsTable()); |
104 | invItemsDa.Fill(ds.Tables["inventoryitems"]); | 105 | invItemsDa.Fill(ds.Tables["inventoryitems"]); |
105 | setupItemsCommands(invItemsDa, conn); | 106 | setupItemsCommands(invItemsDa, conn); |
107 | CreateDataSetMapping(invItemsDa, "inventoryitems"); | ||
106 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); | 108 | m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions"); |
107 | 109 | ||
108 | ds.AcceptChanges(); | 110 | ds.AcceptChanges(); |
@@ -728,6 +730,15 @@ namespace OpenSim.Data.SQLite | |||
728 | * | 730 | * |
729 | **********************************************************************/ | 731 | **********************************************************************/ |
730 | 732 | ||
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 | |||
731 | /// <summary> | 742 | /// <summary> |
732 | /// Create the "inventoryitems" table | 743 | /// Create the "inventoryitems" table |
733 | /// </summary> | 744 | /// </summary> |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs b/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs index d2ba9ae..bad8adc 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteNG/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,139 @@ 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 | //SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | ||
102 | //primDa = new SqliteDataAdapter(primSelectCmd); | ||
103 | primDa = new SqliteDataAdapter(primSelect, m_connectionString); | ||
104 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
98 | 105 | ||
106 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | ||
107 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | ||
108 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
99 | 109 | ||
100 | SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); | 110 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); |
101 | primDa = new SqliteDataAdapter(primSelectCmd); | 111 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); |
102 | // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); | ||
103 | 112 | ||
104 | SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); | 113 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); |
105 | shapeDa = new SqliteDataAdapter(shapeSelectCmd); | 114 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); |
106 | // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); | ||
107 | 115 | ||
108 | SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); | 116 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); |
109 | itemsDa = new SqliteDataAdapter(itemsSelectCmd); | 117 | landDa = new SqliteDataAdapter(landSelectCmd); |
110 | 118 | ||
111 | SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); | 119 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); |
112 | terrainDa = new SqliteDataAdapter(terrainSelectCmd); | 120 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); |
113 | 121 | ||
114 | SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); | 122 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); |
115 | landDa = new SqliteDataAdapter(landSelectCmd); | 123 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); |
124 | // This actually does the roll forward assembly stuff | ||
125 | Assembly assem = GetType().Assembly; | ||
126 | Migration m = new Migration(m_conn, assem, "RegionStore"); | ||
127 | m.Update(); | ||
116 | 128 | ||
117 | SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); | 129 | lock (ds) |
118 | landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); | 130 | { |
131 | //ds.Tables.Add(createPrimTable()); | ||
132 | //setupPrimCommands(primDa, m_conn); | ||
133 | //primDa.Fill(ds.Tables["prims"]); | ||
134 | primDa.Fill(ds, "prims"); | ||
119 | 135 | ||
120 | SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); | 136 | ds.Tables.Add(createShapeTable()); |
121 | regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); | 137 | 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 | 138 | ||
127 | lock (ds) | 139 | ds.Tables.Add(createItemsTable()); |
128 | { | 140 | setupItemsCommands(itemsDa, m_conn); |
129 | ds.Tables.Add(createPrimTable()); | 141 | itemsDa.Fill(ds.Tables["primitems"]); |
130 | setupPrimCommands(primDa, m_conn); | ||
131 | primDa.Fill(ds.Tables["prims"]); | ||
132 | 142 | ||
133 | ds.Tables.Add(createShapeTable()); | 143 | ds.Tables.Add(createTerrainTable()); |
134 | setupShapeCommands(shapeDa, m_conn); | 144 | setupTerrainCommands(terrainDa, m_conn); |
135 | 145 | ||
136 | ds.Tables.Add(createItemsTable()); | 146 | ds.Tables.Add(createLandTable()); |
137 | setupItemsCommands(itemsDa, m_conn); | 147 | setupLandCommands(landDa, m_conn); |
138 | itemsDa.Fill(ds.Tables["primitems"]); | ||
139 | 148 | ||
140 | ds.Tables.Add(createTerrainTable()); | 149 | ds.Tables.Add(createLandAccessListTable()); |
141 | setupTerrainCommands(terrainDa, m_conn); | 150 | setupLandAccessCommands(landAccessListDa, m_conn); |
142 | 151 | ||
143 | ds.Tables.Add(createLandTable()); | 152 | ds.Tables.Add(createRegionSettingsTable()); |
144 | setupLandCommands(landDa, m_conn); | 153 | |
154 | setupRegionSettingsCommands(regionSettingsDa, m_conn); | ||
145 | 155 | ||
146 | ds.Tables.Add(createLandAccessListTable()); | 156 | // WORKAROUND: This is a work around for sqlite on |
147 | setupLandAccessCommands(landAccessListDa, m_conn); | 157 | // windows, which gets really unhappy with blob columns |
148 | 158 | // that have no sample data in them. At some point we | |
149 | ds.Tables.Add(createRegionSettingsTable()); | 159 | // need to actually find a proper way to handle this. |
150 | 160 | try | |
151 | setupRegionSettingsCommands(regionSettingsDa, m_conn); | 161 | { |
162 | shapeDa.Fill(ds.Tables["primshapes"]); | ||
163 | } | ||
164 | catch (Exception) | ||
165 | { | ||
166 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
167 | } | ||
152 | 168 | ||
153 | // WORKAROUND: This is a work around for sqlite on | 169 | try |
154 | // windows, which gets really unhappy with blob columns | 170 | { |
155 | // that have no sample data in them. At some point we | 171 | terrainDa.Fill(ds.Tables["terrain"]); |
156 | // need to actually find a proper way to handle this. | 172 | } |
157 | try | 173 | catch (Exception) |
158 | { | 174 | { |
159 | shapeDa.Fill(ds.Tables["primshapes"]); | 175 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); |
160 | } | 176 | } |
161 | catch (Exception) | ||
162 | { | ||
163 | m_log.Info("[REGION DB]: Caught fill error on primshapes table"); | ||
164 | } | ||
165 | 177 | ||
166 | try | 178 | try |
167 | { | 179 | { |
168 | terrainDa.Fill(ds.Tables["terrain"]); | 180 | landDa.Fill(ds.Tables["land"]); |
169 | } | 181 | } |
170 | catch (Exception) | 182 | catch (Exception) |
171 | { | 183 | { |
172 | m_log.Info("[REGION DB]: Caught fill error on terrain table"); | 184 | m_log.Info("[REGION DB]: Caught fill error on land table"); |
173 | } | 185 | } |
174 | 186 | ||
175 | try | 187 | try |
176 | { | 188 | { |
177 | landDa.Fill(ds.Tables["land"]); | 189 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); |
178 | } | 190 | } |
179 | catch (Exception) | 191 | catch (Exception) |
180 | { | 192 | { |
181 | m_log.Info("[REGION DB]: Caught fill error on land table"); | 193 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); |
182 | } | 194 | } |
183 | 195 | ||
184 | try | 196 | try |
185 | { | 197 | { |
186 | landAccessListDa.Fill(ds.Tables["landaccesslist"]); | 198 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); |
187 | } | 199 | } |
188 | catch (Exception) | 200 | catch (Exception) |
189 | { | 201 | { |
190 | m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); | 202 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); |
191 | } | 203 | } |
192 | 204 | ||
193 | try | 205 | // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! |
194 | { | 206 | // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 |
195 | regionSettingsDa.Fill(ds.Tables["regionsettings"]); | 207 | CreateDataSetMapping(primDa, "prims"); |
208 | CreateDataSetMapping(shapeDa, "primshapes"); | ||
209 | CreateDataSetMapping(itemsDa, "primitems"); | ||
210 | CreateDataSetMapping(terrainDa, "terrain"); | ||
211 | CreateDataSetMapping(landDa, "land"); | ||
212 | CreateDataSetMapping(landAccessListDa, "landaccesslist"); | ||
213 | CreateDataSetMapping(regionSettingsDa, "regionsettings"); | ||
196 | } | 214 | } |
197 | catch (Exception) | ||
198 | { | ||
199 | m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); | ||
200 | } | ||
201 | return; | ||
202 | } | 215 | } |
216 | catch (Exception e) | ||
217 | { | ||
218 | m_log.Error(e); | ||
219 | Environment.Exit(23); | ||
220 | } | ||
221 | |||
222 | return; | ||
203 | } | 223 | } |
204 | 224 | ||
205 | public void Dispose() | 225 | public void Dispose() |
@@ -603,7 +623,7 @@ namespace OpenSim.Data.SQLite | |||
603 | } | 623 | } |
604 | } | 624 | } |
605 | } | 625 | } |
606 | rev = (int) row["Revision"]; | 626 | rev = Convert.ToInt32(row["Revision"]); |
607 | } | 627 | } |
608 | else | 628 | else |
609 | { | 629 | { |
@@ -755,6 +775,7 @@ namespace OpenSim.Data.SQLite | |||
755 | /// </summary> | 775 | /// </summary> |
756 | public void Commit() | 776 | public void Commit() |
757 | { | 777 | { |
778 | m_log.Debug("[SQLITE]: Starting commit"); | ||
758 | lock (ds) | 779 | lock (ds) |
759 | { | 780 | { |
760 | primDa.Update(ds, "prims"); | 781 | primDa.Update(ds, "prims"); |
@@ -769,18 +790,11 @@ namespace OpenSim.Data.SQLite | |||
769 | { | 790 | { |
770 | regionSettingsDa.Update(ds, "regionsettings"); | 791 | regionSettingsDa.Update(ds, "regionsettings"); |
771 | } | 792 | } |
772 | catch (SqliteExecutionException SqlEx) | 793 | catch (SqliteException SqlEx) |
773 | { | 794 | { |
774 | if (SqlEx.Message.Contains("logic error")) | 795 | throw new Exception( |
775 | { | 796 | "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!", |
776 | throw new Exception( | 797 | SqlEx); |
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 | } | ||
784 | } | 798 | } |
785 | ds.AcceptChanges(); | 799 | ds.AcceptChanges(); |
786 | } | 800 | } |
@@ -802,6 +816,15 @@ namespace OpenSim.Data.SQLite | |||
802 | * | 816 | * |
803 | **********************************************************************/ | 817 | **********************************************************************/ |
804 | 818 | ||
819 | protected void CreateDataSetMapping(IDataAdapter da, string tableName) | ||
820 | { | ||
821 | ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); | ||
822 | foreach (DataColumn col in ds.Tables[tableName].Columns) | ||
823 | { | ||
824 | dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); | ||
825 | } | ||
826 | } | ||
827 | |||
805 | /// <summary> | 828 | /// <summary> |
806 | /// | 829 | /// |
807 | /// </summary> | 830 | /// </summary> |
@@ -1964,6 +1987,7 @@ namespace OpenSim.Data.SQLite | |||
1964 | sql += ") values (:"; | 1987 | sql += ") values (:"; |
1965 | sql += String.Join(", :", cols); | 1988 | sql += String.Join(", :", cols); |
1966 | sql += ")"; | 1989 | sql += ")"; |
1990 | m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); | ||
1967 | SqliteCommand cmd = new SqliteCommand(sql); | 1991 | SqliteCommand cmd = new SqliteCommand(sql); |
1968 | 1992 | ||
1969 | // this provides the binding for all our parameters, so | 1993 | // this provides the binding for all our parameters, so |
@@ -2259,6 +2283,36 @@ namespace OpenSim.Data.SQLite | |||
2259 | return DbType.String; | 2283 | return DbType.String; |
2260 | } | 2284 | } |
2261 | } | 2285 | } |
2286 | |||
2287 | static void PrintDataSet(DataSet ds) | ||
2288 | { | ||
2289 | // Print out any name and extended properties. | ||
2290 | Console.WriteLine("DataSet is named: {0}", ds.DataSetName); | ||
2291 | foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) | ||
2292 | { | ||
2293 | Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); | ||
2294 | } | ||
2295 | Console.WriteLine(); | ||
2296 | foreach (DataTable dt in ds.Tables) | ||
2297 | { | ||
2298 | Console.WriteLine("=> {0} Table:", dt.TableName); | ||
2299 | // Print out the column names. | ||
2300 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2301 | { | ||
2302 | Console.Write(dt.Columns[curCol].ColumnName + "\t"); | ||
2303 | } | ||
2304 | Console.WriteLine("\n----------------------------------"); | ||
2305 | // Print the DataTable. | ||
2306 | for (int curRow = 0; curRow < dt.Rows.Count; curRow++) | ||
2307 | { | ||
2308 | for (int curCol = 0; curCol < dt.Columns.Count; curCol++) | ||
2309 | { | ||
2310 | Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); | ||
2311 | } | ||
2312 | Console.WriteLine(); | ||
2313 | } | ||
2314 | } | ||
2315 | } | ||
2262 | 2316 | ||
2263 | } | 2317 | } |
2264 | } | 2318 | } |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs index 67cf716..893f105 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.cs +++ b/OpenSim/Data/SQLiteNG/SQLiteUserAccountData.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 | { |
@@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite | |||
66 | 66 | ||
67 | if (words.Length == 1) | 67 | if (words.Length == 1) |
68 | { | 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}%')", | 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]); | 70 | m_Realm, scopeID.ToString(), words[0]); |
71 | } | 71 | } |
72 | else | 72 | else |
diff --git a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs b/OpenSim/Data/SQLiteNG/SQLiteUtils.cs index 4a835ce..07c6b69 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteUtils.cs +++ b/OpenSim/Data/SQLiteNG/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/SQLiteNG/SQLiteXInventoryData.cs b/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs index a66e0c6..be1d041 100644 --- a/OpenSim/Data/SQLiteNG/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLiteNG/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,7 @@ namespace OpenSim.Data.SQLite | |||
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/SQLiteNG/Tests/SQLiteAssetTest.cs b/OpenSim/Data/SQLiteNG/Tests/SQLiteAssetTest.cs deleted file mode 100644 index 0c2f5df..0000000 --- a/OpenSim/Data/SQLiteNG/Tests/SQLiteAssetTest.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
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.IO; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Data.Tests; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Data.SQLite.Tests | ||
34 | { | ||
35 | [TestFixture, DatabaseTest] | ||
36 | public class SQLiteAssetTest : BasicAssetTest | ||
37 | { | ||
38 | public string file; | ||
39 | public string connect; | ||
40 | |||
41 | [TestFixtureSetUp] | ||
42 | public void Init() | ||
43 | { | ||
44 | // SQLite doesn't work on power or z linux | ||
45 | if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd")) | ||
46 | { | ||
47 | Assert.Ignore(); | ||
48 | } | ||
49 | |||
50 | SuperInit(); | ||
51 | file = Path.GetTempFileName() + ".db"; | ||
52 | connect = "URI=file:" + file + ",version=3"; | ||
53 | db = new SQLiteAssetData(); | ||
54 | db.Initialise(connect); | ||
55 | } | ||
56 | |||
57 | [TestFixtureTearDown] | ||
58 | public void Cleanup() | ||
59 | { | ||
60 | db.Dispose(); | ||
61 | File.Delete(file); | ||
62 | } | ||
63 | } | ||
64 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/Tests/SQLiteEstateTest.cs b/OpenSim/Data/SQLiteNG/Tests/SQLiteEstateTest.cs deleted file mode 100644 index 30f6641..0000000 --- a/OpenSim/Data/SQLiteNG/Tests/SQLiteEstateTest.cs +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
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.IO; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Data.Tests; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Data.SQLite.Tests | ||
34 | { | ||
35 | [TestFixture, DatabaseTest] | ||
36 | public class SQLiteEstateTest : BasicEstateTest | ||
37 | { | ||
38 | public string file = "regiontest.db"; | ||
39 | public string connect; | ||
40 | |||
41 | [TestFixtureSetUp] | ||
42 | public void Init() | ||
43 | { | ||
44 | // SQLite doesn't work on power or z linux | ||
45 | if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd")) | ||
46 | { | ||
47 | Assert.Ignore(); | ||
48 | } | ||
49 | |||
50 | SuperInit(); | ||
51 | file = Path.GetTempFileName() + ".db"; | ||
52 | connect = "URI=file:" + file + ",version=3"; | ||
53 | db = new SQLiteEstateStore(); | ||
54 | db.Initialise(connect); | ||
55 | regionDb = new SQLiteRegionData(); | ||
56 | regionDb.Initialise(connect); | ||
57 | } | ||
58 | |||
59 | [TestFixtureTearDown] | ||
60 | public void Cleanup() | ||
61 | { | ||
62 | regionDb.Dispose(); | ||
63 | } | ||
64 | } | ||
65 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/Tests/SQLiteInventoryTest.cs b/OpenSim/Data/SQLiteNG/Tests/SQLiteInventoryTest.cs deleted file mode 100644 index 98458a3..0000000 --- a/OpenSim/Data/SQLiteNG/Tests/SQLiteInventoryTest.cs +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
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.IO; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Data.Tests; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Data.SQLite.Tests | ||
34 | { | ||
35 | [TestFixture, DatabaseTest] | ||
36 | public class SQLiteInventoryTest : BasicInventoryTest | ||
37 | { | ||
38 | public string file; | ||
39 | public string connect; | ||
40 | |||
41 | [TestFixtureSetUp] | ||
42 | public void Init() | ||
43 | { | ||
44 | // SQLite doesn't work on power or z linux | ||
45 | if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd")) | ||
46 | { | ||
47 | Assert.Ignore(); | ||
48 | } | ||
49 | |||
50 | SuperInit(); | ||
51 | |||
52 | file = Path.GetTempFileName() + ".db"; | ||
53 | connect = "URI=file:" + file + ",version=3"; | ||
54 | |||
55 | db = new SQLiteInventoryStore(); | ||
56 | db.Initialise(connect); | ||
57 | } | ||
58 | |||
59 | [TestFixtureTearDown] | ||
60 | public void Cleanup() | ||
61 | { | ||
62 | db.Dispose(); | ||
63 | File.Delete(file); | ||
64 | } | ||
65 | } | ||
66 | } | ||
diff --git a/OpenSim/Data/SQLiteNG/Tests/SQLiteRegionTest.cs b/OpenSim/Data/SQLiteNG/Tests/SQLiteRegionTest.cs deleted file mode 100644 index abb97cf..0000000 --- a/OpenSim/Data/SQLiteNG/Tests/SQLiteRegionTest.cs +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
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.IO; | ||
29 | using NUnit.Framework; | ||
30 | using OpenSim.Data.Tests; | ||
31 | using OpenSim.Tests.Common; | ||
32 | |||
33 | namespace OpenSim.Data.SQLite.Tests | ||
34 | { | ||
35 | [TestFixture, DatabaseTest] | ||
36 | public class SQLiteRegionTest : BasicRegionTest | ||
37 | { | ||
38 | public string file = "regiontest.db"; | ||
39 | public string connect; | ||
40 | |||
41 | [TestFixtureSetUp] | ||
42 | public void Init() | ||
43 | { | ||
44 | // SQLite doesn't work on power or z linux | ||
45 | if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd")) | ||
46 | { | ||
47 | Assert.Ignore(); | ||
48 | } | ||
49 | |||
50 | SuperInit(); | ||
51 | file = Path.GetTempFileName() + ".db"; | ||
52 | connect = "URI=file:" + file + ",version=3"; | ||
53 | db = new SQLiteRegionData(); | ||
54 | db.Initialise(connect); | ||
55 | } | ||
56 | |||
57 | [TestFixtureTearDown] | ||
58 | public void Cleanup() | ||
59 | { | ||
60 | db.Dispose(); | ||
61 | File.Delete(file); | ||
62 | } | ||
63 | } | ||
64 | } | ||