aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.SQLite
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.SQLite')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs53
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs10
2 files changed, 63 insertions, 0 deletions
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 @@
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;
@@ -5,8 +31,14 @@ using OpenGrid.Framework.Data;
5 31
6namespace OpenGrid.Framework.Data.SQLite 32namespace OpenGrid.Framework.Data.SQLite
7{ 33{
34 /// <summary>
35 /// A Grid Interface to the SQLite database
36 /// </summary>
8 public class SQLiteGridData : IGridData 37 public class SQLiteGridData : IGridData
9 { 38 {
39 /// <summary>
40 /// A database manager
41 /// </summary>
10 private SQLiteManager database; 42 private SQLiteManager database;
11 43
12 /// <summary> 44 /// <summary>
@@ -25,16 +57,32 @@ namespace OpenGrid.Framework.Data.SQLite
25 database.Close(); 57 database.Close();
26 } 58 }
27 59
60 /// <summary>
61 /// Returns the name of this grid interface
62 /// </summary>
63 /// <returns>A string containing the grid interface</returns>
28 public string getName() 64 public string getName()
29 { 65 {
30 return "SQLite OpenGridData"; 66 return "SQLite OpenGridData";
31 } 67 }
32 68
69 /// <summary>
70 /// Returns the version of this grid interface
71 /// </summary>
72 /// <returns>A string containing the version</returns>
33 public string getVersion() 73 public string getVersion()
34 { 74 {
35 return "0.1"; 75 return "0.1";
36 } 76 }
37 77
78 /// <summary>
79 /// Returns a list of regions within the specified ranges
80 /// </summary>
81 /// <param name="a">minimum X coordinate</param>
82 /// <param name="b">minimum Y coordinate</param>
83 /// <param name="c">maximum X coordinate</param>
84 /// <param name="d">maximum Y coordinate</param>
85 /// <returns>An array of region profiles</returns>
38 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) 86 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
39 { 87 {
40 return null; 88 return null;
@@ -80,6 +128,11 @@ namespace OpenGrid.Framework.Data.SQLite
80 return row; 128 return row;
81 } 129 }
82 130
131 /// <summary>
132 /// Adds a new specified region to the database
133 /// </summary>
134 /// <param name="profile">The profile to add</param>
135 /// <returns>A dataresponse enum indicating success</returns>
83 public DataResponse AddProfile(SimProfileData profile) 136 public DataResponse AddProfile(SimProfileData profile)
84 { 137 {
85 if (database.insertRow(profile)) 138 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
64 return (IDbCommand)dbcommand; 64 return (IDbCommand)dbcommand;
65 } 65 }
66 66
67 /// <summary>
68 /// Reads a region row from a database reader
69 /// </summary>
70 /// <param name="reader">An active database reader</param>
71 /// <returns>A region profile</returns>
67 public SimProfileData getRow(IDataReader reader) 72 public SimProfileData getRow(IDataReader reader)
68 { 73 {
69 SimProfileData retval = new SimProfileData(); 74 SimProfileData retval = new SimProfileData();
@@ -115,6 +120,11 @@ namespace OpenGrid.Framework.Data.SQLite
115 return retval; 120 return retval;
116 } 121 }
117 122
123 /// <summary>
124 /// Inserts a new region into the database
125 /// </summary>
126 /// <param name="profile">The region to insert</param>
127 /// <returns>Success?</returns>
118 public bool insertRow(SimProfileData profile) 128 public bool insertRow(SimProfileData profile)
119 { 129 {
120 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 130 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";