aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Framework.Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGrid.Framework.Data.DB4o/DB4oGridData.cs5
-rw-r--r--OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs5
-rw-r--r--OpenGrid.Framework.Data.MySQL/MySQLGridData.cs39
-rw-r--r--OpenGrid.Framework.Data.MySQL/MySQLManager.cs1
-rw-r--r--OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs5
-rw-r--r--OpenGrid.Framework.Data/GridData.cs10
6 files changed, 63 insertions, 2 deletions
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
index caf7eb0..546713e 100644
--- a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
+++ b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
@@ -15,6 +15,11 @@ namespace OpenGrid.Framework.Data.DB4o
15 manager = new DB4oGridManager("gridserver.yap"); 15 manager = new DB4oGridManager("gridserver.yap");
16 } 16 }
17 17
18 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
19 {
20 return null;
21 }
22
18 public SimProfileData GetProfileByHandle(ulong handle) { 23 public SimProfileData GetProfileByHandle(ulong handle) {
19 lock (manager.simProfiles) 24 lock (manager.simProfiles)
20 { 25 {
diff --git a/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
index 8a93d40..0925df1 100644
--- a/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
+++ b/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs
@@ -35,6 +35,11 @@ namespace OpenGrid.Framework.Data.MSSQL
35 return "0.1"; 35 return "0.1";
36 } 36 }
37 37
38 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
39 {
40 return null;
41 }
42
38 /// <summary> 43 /// <summary>
39 /// Returns a sim profile from it's location 44 /// Returns a sim profile from it's location
40 /// </summary> 45 /// </summary>
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
index 3dceff6..46183b4 100644
--- a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
+++ b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -14,7 +14,7 @@ namespace OpenGrid.Framework.Data.MySQL
14 /// </summary> 14 /// </summary>
15 public void Initialise() 15 public void Initialise()
16 { 16 {
17 database = new MySQLManager("server", "database", "username", "password", "false"); 17 database = new MySQLManager("localhost", "database", "username", "password", "false");
18 } 18 }
19 19
20 /// <summary> 20 /// <summary>
@@ -35,6 +35,43 @@ namespace OpenGrid.Framework.Data.MySQL
35 return "0.1"; 35 return "0.1";
36 } 36 }
37 37
38 public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
39 {
40 try
41 {
42 lock (database)
43 {
44 Dictionary<string, string> param = new Dictionary<string, string>();
45 param["?xmin"] = xmin.ToString();
46 param["?ymin"] = ymin.ToString();
47 param["?xmax"] = xmax.ToString();
48 param["?ymax"] = ymax.ToString();
49
50 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
51 System.Data.IDataReader reader = result.ExecuteReader();
52
53 SimProfileData row;
54
55 List<SimProfileData> rows = new List<SimProfileData>();
56
57 while ((row = database.getSimRow(reader)) != null)
58 {
59 rows.Add(row);
60 }
61 reader.Close();
62 result.Dispose();
63
64 return rows.ToArray();
65
66 }
67 }
68 catch (Exception e)
69 {
70 Console.WriteLine(e.ToString());
71 return null;
72 }
73 }
74
38 /// <summary> 75 /// <summary>
39 /// Returns a sim profile from it's location 76 /// Returns a sim profile from it's location
40 /// </summary> 77 /// </summary>
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
index 7461b14..e4622a8 100644
--- a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
+++ b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -121,7 +121,6 @@ namespace OpenGrid.Framework.Data.MySQL
121 } 121 }
122 else 122 else
123 { 123 {
124 throw new Exception("Unable to find region at coordinates");
125 return null; 124 return null;
126 } 125 }
127 return retval; 126 return retval;
diff --git a/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
index 02e153f..4850f12 100644
--- a/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
+++ b/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs
@@ -35,6 +35,11 @@ namespace OpenGrid.Framework.Data.SQLite
35 return "0.1"; 35 return "0.1";
36 } 36 }
37 37
38 public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
39 {
40 return null;
41 }
42
38 /// <summary> 43 /// <summary>
39 /// Returns a sim profile from it's location 44 /// Returns a sim profile from it's location
40 /// </summary> 45 /// </summary>
diff --git a/OpenGrid.Framework.Data/GridData.cs b/OpenGrid.Framework.Data/GridData.cs
index d5516b2..6dad37e 100644
--- a/OpenGrid.Framework.Data/GridData.cs
+++ b/OpenGrid.Framework.Data/GridData.cs
@@ -32,6 +32,16 @@ namespace OpenGrid.Framework.Data
32 SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID); 32 SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID);
33 33
34 /// <summary> 34 /// <summary>
35 /// Returns all profiles within the specified range
36 /// </summary>
37 /// <param name="Xmin">Minimum sim coordinate (X)</param>
38 /// <param name="Ymin">Minimum sim coordinate (Y)</param>
39 /// <param name="Xmax">Maximum sim coordinate (X)</param>
40 /// <param name="Ymin">Maximum sim coordinate (Y)</param>
41 /// <returns>An array containing all the sim profiles in the specified range</returns>
42 SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
43
44 /// <summary>
35 /// Authenticates a sim by use of it's recv key. 45 /// Authenticates a sim by use of it's recv key.
36 /// WARNING: Insecure 46 /// WARNING: Insecure
37 /// </summary> 47 /// </summary>