aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.MySQL
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs258
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs309
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs107
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs581
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs257
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj237
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine117
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858114
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921117
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user12
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build49
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs35
12 files changed, 2193 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
new file mode 100644
index 0000000..d9a517d
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -0,0 +1,258 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenGrid.Framework.Data;
32
33namespace OpenGrid.Framework.Data.MySQL
34{
35 /// <summary>
36 /// A MySQL Interface for the Grid Server
37 /// </summary>
38 public class MySQLGridData : IGridData
39 {
40 /// <summary>
41 /// MySQL Database Manager
42 /// </summary>
43 private MySQLManager database;
44
45 /// <summary>
46 /// Initialises the Grid Interface
47 /// </summary>
48 public void Initialise()
49 {
50 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
51 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
52 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
53 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
54 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
55 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
56 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
57
58 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
59 }
60
61 /// <summary>
62 /// Shuts down the grid interface
63 /// </summary>
64 public void Close()
65 {
66 database.Close();
67 }
68
69 /// <summary>
70 /// Returns the plugin name
71 /// </summary>
72 /// <returns>Plugin name</returns>
73 public string getName()
74 {
75 return "MySql OpenGridData";
76 }
77
78 /// <summary>
79 /// Returns the plugin version
80 /// </summary>
81 /// <returns>Plugin version</returns>
82 public string getVersion()
83 {
84 return "0.1";
85 }
86
87 /// <summary>
88 /// Returns all the specified region profiles within coordates -- coordinates are inclusive
89 /// </summary>
90 /// <param name="xmin">Minimum X coordinate</param>
91 /// <param name="ymin">Minimum Y coordinate</param>
92 /// <param name="xmax">Maximum X coordinate</param>
93 /// <param name="ymax">Maximum Y coordinate</param>
94 /// <returns></returns>
95 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
96 {
97 try
98 {
99 lock (database)
100 {
101 Dictionary<string, string> param = new Dictionary<string, string>();
102 param["?xmin"] = xmin.ToString();
103 param["?ymin"] = ymin.ToString();
104 param["?xmax"] = xmax.ToString();
105 param["?ymax"] = ymax.ToString();
106
107 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
108 System.Data.IDataReader reader = result.ExecuteReader();
109
110 SimProfileData row;
111
112 List<SimProfileData> rows = new List<SimProfileData>();
113
114 while ((row = database.readSimRow(reader)) != null)
115 {
116 rows.Add(row);
117 }
118 reader.Close();
119 result.Dispose();
120
121 return rows.ToArray();
122
123 }
124 }
125 catch (Exception e)
126 {
127 database.Reconnect();
128 Console.WriteLine(e.ToString());
129 return null;
130 }
131 }
132
133 /// <summary>
134 /// Returns a sim profile from it's location
135 /// </summary>
136 /// <param name="handle">Region location handle</param>
137 /// <returns>Sim profile</returns>
138 public SimProfileData GetProfileByHandle(ulong handle)
139 {
140 try
141 {
142 lock (database)
143 {
144 Dictionary<string, string> param = new Dictionary<string, string>();
145 param["?handle"] = handle.ToString();
146
147 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
148 System.Data.IDataReader reader = result.ExecuteReader();
149
150 SimProfileData row = database.readSimRow(reader);
151 reader.Close();
152 result.Dispose();
153
154 return row;
155 }
156 }
157 catch (Exception e)
158 {
159 database.Reconnect();
160 Console.WriteLine(e.ToString());
161 return null;
162 }
163 }
164
165 /// <summary>
166 /// Returns a sim profile from it's UUID
167 /// </summary>
168 /// <param name="uuid">The region UUID</param>
169 /// <returns>The sim profile</returns>
170 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
171 {
172 try
173 {
174 lock (database)
175 {
176 Dictionary<string, string> param = new Dictionary<string, string>();
177 param["?uuid"] = uuid.ToStringHyphenated();
178
179 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
180 System.Data.IDataReader reader = result.ExecuteReader();
181
182 SimProfileData row = database.readSimRow(reader);
183 reader.Close();
184 result.Dispose();
185
186 return row;
187 }
188 }
189 catch (Exception e)
190 {
191 database.Reconnect();
192 Console.WriteLine(e.ToString());
193 return null;
194 }
195 }
196
197 /// <summary>
198 /// Adds a new profile to the database
199 /// </summary>
200 /// <param name="profile">The profile to add</param>
201 /// <returns>Successful?</returns>
202 public DataResponse AddProfile(SimProfileData profile)
203 {
204 lock (database)
205 {
206 if (database.insertRegion(profile))
207 {
208 return DataResponse.RESPONSE_OK;
209 }
210 else
211 {
212 return DataResponse.RESPONSE_ERROR;
213 }
214 }
215 }
216
217 /// <summary>
218 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
219 /// </summary>
220 /// <param name="uuid">The UUID of the challenger</param>
221 /// <param name="handle">The attempted regionHandle of the challenger</param>
222 /// <param name="authkey">The secret</param>
223 /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
224 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
225 {
226 bool throwHissyFit = false; // Should be true by 1.0
227
228 if (throwHissyFit)
229 throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
230
231 SimProfileData data = GetProfileByLLUUID(uuid);
232
233 return (handle == data.regionHandle && authkey == data.regionSecret);
234 }
235
236 /// <summary>
237 /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
238 /// </summary>
239 /// <remarks>This requires a security audit.</remarks>
240 /// <param name="uuid"></param>
241 /// <param name="handle"></param>
242 /// <param name="authhash"></param>
243 /// <param name="challenge"></param>
244 /// <returns></returns>
245 public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
246 {
247 System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
248 System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
249
250 byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
251 byte[] hash = HashProvider.ComputeHash(stream);
252
253 return false;
254 }
255 }
256
257
258}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
new file mode 100644
index 0000000..fb429e4
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
@@ -0,0 +1,309 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32
33namespace OpenGrid.Framework.Data.MySQL
34{
35 /// <summary>
36 /// A MySQL interface for the inventory server
37 /// </summary>
38 class MySQLInventoryData : IInventoryData
39 {
40 /// <summary>
41 /// The database manager
42 /// </summary>
43 public MySQLManager database;
44
45 /// <summary>
46 /// Loads and initialises this database plugin
47 /// </summary>
48 public void Initialise()
49 {
50 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
51 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
52 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
53 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
54 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
55 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
56 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
57
58 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
59 }
60
61 /// <summary>
62 /// The name of this DB provider
63 /// </summary>
64 /// <returns>Name of DB provider</returns>
65 public string getName()
66 {
67 return "MySQL Inventory Data Interface";
68 }
69
70 /// <summary>
71 /// Closes this DB provider
72 /// </summary>
73 public void Close()
74 {
75 // Do nothing.
76 }
77
78 /// <summary>
79 /// Returns the version of this DB provider
80 /// </summary>
81 /// <returns>A string containing the DB provider</returns>
82 public string getVersion()
83 {
84 return "0.1";
85 }
86
87 /// <summary>
88 /// Returns a list of items in a specified folder
89 /// </summary>
90 /// <param name="folderID">The folder to search</param>
91 /// <returns>A list containing inventory items</returns>
92 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
93 {
94 try
95 {
96 lock (database)
97 {
98 Dictionary<string, string> param = new Dictionary<string, string>();
99 param["?uuid"] = folderID.ToStringHyphenated();
100
101 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param);
102 System.Data.IDataReader reader = result.ExecuteReader();
103
104 List<InventoryItemBase> items = database.readInventoryItems(reader);
105
106 reader.Close();
107 result.Dispose();
108
109 return items;
110 }
111 }
112 catch (Exception e)
113 {
114 database.Reconnect();
115 Console.WriteLine(e.ToString());
116 return null;
117 }
118 }
119
120 /// <summary>
121 /// Returns a list of the root folders within a users inventory
122 /// </summary>
123 /// <param name="user">The user whos inventory is to be searched</param>
124 /// <returns>A list of folder objects</returns>
125 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
126 {
127 try
128 {
129 lock (database)
130 {
131 Dictionary<string, string> param = new Dictionary<string, string>();
132 param["?uuid"] = user.ToStringHyphenated();
133 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
134
135 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
136 System.Data.IDataReader reader = result.ExecuteReader();
137
138 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
139
140 reader.Close();
141 result.Dispose();
142
143 return items;
144 }
145 }
146 catch (Exception e)
147 {
148 database.Reconnect();
149 Console.WriteLine(e.ToString());
150 return null;
151 }
152 }
153
154 /// <summary>
155 /// Returns a list of folders in a users inventory contained within the specified folder
156 /// </summary>
157 /// <param name="parentID">The folder to search</param>
158 /// <returns>A list of inventory folders</returns>
159 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
160 {
161 try
162 {
163 lock (database)
164 {
165 Dictionary<string, string> param = new Dictionary<string, string>();
166 param["?uuid"] = parentID.ToStringHyphenated();
167
168 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param);
169 System.Data.IDataReader reader = result.ExecuteReader();
170
171 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
172
173 reader.Close();
174 result.Dispose();
175
176 return items;
177 }
178 }
179 catch (Exception e)
180 {
181 database.Reconnect();
182 Console.WriteLine(e.ToString());
183 return null;
184 }
185 }
186
187 /// <summary>
188 /// Returns a specified inventory item
189 /// </summary>
190 /// <param name="item">The item to return</param>
191 /// <returns>An inventory item</returns>
192 public InventoryItemBase getInventoryItem(LLUUID item)
193 {
194 try
195 {
196 lock (database)
197 {
198 Dictionary<string, string> param = new Dictionary<string, string>();
199 param["?uuid"] = item.ToStringHyphenated();
200
201 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param);
202 System.Data.IDataReader reader = result.ExecuteReader();
203
204 List<InventoryItemBase> items = database.readInventoryItems(reader);
205
206 reader.Close();
207 result.Dispose();
208
209 if (items.Count > 0)
210 {
211 return items[0];
212 }
213 else
214 {
215 return null;
216 }
217 }
218 }
219 catch (Exception e)
220 {
221 database.Reconnect();
222 Console.WriteLine(e.ToString());
223 return null;
224 }
225 }
226
227 /// <summary>
228 /// Returns a specified inventory folder
229 /// </summary>
230 /// <param name="folder">The folder to return</param>
231 /// <returns>A folder class</returns>
232 public InventoryFolderBase getInventoryFolder(LLUUID folder)
233 {
234 try
235 {
236 lock (database)
237 {
238 Dictionary<string, string> param = new Dictionary<string, string>();
239 param["?uuid"] = folder.ToStringHyphenated();
240
241 System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param);
242 System.Data.IDataReader reader = result.ExecuteReader();
243
244 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
245
246 reader.Close();
247 result.Dispose();
248
249 if (items.Count > 0)
250 {
251 return items[0];
252 }
253 else
254 {
255 return null;
256 }
257 }
258 }
259 catch (Exception e)
260 {
261 database.Reconnect();
262 Console.WriteLine(e.ToString());
263 return null;
264 }
265 }
266
267 /// <summary>
268 /// Adds a specified item to the database
269 /// </summary>
270 /// <param name="item">The inventory item</param>
271 public void addInventoryItem(InventoryItemBase item)
272 {
273 lock (database)
274 {
275 database.insertItem(item);
276 }
277 }
278
279 /// <summary>
280 /// Updates the specified inventory item
281 /// </summary>
282 /// <param name="item">Inventory item to update</param>
283 public void updateInventoryItem(InventoryItemBase item)
284 {
285 addInventoryItem(item);
286 }
287
288 /// <summary>
289 /// Creates a new inventory folder
290 /// </summary>
291 /// <param name="folder">Folder to create</param>
292 public void addInventoryFolder(InventoryFolderBase folder)
293 {
294 lock (database)
295 {
296 database.insertFolder(folder);
297 }
298 }
299
300 /// <summary>
301 /// Updates an inventory folder
302 /// </summary>
303 /// <param name="folder">Folder to update</param>
304 public void updateInventoryFolder(InventoryFolderBase folder)
305 {
306 addInventoryFolder(folder);
307 }
308 }
309}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
new file mode 100644
index 0000000..c88b39f
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
@@ -0,0 +1,107 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenGrid.Framework.Data.MySQL
33{
34 /// <summary>
35 /// An interface to the log database for MySQL
36 /// </summary>
37 class MySQLLogData : ILogData
38 {
39 /// <summary>
40 /// The database manager
41 /// </summary>
42 public MySQLManager database;
43
44 /// <summary>
45 /// Artificial constructor called when the plugin is loaded
46 /// </summary>
47 public void Initialise()
48 {
49 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
50 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
51 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
52 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
53 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
54 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
55 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
56
57 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
58 }
59
60 /// <summary>
61 /// Saves a log item to the database
62 /// </summary>
63 /// <param name="serverDaemon">The daemon triggering the event</param>
64 /// <param name="target">The target of the action (region / agent UUID, etc)</param>
65 /// <param name="methodCall">The method call where the problem occured</param>
66 /// <param name="arguments">The arguments passed to the method</param>
67 /// <param name="priority">How critical is this?</param>
68 /// <param name="logMessage">The message to log</param>
69 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
70 {
71 try
72 {
73 database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
74 }
75 catch (Exception e)
76 {
77 database.Reconnect();
78 }
79 }
80
81 /// <summary>
82 /// Returns the name of this DB provider
83 /// </summary>
84 /// <returns>A string containing the DB provider name</returns>
85 public string getName()
86 {
87 return "MySQL Logdata Interface";
88 }
89
90 /// <summary>
91 /// Closes the database provider
92 /// </summary>
93 public void Close()
94 {
95 // Do nothing.
96 }
97
98 /// <summary>
99 /// Returns the version of this DB provider
100 /// </summary>
101 /// <returns>A string containing the provider version</returns>
102 public string getVersion()
103 {
104 return "0.1";
105 }
106 }
107}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
new file mode 100644
index 0000000..76d3faf
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -0,0 +1,581 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.Data;
32
33// MySQL Native
34using MySql;
35using MySql.Data;
36using MySql.Data.Types;
37using MySql.Data.MySqlClient;
38
39using OpenGrid.Framework.Data;
40
41namespace OpenGrid.Framework.Data.MySQL
42{
43 /// <summary>
44 /// A MySQL Database manager
45 /// </summary>
46 class MySQLManager
47 {
48 /// <summary>
49 /// The database connection object
50 /// </summary>
51 IDbConnection dbcon;
52 /// <summary>
53 /// Connection string for ADO.net
54 /// </summary>
55 string connectionString;
56
57 /// <summary>
58 /// Initialises and creates a new MySQL connection and maintains it.
59 /// </summary>
60 /// <param name="hostname">The MySQL server being connected to</param>
61 /// <param name="database">The name of the MySQL database being used</param>
62 /// <param name="username">The username logging into the database</param>
63 /// <param name="password">The password for the user logging in</param>
64 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
65 public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port)
66 {
67 try
68 {
69 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";";
70 dbcon = new MySqlConnection(connectionString);
71
72 dbcon.Open();
73
74 System.Console.WriteLine("MySQL connection established");
75 }
76 catch (Exception e)
77 {
78 throw new Exception("Error initialising MySql Database: " + e.ToString());
79 }
80 }
81
82 /// <summary>
83 /// Shuts down the database connection
84 /// </summary>
85 public void Close()
86 {
87 dbcon.Close();
88 dbcon = null;
89 }
90
91 /// <summary>
92 /// Reconnects to the database
93 /// </summary>
94 public void Reconnect()
95 {
96 lock (dbcon)
97 {
98 try
99 {
100 // Close the DB connection
101 dbcon.Close();
102 // Try reopen it
103 dbcon = new MySqlConnection(connectionString);
104 dbcon.Open();
105 }
106 catch (Exception e)
107 {
108 Console.WriteLine("Unable to reconnect to database " + e.ToString());
109 }
110 }
111 }
112
113 /// <summary>
114 /// Runs a query with protection against SQL Injection by using parameterised input.
115 /// </summary>
116 /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
117 /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
118 /// <returns>A MySQL DB Command</returns>
119 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
120 {
121 try
122 {
123 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
124 dbcommand.CommandText = sql;
125 foreach (KeyValuePair<string, string> param in parameters)
126 {
127 dbcommand.Parameters.Add(param.Key, param.Value);
128 }
129
130 return (IDbCommand)dbcommand;
131 }
132 catch
133 {
134 lock (dbcon)
135 {
136 // Close the DB connection
137 try
138 {
139 dbcon.Close();
140 }
141 catch { }
142
143 // Try reopen it
144 try
145 {
146 dbcon = new MySqlConnection(connectionString);
147 dbcon.Open();
148 }
149 catch (Exception e)
150 {
151 Console.WriteLine("Unable to reconnect to database " + e.ToString());
152 }
153
154 // Run the query again
155 try
156 {
157 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
158 dbcommand.CommandText = sql;
159 foreach (KeyValuePair<string, string> param in parameters)
160 {
161 dbcommand.Parameters.Add(param.Key, param.Value);
162 }
163
164 return (IDbCommand)dbcommand;
165 }
166 catch (Exception e)
167 {
168 // Return null if it fails.
169 Console.WriteLine("Failed during Query generation: " + e.ToString());
170 return null;
171 }
172 }
173 }
174 }
175
176 /// <summary>
177 /// Reads a region row from a database reader
178 /// </summary>
179 /// <param name="reader">An active database reader</param>
180 /// <returns>A region profile</returns>
181 public SimProfileData readSimRow(IDataReader reader)
182 {
183 SimProfileData retval = new SimProfileData();
184
185 if (reader.Read())
186 {
187 // Region Main
188 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
189 retval.regionName = (string)reader["regionName"];
190 retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
191
192 // Secrets
193 retval.regionRecvKey = (string)reader["regionRecvKey"];
194 retval.regionSecret = (string)reader["regionSecret"];
195 retval.regionSendKey = (string)reader["regionSendKey"];
196
197 // Region Server
198 retval.regionDataURI = (string)reader["regionDataURI"];
199 retval.regionOnline = false; // Needs to be pinged before this can be set.
200 retval.serverIP = (string)reader["serverIP"];
201 retval.serverPort = (uint)reader["serverPort"];
202 retval.serverURI = (string)reader["serverURI"];
203
204 // Location
205 retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString());
206 retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString());
207 retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString());
208
209 // Neighbours - 0 = No Override
210 retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString());
211 retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString());
212 retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString());
213 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
214
215 // Assets
216 retval.regionAssetURI = (string)reader["regionAssetURI"];
217 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"];
218 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"];
219
220 // Userserver
221 retval.regionUserURI = (string)reader["regionUserURI"];
222 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"];
223 retval.regionUserSendKey = (string)reader["regionUserSendKey"];
224
225 // World Map Addition
226 string tempRegionMap = reader["regionMapTexture"].ToString();
227 if (tempRegionMap != "")
228 {
229 retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap);
230 }
231 else
232 {
233 retval.regionMapTextureID = new libsecondlife.LLUUID();
234 }
235 }
236 else
237 {
238 return null;
239 }
240 return retval;
241 }
242
243 /// <summary>
244 /// Reads an agent row from a database reader
245 /// </summary>
246 /// <param name="reader">An active database reader</param>
247 /// <returns>A user session agent</returns>
248 public UserAgentData readAgentRow(IDataReader reader)
249 {
250 UserAgentData retval = new UserAgentData();
251
252 if (reader.Read())
253 {
254 // Agent IDs
255 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
256 retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]);
257 retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]);
258
259 // Agent Who?
260 retval.agentIP = (string)reader["agentIP"];
261 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
262 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
263
264 // Login/Logout times (UNIX Epoch)
265 retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString());
266 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
267
268 // Current position
269 retval.currentRegion = (string)reader["currentRegion"];
270 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
271 libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
272 }
273 else
274 {
275 return null;
276 }
277 return retval;
278 }
279
280 /// <summary>
281 /// Reads a user profile from an active data reader
282 /// </summary>
283 /// <param name="reader">An active database reader</param>
284 /// <returns>A user profile</returns>
285 public UserProfileData readUserRow(IDataReader reader)
286 {
287 UserProfileData retval = new UserProfileData();
288
289 if (reader.Read())
290 {
291 retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
292 retval.username = (string)reader["username"];
293 retval.surname = (string)reader["lastname"];
294
295 retval.passwordHash = (string)reader["passwordHash"];
296 retval.passwordSalt = (string)reader["passwordSalt"];
297
298 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
299 retval.homeLocation = new libsecondlife.LLVector3(
300 Convert.ToSingle(reader["homeLocationX"].ToString()),
301 Convert.ToSingle(reader["homeLocationY"].ToString()),
302 Convert.ToSingle(reader["homeLocationZ"].ToString()));
303 retval.homeLookAt = new libsecondlife.LLVector3(
304 Convert.ToSingle(reader["homeLookAtX"].ToString()),
305 Convert.ToSingle(reader["homeLookAtY"].ToString()),
306 Convert.ToSingle(reader["homeLookAtZ"].ToString()));
307
308 retval.created = Convert.ToInt32(reader["created"].ToString());
309 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
310
311 retval.userInventoryURI = (string)reader["userInventoryURI"];
312 retval.userAssetURI = (string)reader["userAssetURI"];
313
314 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
315 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
316
317 retval.profileAboutText = (string)reader["profileAboutText"];
318 retval.profileFirstText = (string)reader["profileFirstText"];
319
320 retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]);
321 retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]);
322
323 }
324 else
325 {
326 return null;
327 }
328 return retval;
329 }
330
331 /// <summary>
332 /// Reads a list of inventory folders returned by a query.
333 /// </summary>
334 /// <param name="reader">A MySQL Data Reader</param>
335 /// <returns>A List containing inventory folders</returns>
336 public List<InventoryFolderBase> readInventoryFolders(IDataReader reader)
337 {
338 List<InventoryFolderBase> rows = new List<InventoryFolderBase>();
339
340 while(reader.Read())
341 {
342 try
343 {
344 InventoryFolderBase folder = new InventoryFolderBase();
345
346 folder.agentID = new libsecondlife.LLUUID((string)reader["agentID"]);
347 folder.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
348 folder.folderID = new libsecondlife.LLUUID((string)reader["folderID"]);
349 folder.name = (string)reader["folderName"];
350
351 rows.Add(folder);
352 }
353 catch (Exception e)
354 {
355 Console.WriteLine(e.ToString());
356 }
357 }
358
359 return rows;
360 }
361
362 /// <summary>
363 /// Reads a collection of items from an SQL result
364 /// </summary>
365 /// <param name="reader">The SQL Result</param>
366 /// <returns>A List containing Inventory Items</returns>
367 public List<InventoryItemBase> readInventoryItems(IDataReader reader)
368 {
369 List<InventoryItemBase> rows = new List<InventoryItemBase>();
370
371 while (reader.Read())
372 {
373 try
374 {
375 InventoryItemBase item = new InventoryItemBase();
376
377 item.assetID = new libsecondlife.LLUUID((string)reader["assetID"]);
378 item.avatarID = new libsecondlife.LLUUID((string)reader["avatarID"]);
379 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString());
380 item.inventoryDescription = (string)reader["inventoryDescription"];
381 item.inventoryID = new libsecondlife.LLUUID((string)reader["inventoryID"]);
382 item.inventoryName = (string)reader["inventoryName"];
383 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString());
384 item.parentFolderID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
385 item.type = Convert.ToInt32(reader["type"].ToString());
386
387 rows.Add(item);
388 }
389 catch (Exception e)
390 {
391 Console.WriteLine(e.ToString());
392 }
393 }
394
395 return rows;
396 }
397
398 /// <summary>
399 /// Inserts a new row into the log database
400 /// </summary>
401 /// <param name="serverDaemon">The daemon which triggered this event</param>
402 /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param>
403 /// <param name="methodCall">The method call where the problem occured</param>
404 /// <param name="arguments">The arguments passed to the method</param>
405 /// <param name="priority">How critical is this?</param>
406 /// <param name="logMessage">Extra message info</param>
407 /// <returns>Saved successfully?</returns>
408 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
409 {
410 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
411 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
412
413 Dictionary<string, string> parameters = new Dictionary<string, string>();
414 parameters["?server"] = serverDaemon;
415 parameters["?target"] = target;
416 parameters["?method"] = methodCall;
417 parameters["?arguments"] = arguments;
418 parameters["?priority"] = priority.ToString();
419 parameters["?message"] = logMessage;
420
421 bool returnval = false;
422
423 try
424 {
425 IDbCommand result = Query(sql, parameters);
426
427 if (result.ExecuteNonQuery() == 1)
428 returnval = true;
429
430 result.Dispose();
431 }
432 catch (Exception e)
433 {
434 Console.WriteLine(e.ToString());
435 return false;
436 }
437
438 return returnval;
439 }
440
441 /// <summary>
442 /// Inserts a new item into the database
443 /// </summary>
444 /// <param name="item">The item</param>
445 /// <returns>Success?</returns>
446 public bool insertItem(InventoryItemBase item)
447 {
448 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
449 sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)";
450
451 Dictionary<string, string> parameters = new Dictionary<string, string>();
452 parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated();
453 parameters["?assetID"] = item.assetID.ToStringHyphenated();
454 parameters["?type"] = item.type.ToString();
455 parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated();
456 parameters["?avatarID"] = item.avatarID.ToStringHyphenated();
457 parameters["?inventoryName"] = item.inventoryName;
458 parameters["?inventoryDescription"] = item.inventoryDescription;
459 parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString();
460 parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString();
461
462 bool returnval = false;
463
464 try
465 {
466 IDbCommand result = Query(sql, parameters);
467
468 if (result.ExecuteNonQuery() == 1)
469 returnval = true;
470
471 result.Dispose();
472 }
473 catch (Exception e)
474 {
475 Console.WriteLine(e.ToString());
476 return false;
477 }
478
479 return returnval;
480 }
481
482 /// <summary>
483 /// Inserts a new folder into the database
484 /// </summary>
485 /// <param name="folder">The folder</param>
486 /// <returns>Success?</returns>
487 public bool insertFolder(InventoryFolderBase folder)
488 {
489 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
490 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)";
491
492 Dictionary<string, string> parameters = new Dictionary<string, string>();
493 parameters["?folderID"] = folder.folderID.ToStringHyphenated();
494 parameters["?agentID"] = folder.agentID.ToStringHyphenated();
495 parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated();
496 parameters["?folderName"] = folder.name;
497
498 bool returnval = false;
499 try
500 {
501 IDbCommand result = Query(sql, parameters);
502
503 if (result.ExecuteNonQuery() == 1)
504 returnval = true;
505
506 result.Dispose();
507 }
508 catch (Exception e)
509 {
510 Console.WriteLine(e.ToString());
511 return false;
512 }
513 return returnval;
514 }
515
516 /// <summary>
517 /// Inserts a new region into the database
518 /// </summary>
519 /// <param name="profile">The region to insert</param>
520 /// <returns>Success?</returns>
521 public bool insertRegion(SimProfileData regiondata)
522 {
523 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
524 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
525 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture) VALUES ";
526
527 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
528 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
529 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture);";
530
531 Dictionary<string, string> parameters = new Dictionary<string, string>();
532
533 parameters["?regionHandle"] = regiondata.regionHandle.ToString();
534 parameters["?regionName"] = regiondata.regionName.ToString();
535 parameters["?uuid"] = regiondata.UUID.ToStringHyphenated();
536 parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString();
537 parameters["?regionSecret"] = regiondata.regionSecret.ToString();
538 parameters["?regionSendKey"] = regiondata.regionSendKey.ToString();
539 parameters["?regionDataURI"] = regiondata.regionDataURI.ToString();
540 parameters["?serverIP"] = regiondata.serverIP.ToString();
541 parameters["?serverPort"] = regiondata.serverPort.ToString();
542 parameters["?serverURI"] = regiondata.serverURI.ToString();
543 parameters["?locX"] = regiondata.regionLocX.ToString();
544 parameters["?locY"] = regiondata.regionLocY.ToString();
545 parameters["?locZ"] = regiondata.regionLocZ.ToString();
546 parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString();
547 parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString();
548 parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString();
549 parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString();
550 parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString();
551 parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString();
552 parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString();
553 parameters["?regionUserURI"] = regiondata.regionUserURI.ToString();
554 parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString();
555 parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString();
556 parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated();
557
558 bool returnval = false;
559
560 try
561 {
562
563 IDbCommand result = Query(sql, parameters);
564
565 //Console.WriteLine(result.CommandText);
566
567 if (result.ExecuteNonQuery() == 1)
568 returnval = true;
569
570 result.Dispose();
571 }
572 catch (Exception e)
573 {
574 Console.WriteLine(e.ToString());
575 return false;
576 }
577
578 return returnval;
579 }
580 }
581}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
new file mode 100644
index 0000000..032a0e6
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
@@ -0,0 +1,257 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim 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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenGrid.Framework.Data;
32using libsecondlife;
33
34namespace OpenGrid.Framework.Data.MySQL
35{
36 /// <summary>
37 /// A database interface class to a user profile storage system
38 /// </summary>
39 class MySQLUserData : IUserData
40 {
41 /// <summary>
42 /// Database manager for MySQL
43 /// </summary>
44 public MySQLManager database;
45
46 /// <summary>
47 /// Loads and initialises the MySQL storage plugin
48 /// </summary>
49 public void Initialise()
50 {
51 // Load from an INI file connection details
52 // TODO: move this to XML?
53 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
54 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
55 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
56 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
57 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
58 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
59 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
60
61 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
62 }
63
64 /// <summary>
65 /// Searches the database for a specified user profile
66 /// </summary>
67 /// <param name="name">The account name of the user</param>
68 /// <returns>A user profile</returns>
69 public UserProfileData getUserByName(string name)
70 {
71 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
72 }
73
74 /// <summary>
75 /// Searches the database for a specified user profile by name components
76 /// </summary>
77 /// <param name="user">The first part of the account name</param>
78 /// <param name="last">The second part of the account name</param>
79 /// <returns>A user profile</returns>
80 public UserProfileData getUserByName(string user, string last)
81 {
82 try
83 {
84 lock (database)
85 {
86 Dictionary<string, string> param = new Dictionary<string, string>();
87 param["?first"] = user;
88 param["?second"] = last;
89
90 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
91 System.Data.IDataReader reader = result.ExecuteReader();
92
93 UserProfileData row = database.readUserRow(reader);
94
95 reader.Close();
96 result.Dispose();
97
98 return row;
99 }
100 }
101 catch (Exception e)
102 {
103 database.Reconnect();
104 Console.WriteLine(e.ToString());
105 return null;
106 }
107 }
108
109 /// <summary>
110 /// Searches the database for a specified user profile by UUID
111 /// </summary>
112 /// <param name="uuid">The account ID</param>
113 /// <returns>The users profile</returns>
114 public UserProfileData getUserByUUID(LLUUID uuid)
115 {
116 try
117 {
118 lock (database)
119 {
120 Dictionary<string, string> param = new Dictionary<string, string>();
121 param["?uuid"] = uuid.ToStringHyphenated();
122
123 System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
124 System.Data.IDataReader reader = result.ExecuteReader();
125
126 UserProfileData row = database.readUserRow(reader);
127
128 reader.Close();
129 result.Dispose();
130
131 return row;
132 }
133 }
134 catch (Exception e)
135 {
136 database.Reconnect();
137 Console.WriteLine(e.ToString());
138 return null;
139 }
140 }
141
142 /// <summary>
143 /// Returns a user session searching by name
144 /// </summary>
145 /// <param name="name">The account name</param>
146 /// <returns>The users session</returns>
147 public UserAgentData getAgentByName(string name)
148 {
149 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
150 }
151
152 /// <summary>
153 /// Returns a user session by account name
154 /// </summary>
155 /// <param name="user">First part of the users account name</param>
156 /// <param name="last">Second part of the users account name</param>
157 /// <returns>The users session</returns>
158 public UserAgentData getAgentByName(string user, string last)
159 {
160 UserProfileData profile = getUserByName(user, last);
161 return getAgentByUUID(profile.UUID);
162 }
163
164 /// <summary>
165 /// Returns an agent session by account UUID
166 /// </summary>
167 /// <param name="uuid">The accounts UUID</param>
168 /// <returns>The users session</returns>
169 public UserAgentData getAgentByUUID(LLUUID uuid)
170 {
171 try
172 {
173 lock (database)
174 {
175 Dictionary<string, string> param = new Dictionary<string, string>();
176 param["?uuid"] = uuid.ToStringHyphenated();
177
178 System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
179 System.Data.IDataReader reader = result.ExecuteReader();
180
181 UserAgentData row = database.readAgentRow(reader);
182
183 reader.Close();
184 result.Dispose();
185
186 return row;
187 }
188 }
189 catch (Exception e)
190 {
191 database.Reconnect();
192 Console.WriteLine(e.ToString());
193 return null;
194 }
195 }
196
197 /// <summary>
198 /// Creates a new users profile
199 /// </summary>
200 /// <param name="user">The user profile to create</param>
201 public void addNewUserProfile(UserProfileData user)
202 {
203 }
204
205 /// <summary>
206 /// Creates a new agent
207 /// </summary>
208 /// <param name="agent">The agent to create</param>
209 public void addNewUserAgent(UserAgentData agent)
210 {
211 // Do nothing.
212 }
213
214 /// <summary>
215 /// Performs a money transfer request between two accounts
216 /// </summary>
217 /// <param name="from">The senders account ID</param>
218 /// <param name="to">The recievers account ID</param>
219 /// <param name="amount">The amount to transfer</param>
220 /// <returns>Success?</returns>
221 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
222 {
223 return false;
224 }
225
226 /// <summary>
227 /// Performs an inventory transfer request between two accounts
228 /// </summary>
229 /// <remarks>TODO: Move to inventory server</remarks>
230 /// <param name="from">The senders account ID</param>
231 /// <param name="to">The recievers account ID</param>
232 /// <param name="item">The item to transfer</param>
233 /// <returns>Success?</returns>
234 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
235 {
236 return false;
237 }
238
239 /// <summary>
240 /// Database provider name
241 /// </summary>
242 /// <returns>Provider name</returns>
243 public string getName()
244 {
245 return "MySQL Userdata Interface";
246 }
247
248 /// <summary>
249 /// Database provider version
250 /// </summary>
251 /// <returns>provider version</returns>
252 public string getVersion()
253 {
254 return "0.1";
255 }
256 }
257}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj
new file mode 100644
index 0000000..351de2a
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj
@@ -0,0 +1,237 @@
1<<<<<<< .mine
2<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <ProjectType>Local</ProjectType>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid>
8 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
9 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
10 <ApplicationIcon></ApplicationIcon>
11 <AssemblyKeyContainerName>
12 </AssemblyKeyContainerName>
13 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
14 <DefaultClientScript>JScript</DefaultClientScript>
15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
17 <DelaySign>false</DelaySign>
18 <OutputType>Library</OutputType>
19 <AppDesignerFolder></AppDesignerFolder>
20 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
21 <StartupObject></StartupObject>
22 <FileUpgradeFlags>
23 </FileUpgradeFlags>
24 </PropertyGroup>
25 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
26 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
27 <BaseAddress>285212672</BaseAddress>
28 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
29 <ConfigurationOverrideFile>
30 </ConfigurationOverrideFile>
31 <DefineConstants>TRACE;DEBUG</DefineConstants>
32 <DocumentationFile></DocumentationFile>
33 <DebugSymbols>True</DebugSymbols>
34 <FileAlignment>4096</FileAlignment>
35 <Optimize>False</Optimize>
36 <OutputPath>..\..\bin\</OutputPath>
37 <RegisterForComInterop>False</RegisterForComInterop>
38 <RemoveIntegerChecks>False</RemoveIntegerChecks>
39 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
40 <WarningLevel>4</WarningLevel>
41 <NoWarn></NoWarn>
42 </PropertyGroup>
43 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
44 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
45 <BaseAddress>285212672</BaseAddress>
46 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
47 <ConfigurationOverrideFile>
48 </ConfigurationOverrideFile>
49 <DefineConstants>TRACE</DefineConstants>
50 <DocumentationFile></DocumentationFile>
51 <DebugSymbols>False</DebugSymbols>
52 <FileAlignment>4096</FileAlignment>
53 <Optimize>True</Optimize>
54 <OutputPath>..\..\bin\</OutputPath>
55 <RegisterForComInterop>False</RegisterForComInterop>
56 <RemoveIntegerChecks>False</RemoveIntegerChecks>
57 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
58 <WarningLevel>4</WarningLevel>
59 <NoWarn></NoWarn>
60 </PropertyGroup>
61 <ItemGroup>
62 <Reference Include="System" >
63 <HintPath>System.dll</HintPath>
64 <Private>False</Private>
65 </Reference>
66 <Reference Include="System.Xml" >
67 <HintPath>System.Xml.dll</HintPath>
68 <Private>False</Private>
69 </Reference>
70 <Reference Include="System.Data" >
71 <HintPath>System.Data.dll</HintPath>
72 <Private>False</Private>
73 </Reference>
74 <Reference Include="libsecondlife.dll" >
75 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
76 <Private>False</Private>
77 </Reference>
78 <Reference Include="MySql.Data.dll" >
79 <HintPath>..\..\bin\MySql.Data.dll</HintPath>
80 <Private>False</Private>
81 </Reference>
82 </ItemGroup>
83 <ItemGroup>
84 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
85 <Name>OpenGrid.Framework.Data</Name>
86 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
87 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
88 <Private>False</Private>
89 </ProjectReference>
90 </ItemGroup>
91 <ItemGroup>
92 <Compile Include="MySQLGridData.cs">
93 <SubType>Code</SubType>
94 </Compile>
95 <Compile Include="MySQLInventoryData.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="MySQLLogData.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="MySQLManager.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="MySQLUserData.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="Properties\AssemblyInfo.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 </ItemGroup>
111 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
112 <PropertyGroup>
113 <PreBuildEvent>
114 </PreBuildEvent>
115 <PostBuildEvent>
116 </PostBuildEvent>
117 </PropertyGroup>
118</Project>
119=======
120<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
121 <PropertyGroup>
122 <ProjectType>Local</ProjectType>
123 <ProductVersion>8.0.50727</ProductVersion>
124 <SchemaVersion>2.0</SchemaVersion>
125 <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid>
126 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
127 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
128 <ApplicationIcon></ApplicationIcon>
129 <AssemblyKeyContainerName>
130 </AssemblyKeyContainerName>
131 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
132 <DefaultClientScript>JScript</DefaultClientScript>
133 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
134 <DefaultTargetSchema>IE50</DefaultTargetSchema>
135 <DelaySign>false</DelaySign>
136 <OutputType>Library</OutputType>
137 <AppDesignerFolder></AppDesignerFolder>
138 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
139 <StartupObject></StartupObject>
140 <FileUpgradeFlags>
141 </FileUpgradeFlags>
142 </PropertyGroup>
143 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
144 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
145 <BaseAddress>285212672</BaseAddress>
146 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
147 <ConfigurationOverrideFile>
148 </ConfigurationOverrideFile>
149 <DefineConstants>TRACE;DEBUG</DefineConstants>
150 <DocumentationFile></DocumentationFile>
151 <DebugSymbols>True</DebugSymbols>
152 <FileAlignment>4096</FileAlignment>
153 <Optimize>False</Optimize>
154 <OutputPath>..\..\bin\</OutputPath>
155 <RegisterForComInterop>False</RegisterForComInterop>
156 <RemoveIntegerChecks>False</RemoveIntegerChecks>
157 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
158 <WarningLevel>4</WarningLevel>
159 <NoWarn></NoWarn>
160 </PropertyGroup>
161 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
162 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
163 <BaseAddress>285212672</BaseAddress>
164 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
165 <ConfigurationOverrideFile>
166 </ConfigurationOverrideFile>
167 <DefineConstants>TRACE</DefineConstants>
168 <DocumentationFile></DocumentationFile>
169 <DebugSymbols>False</DebugSymbols>
170 <FileAlignment>4096</FileAlignment>
171 <Optimize>True</Optimize>
172 <OutputPath>..\..\bin\</OutputPath>
173 <RegisterForComInterop>False</RegisterForComInterop>
174 <RemoveIntegerChecks>False</RemoveIntegerChecks>
175 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
176 <WarningLevel>4</WarningLevel>
177 <NoWarn></NoWarn>
178 </PropertyGroup>
179 <ItemGroup>
180 <Reference Include="System" >
181 <HintPath>System.dll</HintPath>
182 <Private>False</Private>
183 </Reference>
184 <Reference Include="System.Xml" >
185 <HintPath>System.Xml.dll</HintPath>
186 <Private>False</Private>
187 </Reference>
188 <Reference Include="System.Data" >
189 <HintPath>System.Data.dll</HintPath>
190 <Private>False</Private>
191 </Reference>
192 <Reference Include="libsecondlife.dll" >
193 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
194 <Private>False</Private>
195 </Reference>
196 <Reference Include="MySql.Data.dll" >
197 <HintPath>..\..\bin\MySql.Data.dll</HintPath>
198 <Private>False</Private>
199 </Reference>
200 </ItemGroup>
201 <ItemGroup>
202 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
203 <Name>OpenGrid.Framework.Data</Name>
204 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
205 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
206 <Private>False</Private>
207 </ProjectReference>
208 </ItemGroup>
209 <ItemGroup>
210 <Compile Include="MySQLInventoryData.cs">
211 <SubType>Code</SubType>
212 </Compile>
213 <Compile Include="MySQLUserData.cs">
214 <SubType>Code</SubType>
215 </Compile>
216 <Compile Include="MySQLManager.cs">
217 <SubType>Code</SubType>
218 </Compile>
219 <Compile Include="MySQLLogData.cs">
220 <SubType>Code</SubType>
221 </Compile>
222 <Compile Include="MySQLGridData.cs">
223 <SubType>Code</SubType>
224 </Compile>
225 <Compile Include="Properties\AssemblyInfo.cs">
226 <SubType>Code</SubType>
227 </Compile>
228 </ItemGroup>
229 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
230 <PropertyGroup>
231 <PreBuildEvent>
232 </PreBuildEvent>
233 <PostBuildEvent>
234 </PostBuildEvent>
235 </PropertyGroup>
236</Project>
237>>>>>>> .r921
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine
new file mode 100644
index 0000000..75ef149
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.mine
@@ -0,0 +1,117 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="MySql.Data.dll" >
78 <HintPath>..\..\bin\MySql.Data.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="MySQLGridData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="MySQLInventoryData.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="MySQLLogData.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="MySQLManager.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 <Compile Include="MySQLUserData.cs">
104 <SubType>Code</SubType>
105 </Compile>
106 <Compile Include="Properties\AssemblyInfo.cs">
107 <SubType>Code</SubType>
108 </Compile>
109 </ItemGroup>
110 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
111 <PropertyGroup>
112 <PreBuildEvent>
113 </PreBuildEvent>
114 <PostBuildEvent>
115 </PostBuildEvent>
116 </PropertyGroup>
117</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858 b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858
new file mode 100644
index 0000000..7a36be2
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r858
@@ -0,0 +1,114 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{C669E5AC-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>False</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>True</Optimize>
35 <OutputPath>../../bin/</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE;DEBUG</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>True</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>False</Optimize>
53 <OutputPath>../../bin/</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="MySql.Data.dll" >
78 <HintPath>..\..\bin\MySql.Data.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="../OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{12DD8EB8-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="MySQLGridData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="MySQLLogData.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="MySQLManager.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="MySQLUserData.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 <Compile Include="Properties/AssemblyInfo.cs">
104 <SubType>Code</SubType>
105 </Compile>
106 </ItemGroup>
107 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
108 <PropertyGroup>
109 <PreBuildEvent>
110 </PreBuildEvent>
111 <PostBuildEvent>
112 </PostBuildEvent>
113 </PropertyGroup>
114</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921 b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921
new file mode 100644
index 0000000..5fe0cf7
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.r921
@@ -0,0 +1,117 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data" >
70 <HintPath>System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="MySql.Data.dll" >
78 <HintPath>..\..\bin\MySql.Data.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
84 <Name>OpenGrid.Framework.Data</Name>
85 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 </ItemGroup>
90 <ItemGroup>
91 <Compile Include="MySQLInventoryData.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 <Compile Include="MySQLUserData.cs">
95 <SubType>Code</SubType>
96 </Compile>
97 <Compile Include="MySQLManager.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="MySQLLogData.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 <Compile Include="MySQLGridData.cs">
104 <SubType>Code</SubType>
105 </Compile>
106 <Compile Include="Properties\AssemblyInfo.cs">
107 <SubType>Code</SubType>
108 </Compile>
109 </ItemGroup>
110 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
111 <PropertyGroup>
112 <PreBuildEvent>
113 </PreBuildEvent>
114 <PostBuildEvent>
115 </PostBuildEvent>
116 </PropertyGroup>
117</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user
new file mode 100644
index 0000000..1b6b14d
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\trunk\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build
new file mode 100644
index 0000000..84d3d56
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build
@@ -0,0 +1,49 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Framework.Data.MySQL" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Framework.Data.MySQL" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="MySQLInventoryData.cs" />
15 <include name="MySQLUserData.cs" />
16 <include name="MySQLManager.cs" />
17 <include name="MySQLLogData.cs" />
18 <include name="MySQLGridData.cs" />
19 <include name="Properties/AssemblyInfo.cs" />
20 </sources>
21 <references basedir="${project::get-base-directory()}">
22 <lib>
23 <include name="${project::get-base-directory()}" />
24 <include name="${project::get-base-directory()}/${build.dir}" />
25 </lib>
26 <include name="System.dll" />
27 <include name="System.Xml.dll" />
28 <include name="System.Data.dll" />
29 <include name="../../bin/OpenGrid.Framework.Data.dll" />
30 <include name="../../bin/libsecondlife.dll" />
31 <include name="../../bin/MySql.Data.dll" />
32 </references>
33 </csc>
34 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
35 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
36 <copy todir="${project::get-base-directory()}/../../bin/">
37 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
38 <include name="*.dll"/>
39 <include name="*.exe"/>
40 </fileset>
41 </copy>
42 </target>
43 <target name="clean">
44 <delete dir="${bin.dir}" failonerror="false" />
45 <delete dir="${obj.dir}" failonerror="false" />
46 </target>
47 <target name="doc" description="Creates documentation.">
48 </target>
49</project>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0bfd1d6
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework.Data.MySQL")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenGrid.Framework.Data.MySQL")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]