diff options
author | Adam Frisby | 2007-06-02 00:37:31 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-02 00:37:31 +0000 |
commit | 55f7fe0ae3d979cb0988f385bfee27b8c7f75820 (patch) | |
tree | a180507b45bdf2492e9c08b9da6adbc830202409 /OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | |
parent | * MS-SQL Interface is now well documented (and probably defunct) (diff) | |
download | opensim-SC_OLD-55f7fe0ae3d979cb0988f385bfee27b8c7f75820.zip opensim-SC_OLD-55f7fe0ae3d979cb0988f385bfee27b8c7f75820.tar.gz opensim-SC_OLD-55f7fe0ae3d979cb0988f385bfee27b8c7f75820.tar.bz2 opensim-SC_OLD-55f7fe0ae3d979cb0988f385bfee27b8c7f75820.tar.xz |
Dont want to do that again --- MySQL interface is now fully documented. Added little bit more documentation to the MSSQL interface.
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs')
-rw-r--r-- | OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs index 4a7276c..1bb9125 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | |||
@@ -1,3 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
1 | using System; | 27 | using System; |
2 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
3 | using System.Text; | 29 | using System.Text; |
@@ -6,12 +32,23 @@ using libsecondlife; | |||
6 | 32 | ||
7 | namespace OpenGrid.Framework.Data.MySQL | 33 | namespace OpenGrid.Framework.Data.MySQL |
8 | { | 34 | { |
35 | /// <summary> | ||
36 | /// A database interface class to a user profile storage system | ||
37 | /// </summary> | ||
9 | class MySQLUserData : IUserData | 38 | class MySQLUserData : IUserData |
10 | { | 39 | { |
40 | /// <summary> | ||
41 | /// Database manager for MySQL | ||
42 | /// </summary> | ||
11 | public MySQLManager database; | 43 | public MySQLManager database; |
12 | 44 | ||
45 | /// <summary> | ||
46 | /// Loads and initialises the MySQL storage plugin | ||
47 | /// </summary> | ||
13 | public void Initialise() | 48 | public void Initialise() |
14 | { | 49 | { |
50 | // Load from an INI file connection details | ||
51 | // TODO: move this to XML? | ||
15 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | 52 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); |
16 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | 53 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); |
17 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | 54 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); |
@@ -23,11 +60,22 @@ namespace OpenGrid.Framework.Data.MySQL | |||
23 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | 60 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); |
24 | } | 61 | } |
25 | 62 | ||
63 | /// <summary> | ||
64 | /// Searches the database for a specified user profile | ||
65 | /// </summary> | ||
66 | /// <param name="name">The account name of the user</param> | ||
67 | /// <returns>A user profile</returns> | ||
26 | public UserProfileData getUserByName(string name) | 68 | public UserProfileData getUserByName(string name) |
27 | { | 69 | { |
28 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | 70 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); |
29 | } | 71 | } |
30 | 72 | ||
73 | /// <summary> | ||
74 | /// Searches the database for a specified user profile by name components | ||
75 | /// </summary> | ||
76 | /// <param name="user">The first part of the account name</param> | ||
77 | /// <param name="last">The second part of the account name</param> | ||
78 | /// <returns>A user profile</returns> | ||
31 | public UserProfileData getUserByName(string user, string last) | 79 | public UserProfileData getUserByName(string user, string last) |
32 | { | 80 | { |
33 | try | 81 | try |
@@ -57,6 +105,11 @@ namespace OpenGrid.Framework.Data.MySQL | |||
57 | } | 105 | } |
58 | } | 106 | } |
59 | 107 | ||
108 | /// <summary> | ||
109 | /// Searches the database for a specified user profile by UUID | ||
110 | /// </summary> | ||
111 | /// <param name="uuid">The account ID</param> | ||
112 | /// <returns>The users profile</returns> | ||
60 | public UserProfileData getUserByUUID(LLUUID uuid) | 113 | public UserProfileData getUserByUUID(LLUUID uuid) |
61 | { | 114 | { |
62 | try | 115 | try |
@@ -85,17 +138,33 @@ namespace OpenGrid.Framework.Data.MySQL | |||
85 | } | 138 | } |
86 | } | 139 | } |
87 | 140 | ||
141 | /// <summary> | ||
142 | /// Returns a user session searching by name | ||
143 | /// </summary> | ||
144 | /// <param name="name">The account name</param> | ||
145 | /// <returns>The users session</returns> | ||
88 | public UserAgentData getAgentByName(string name) | 146 | public UserAgentData getAgentByName(string name) |
89 | { | 147 | { |
90 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | 148 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); |
91 | } | 149 | } |
92 | 150 | ||
151 | /// <summary> | ||
152 | /// Returns a user session by account name | ||
153 | /// </summary> | ||
154 | /// <param name="user">First part of the users account name</param> | ||
155 | /// <param name="last">Second part of the users account name</param> | ||
156 | /// <returns>The users session</returns> | ||
93 | public UserAgentData getAgentByName(string user, string last) | 157 | public UserAgentData getAgentByName(string user, string last) |
94 | { | 158 | { |
95 | UserProfileData profile = getUserByName(user, last); | 159 | UserProfileData profile = getUserByName(user, last); |
96 | return getAgentByUUID(profile.UUID); | 160 | return getAgentByUUID(profile.UUID); |
97 | } | 161 | } |
98 | 162 | ||
163 | /// <summary> | ||
164 | /// Returns an agent session by account UUID | ||
165 | /// </summary> | ||
166 | /// <param name="uuid">The accounts UUID</param> | ||
167 | /// <returns>The users session</returns> | ||
99 | public UserAgentData getAgentByUUID(LLUUID uuid) | 168 | public UserAgentData getAgentByUUID(LLUUID uuid) |
100 | { | 169 | { |
101 | try | 170 | try |
@@ -124,30 +193,61 @@ namespace OpenGrid.Framework.Data.MySQL | |||
124 | } | 193 | } |
125 | } | 194 | } |
126 | 195 | ||
196 | /// <summary> | ||
197 | /// Creates a new users profile | ||
198 | /// </summary> | ||
199 | /// <param name="user">The user profile to create</param> | ||
127 | public void addNewUserProfile(UserProfileData user) | 200 | public void addNewUserProfile(UserProfileData user) |
128 | { | 201 | { |
129 | } | 202 | } |
130 | 203 | ||
204 | /// <summary> | ||
205 | /// Creates a new agent | ||
206 | /// </summary> | ||
207 | /// <param name="agent">The agent to create</param> | ||
131 | public void addNewUserAgent(UserAgentData agent) | 208 | public void addNewUserAgent(UserAgentData agent) |
132 | { | 209 | { |
133 | // Do nothing. | 210 | // Do nothing. |
134 | } | 211 | } |
135 | 212 | ||
213 | /// <summary> | ||
214 | /// Performs a money transfer request between two accounts | ||
215 | /// </summary> | ||
216 | /// <param name="from">The senders account ID</param> | ||
217 | /// <param name="to">The recievers account ID</param> | ||
218 | /// <param name="amount">The amount to transfer</param> | ||
219 | /// <returns>Success?</returns> | ||
136 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 220 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
137 | { | 221 | { |
138 | return false; | 222 | return false; |
139 | } | 223 | } |
140 | 224 | ||
225 | /// <summary> | ||
226 | /// Performs an inventory transfer request between two accounts | ||
227 | /// </summary> | ||
228 | /// <remarks>TODO: Move to inventory server</remarks> | ||
229 | /// <param name="from">The senders account ID</param> | ||
230 | /// <param name="to">The recievers account ID</param> | ||
231 | /// <param name="item">The item to transfer</param> | ||
232 | /// <returns>Success?</returns> | ||
141 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | 233 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) |
142 | { | 234 | { |
143 | return false; | 235 | return false; |
144 | } | 236 | } |
145 | 237 | ||
238 | /// <summary> | ||
239 | /// Database provider name | ||
240 | /// </summary> | ||
241 | /// <returns>Provider name</returns> | ||
146 | public string getName() | 242 | public string getName() |
147 | { | 243 | { |
148 | return "MySQL Userdata Interface"; | 244 | return "MySQL Userdata Interface"; |
149 | } | 245 | } |
150 | 246 | ||
247 | /// <summary> | ||
248 | /// Database provider version | ||
249 | /// </summary> | ||
250 | /// <returns>provider version</returns> | ||
151 | public string getVersion() | 251 | public string getVersion() |
152 | { | 252 | { |
153 | return "0.1"; | 253 | return "0.1"; |