diff options
author | Diva Canto | 2010-02-21 09:09:35 -0800 |
---|---|---|
committer | Diva Canto | 2010-02-21 09:09:35 -0800 |
commit | 552e9e8c7832f41f5a53666d9c3ece62f57be4ba (patch) | |
tree | 7fc71278cd0352f149d39910ea278a3b3f9d2465 | |
parent | SQLite connector for UserAccounts and Auth works. Yey! (diff) | |
download | opensim-SC_OLD-552e9e8c7832f41f5a53666d9c3ece62f57be4ba.zip opensim-SC_OLD-552e9e8c7832f41f5a53666d9c3ece62f57be4ba.tar.gz opensim-SC_OLD-552e9e8c7832f41f5a53666d9c3ece62f57be4ba.tar.bz2 opensim-SC_OLD-552e9e8c7832f41f5a53666d9c3ece62f57be4ba.tar.xz |
* Added SQlite connector for AvatarData. Tested -- works.
* Small bug fix in debug message
* Set default standalone configs to use SQLite across the board
5 files changed, 90 insertions, 7 deletions
diff --git a/OpenSim/Data/SQLite/Resources/001_Avatar.sql b/OpenSim/Data/SQLite/Resources/001_Avatar.sql new file mode 100644 index 0000000..7ec906b --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/001_Avatar.sql | |||
@@ -0,0 +1,9 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE Avatars ( | ||
4 | PrincipalID CHAR(36) NOT NULL, | ||
5 | Name VARCHAR(32) NOT NULL, | ||
6 | Value VARCHAR(255) NOT NULL DEFAULT '', | ||
7 | PRIMARY KEY(PrincipalID, Name)); | ||
8 | |||
9 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteAvatarData.cs b/OpenSim/Data/SQLite/SQLiteAvatarData.cs new file mode 100644 index 0000000..d0b82de --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteAvatarData.cs | |||
@@ -0,0 +1,74 @@ | |||
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.SQLite | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A MySQL Interface for the Grid Server | ||
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/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 54e62e2..e97d21f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
314 | item = m_InventoryService.GetItem(item); | 314 | item = m_InventoryService.GetItem(item); |
315 | 315 | ||
316 | if (null == item) | 316 | if (null == item) |
317 | m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}"); | 317 | m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID); |
318 | 318 | ||
319 | return item; | 319 | return item; |
320 | } | 320 | } |
diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index b9a9462..06333d8 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini | |||
@@ -32,14 +32,14 @@ | |||
32 | 32 | ||
33 | [AvatarService] | 33 | [AvatarService] |
34 | LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" | 34 | LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" |
35 | StorageProvider = "OpenSim.Data.Null.dll" | 35 | ConnectionString = "URI=file:avatars.db,version=3" |
36 | 36 | ||
37 | [AuthorizationService] | 37 | [AuthorizationService] |
38 | LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService" | 38 | LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService" |
39 | 39 | ||
40 | [AuthenticationService] | 40 | [AuthenticationService] |
41 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" | 41 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" |
42 | StorageProvider = "OpenSim.Data.Null.dll" | 42 | ConnectionString = "URI=file:auth.db,version=3" |
43 | 43 | ||
44 | [GridService] | 44 | [GridService] |
45 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" | 45 | LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" |
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | [UserAccountService] | 53 | [UserAccountService] |
54 | LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" | 54 | LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" |
55 | StorageProvider = "OpenSim.Data.Null.dll" | 55 | ConnectionString = "URI=file:userprofiles.db,version=3" |
56 | ;; These are for creating new accounts | 56 | ;; These are for creating new accounts |
57 | AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" | 57 | AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" |
58 | PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" | 58 | PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" |
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 9ad6d1c..04a2356 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | [AvatarService] | 43 | [AvatarService] |
44 | LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" | 44 | LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" |
45 | StorageProvider = "OpenSim.Data.Null.dll" | 45 | ConnectionString = "URI=file:avatars.db,version=3" |
46 | 46 | ||
47 | [LibraryService] | 47 | [LibraryService] |
48 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" | 48 | LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" |
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | [AuthenticationService] | 55 | [AuthenticationService] |
56 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" | 56 | LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" |
57 | StorageProvider = "OpenSim.Data.Null.dll" | 57 | ConnectionString = "URI=file:auth.db,version=3" |
58 | 58 | ||
59 | [GridService] | 59 | [GridService] |
60 | ; LocalGridServicesConnector needs this | 60 | ; LocalGridServicesConnector needs this |
@@ -70,7 +70,7 @@ | |||
70 | 70 | ||
71 | [UserAccountService] | 71 | [UserAccountService] |
72 | LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" | 72 | LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" |
73 | StorageProvider = "OpenSim.Data.Null.dll" | 73 | ConnectionString = "URI=file:userprofiles.db,version=3" |
74 | ;; These are for creating new accounts by the service | 74 | ;; These are for creating new accounts by the service |
75 | AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" | 75 | AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" |
76 | PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" | 76 | PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" |