aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-06-02 00:37:31 +0000
committerAdam Frisby2007-06-02 00:37:31 +0000
commit55f7fe0ae3d979cb0988f385bfee27b8c7f75820 (patch)
treea180507b45bdf2492e9c08b9da6adbc830202409 /OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
parent* MS-SQL Interface is now well documented (and probably defunct) (diff)
downloadopensim-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/MySQLManager.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs125
1 files changed, 100 insertions, 25 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
index 9fbdffb..6ddd02c 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.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*/
1using System; 27using System;
2using System.Collections.Generic; 28using System.Collections.Generic;
3using System.Text; 29using System.Text;
@@ -13,9 +39,18 @@ using OpenGrid.Framework.Data;
13 39
14namespace OpenGrid.Framework.Data.MySQL 40namespace OpenGrid.Framework.Data.MySQL
15{ 41{
42 /// <summary>
43 /// A MySQL Database manager
44 /// </summary>
16 class MySQLManager 45 class MySQLManager
17 { 46 {
47 /// <summary>
48 /// The database connection object
49 /// </summary>
18 IDbConnection dbcon; 50 IDbConnection dbcon;
51 /// <summary>
52 /// Connection string for ADO.net
53 /// </summary>
19 string connectionString; 54 string connectionString;
20 55
21 /// <summary> 56 /// <summary>
@@ -137,6 +172,11 @@ namespace OpenGrid.Framework.Data.MySQL
137 } 172 }
138 } 173 }
139 174
175 /// <summary>
176 /// Reads a region row from a database reader
177 /// </summary>
178 /// <param name="reader">An active database reader</param>
179 /// <returns>A region profile</returns>
140 public SimProfileData readSimRow(IDataReader reader) 180 public SimProfileData readSimRow(IDataReader reader)
141 { 181 {
142 SimProfileData retval = new SimProfileData(); 182 SimProfileData retval = new SimProfileData();
@@ -199,6 +239,11 @@ namespace OpenGrid.Framework.Data.MySQL
199 return retval; 239 return retval;
200 } 240 }
201 241
242 /// <summary>
243 /// Reads an agent row from a database reader
244 /// </summary>
245 /// <param name="reader">An active database reader</param>
246 /// <returns>A user session agent</returns>
202 public UserAgentData readAgentRow(IDataReader reader) 247 public UserAgentData readAgentRow(IDataReader reader)
203 { 248 {
204 UserAgentData retval = new UserAgentData(); 249 UserAgentData retval = new UserAgentData();
@@ -231,6 +276,11 @@ namespace OpenGrid.Framework.Data.MySQL
231 return retval; 276 return retval;
232 } 277 }
233 278
279 /// <summary>
280 /// Reads a user profile from an active data reader
281 /// </summary>
282 /// <param name="reader">An active database reader</param>
283 /// <returns>A user profile</returns>
234 public UserProfileData readUserRow(IDataReader reader) 284 public UserProfileData readUserRow(IDataReader reader)
235 { 285 {
236 UserProfileData retval = new UserProfileData(); 286 UserProfileData retval = new UserProfileData();
@@ -344,6 +394,16 @@ namespace OpenGrid.Framework.Data.MySQL
344 return rows; 394 return rows;
345 } 395 }
346 396
397 /// <summary>
398 /// Inserts a new row into the log database
399 /// </summary>
400 /// <param name="serverDaemon">The daemon which triggered this event</param>
401 /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param>
402 /// <param name="methodCall">The method call where the problem occured</param>
403 /// <param name="arguments">The arguments passed to the method</param>
404 /// <param name="priority">How critical is this?</param>
405 /// <param name="logMessage">Extra message info</param>
406 /// <returns>Saved successfully?</returns>
347 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 407 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
348 { 408 {
349 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; 409 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
@@ -377,6 +437,11 @@ namespace OpenGrid.Framework.Data.MySQL
377 return returnval; 437 return returnval;
378 } 438 }
379 439
440 /// <summary>
441 /// Inserts a new item into the database
442 /// </summary>
443 /// <param name="item">The item</param>
444 /// <returns>Success?</returns>
380 public bool insertItem(InventoryItemBase item) 445 public bool insertItem(InventoryItemBase item)
381 { 446 {
382 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; 447 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
@@ -413,6 +478,11 @@ namespace OpenGrid.Framework.Data.MySQL
413 return returnval; 478 return returnval;
414 } 479 }
415 480
481 /// <summary>
482 /// Inserts a new folder into the database
483 /// </summary>
484 /// <param name="folder">The folder</param>
485 /// <returns>Success?</returns>
416 public bool insertFolder(InventoryFolderBase folder) 486 public bool insertFolder(InventoryFolderBase folder)
417 { 487 {
418 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; 488 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
@@ -442,7 +512,12 @@ namespace OpenGrid.Framework.Data.MySQL
442 return returnval; 512 return returnval;
443 } 513 }
444 514
445 public bool insertRow(SimProfileData profile) 515 /// <summary>
516 /// Inserts a new region into the database
517 /// </summary>
518 /// <param name="profile">The region to insert</param>
519 /// <returns>Success?</returns>
520 public bool insertRegion(SimProfileData regiondata)
446 { 521 {
447 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 522 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
448 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 523 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
@@ -454,30 +529,30 @@ namespace OpenGrid.Framework.Data.MySQL
454 529
455 Dictionary<string, string> parameters = new Dictionary<string, string>(); 530 Dictionary<string, string> parameters = new Dictionary<string, string>();
456 531
457 parameters["?regionHandle"] = profile.regionHandle.ToString(); 532 parameters["?regionHandle"] = regiondata.regionHandle.ToString();
458 parameters["?regionName"] = profile.regionName.ToString(); 533 parameters["?regionName"] = regiondata.regionName.ToString();
459 parameters["?uuid"] = profile.UUID.ToStringHyphenated(); 534 parameters["?uuid"] = regiondata.UUID.ToStringHyphenated();
460 parameters["?regionRecvKey"] = profile.regionRecvKey.ToString(); 535 parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString();
461 parameters["?regionSecret"] = profile.regionSecret.ToString(); 536 parameters["?regionSecret"] = regiondata.regionSecret.ToString();
462 parameters["?regionSendKey"] = profile.regionSendKey.ToString(); 537 parameters["?regionSendKey"] = regiondata.regionSendKey.ToString();
463 parameters["?regionDataURI"] = profile.regionDataURI.ToString(); 538 parameters["?regionDataURI"] = regiondata.regionDataURI.ToString();
464 parameters["?serverIP"] = profile.serverIP.ToString(); 539 parameters["?serverIP"] = regiondata.serverIP.ToString();
465 parameters["?serverPort"] = profile.serverPort.ToString(); 540 parameters["?serverPort"] = regiondata.serverPort.ToString();
466 parameters["?serverURI"] = profile.serverURI.ToString(); 541 parameters["?serverURI"] = regiondata.serverURI.ToString();
467 parameters["?locX"] = profile.regionLocX.ToString(); 542 parameters["?locX"] = regiondata.regionLocX.ToString();
468 parameters["?locY"] = profile.regionLocY.ToString(); 543 parameters["?locY"] = regiondata.regionLocY.ToString();
469 parameters["?locZ"] = profile.regionLocZ.ToString(); 544 parameters["?locZ"] = regiondata.regionLocZ.ToString();
470 parameters["?eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); 545 parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString();
471 parameters["?westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); 546 parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString();
472 parameters["?northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); 547 parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString();
473 parameters["?southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); 548 parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString();
474 parameters["?regionAssetURI"] = profile.regionAssetURI.ToString(); 549 parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString();
475 parameters["?regionAssetRecvKey"] = profile.regionAssetRecvKey.ToString(); 550 parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString();
476 parameters["?regionAssetSendKey"] = profile.regionAssetSendKey.ToString(); 551 parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString();
477 parameters["?regionUserURI"] = profile.regionUserURI.ToString(); 552 parameters["?regionUserURI"] = regiondata.regionUserURI.ToString();
478 parameters["?regionUserRecvKey"] = profile.regionUserRecvKey.ToString(); 553 parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString();
479 parameters["?regionUserSendKey"] = profile.regionUserSendKey.ToString(); 554 parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString();
480 parameters["?regionMapTexture"] = profile.regionMapTextureID.ToStringHyphenated(); 555 parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated();
481 556
482 bool returnval = false; 557 bool returnval = false;
483 558