diff options
Diffstat (limited to 'OpenSim/Data/SQLiteLegacy')
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs | 74 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs | 70 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs | 81 |
6 files changed, 9 insertions, 242 deletions
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs index 0d63dea..23cdfd4 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs | |||
@@ -234,8 +234,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
234 | AssetBase asset = new AssetBase( | 234 | AssetBase asset = new AssetBase( |
235 | new UUID((String)row["UUID"]), | 235 | new UUID((String)row["UUID"]), |
236 | (String)row["Name"], | 236 | (String)row["Name"], |
237 | Convert.ToSByte(row["Type"]), | 237 | Convert.ToSByte(row["Type"]) |
238 | UUID.Zero.ToString() | ||
239 | ); | 238 | ); |
240 | 239 | ||
241 | asset.Description = (String) row["Description"]; | 240 | asset.Description = (String) row["Description"]; |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs deleted file mode 100644 index 660632c..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAvatarData.cs +++ /dev/null | |||
@@ -1,74 +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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Data; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using Mono.Data.SqliteClient; | ||
37 | |||
38 | namespace OpenSim.Data.SQLiteLegacy | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A SQLite Interface for Avatar Data | ||
42 | /// </summary> | ||
43 | public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>, | ||
44 | IAvatarData | ||
45 | { | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | public SQLiteAvatarData(string connectionString, string realm) : | ||
49 | base(connectionString, realm, "Avatar") | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public bool Delete(UUID principalID, string name) | ||
54 | { | ||
55 | SqliteCommand cmd = new SqliteCommand(); | ||
56 | |||
57 | cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm); | ||
58 | cmd.Parameters.Add(":PrincipalID", principalID.ToString()); | ||
59 | cmd.Parameters.Add(":Name", name); | ||
60 | |||
61 | try | ||
62 | { | ||
63 | if (ExecuteNonQuery(cmd, m_Connection) > 0) | ||
64 | return true; | ||
65 | |||
66 | return false; | ||
67 | } | ||
68 | finally | ||
69 | { | ||
70 | CloseCommand(cmd); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | } | ||
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index e135eaa..5a7fbd7 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
80 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } | 80 | get { return new List<string>(m_FieldMap.Keys).ToArray(); } |
81 | } | 81 | } |
82 | 82 | ||
83 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | 83 | public EstateSettings LoadEstateSettings(UUID regionID) |
84 | { | 84 | { |
85 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; | 85 | string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID"; |
86 | 86 | ||
@@ -89,10 +89,10 @@ namespace OpenSim.Data.SQLiteLegacy | |||
89 | cmd.CommandText = sql; | 89 | cmd.CommandText = sql; |
90 | cmd.Parameters.Add(":RegionID", regionID.ToString()); | 90 | cmd.Parameters.Add(":RegionID", regionID.ToString()); |
91 | 91 | ||
92 | return DoLoad(cmd, regionID, create); | 92 | return DoLoad(cmd, regionID); |
93 | } | 93 | } |
94 | 94 | ||
95 | private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) | 95 | private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID) |
96 | { | 96 | { |
97 | EstateSettings es = new EstateSettings(); | 97 | EstateSettings es = new EstateSettings(); |
98 | es.OnSave += StoreEstateSettings; | 98 | es.OnSave += StoreEstateSettings; |
@@ -125,8 +125,10 @@ namespace OpenSim.Data.SQLiteLegacy | |||
125 | } | 125 | } |
126 | r.Close(); | 126 | r.Close(); |
127 | } | 127 | } |
128 | else if (create) | 128 | else |
129 | { | 129 | { |
130 | // Migration case | ||
131 | // | ||
130 | r.Close(); | 132 | r.Close(); |
131 | 133 | ||
132 | List<string> names = new List<string>(FieldList); | 134 | List<string> names = new List<string>(FieldList); |
@@ -335,7 +337,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
335 | cmd.CommandText = sql; | 337 | cmd.CommandText = sql; |
336 | cmd.Parameters.Add(":EstateID", estateID.ToString()); | 338 | cmd.Parameters.Add(":EstateID", estateID.ToString()); |
337 | 339 | ||
338 | return DoLoad(cmd, UUID.Zero, false); | 340 | return DoLoad(cmd, UUID.Zero); |
339 | } | 341 | } |
340 | 342 | ||
341 | public List<int> GetEstates(string search) | 343 | public List<int> GetEstates(string search) |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs deleted file mode 100644 index d529d4d..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteFriendsData.cs +++ /dev/null | |||
@@ -1,70 +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; | ||
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/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index eb78037..f8660c7 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | |||
@@ -272,16 +272,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
272 | Commit(); | 272 | Commit(); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 275 | |
276 | { | ||
277 | //This connector doesn't support the windlight module yet | ||
278 | //Return default LL windlight settings | ||
279 | return new RegionLightShareData(); | ||
280 | } | ||
281 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | ||
282 | { | ||
283 | //This connector doesn't support the windlight module yet | ||
284 | } | ||
285 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 276 | public RegionSettings LoadRegionSettings(UUID regionUUID) |
286 | { | 277 | { |
287 | lock (ds) | 278 | lock (ds) |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs deleted file mode 100644 index 27553c6..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteUserAccountData.cs +++ /dev/null | |||
@@ -1,81 +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; | ||
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 | } | ||