From 3d0a820da9672033222e44864724a5e2040ce179 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 2 Jun 2007 00:44:23 +0000 Subject: * Documented SQLite grid interfaces --- .../SQLiteGridData.cs | 53 ++++++++++++++++++++++ .../SQLiteManager.cs | 10 ++++ 2 files changed, 63 insertions(+) diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs index 4850f12..a67b2cd 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs @@ -1,3 +1,29 @@ +/* +* Copyright (c) OpenSim project, http://sim.opensecondlife.org/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ using System; using System.Collections.Generic; using System.Text; @@ -5,8 +31,14 @@ using OpenGrid.Framework.Data; namespace OpenGrid.Framework.Data.SQLite { + /// + /// A Grid Interface to the SQLite database + /// public class SQLiteGridData : IGridData { + /// + /// A database manager + /// private SQLiteManager database; /// @@ -25,16 +57,32 @@ namespace OpenGrid.Framework.Data.SQLite database.Close(); } + /// + /// Returns the name of this grid interface + /// + /// A string containing the grid interface public string getName() { return "SQLite OpenGridData"; } + /// + /// Returns the version of this grid interface + /// + /// A string containing the version public string getVersion() { return "0.1"; } + /// + /// Returns a list of regions within the specified ranges + /// + /// minimum X coordinate + /// minimum Y coordinate + /// maximum X coordinate + /// maximum Y coordinate + /// An array of region profiles public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) { return null; @@ -80,6 +128,11 @@ namespace OpenGrid.Framework.Data.SQLite return row; } + /// + /// Adds a new specified region to the database + /// + /// The profile to add + /// A dataresponse enum indicating success public DataResponse AddProfile(SimProfileData profile) { if (database.insertRow(profile)) diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs index 408a582..7da16db 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs @@ -64,6 +64,11 @@ namespace OpenGrid.Framework.Data.SQLite return (IDbCommand)dbcommand; } + /// + /// Reads a region row from a database reader + /// + /// An active database reader + /// A region profile public SimProfileData getRow(IDataReader reader) { SimProfileData retval = new SimProfileData(); @@ -115,6 +120,11 @@ namespace OpenGrid.Framework.Data.SQLite return retval; } + /// + /// Inserts a new region into the database + /// + /// The region to insert + /// Success? public bool insertRow(SimProfileData profile) { string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; -- cgit v1.1