aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Framework.Data.MySQL
diff options
context:
space:
mode:
authorAdam Frisby2007-05-14 16:13:31 +0000
committerAdam Frisby2007-05-14 16:13:31 +0000
commit3ee195b1e6ff02715c132da431152276b464eaec (patch)
treefda9a5d2817e61894b5c567695cf3c387aa9023b /OpenGrid.Framework.Data.MySQL
parentUnbreaking trunk kthxbai! (diff)
downloadopensim-SC_OLD-3ee195b1e6ff02715c132da431152276b464eaec.zip
opensim-SC_OLD-3ee195b1e6ff02715c132da431152276b464eaec.tar.gz
opensim-SC_OLD-3ee195b1e6ff02715c132da431152276b464eaec.tar.bz2
opensim-SC_OLD-3ee195b1e6ff02715c132da431152276b464eaec.tar.xz
* Commented out GridManager lines until they are checked into SVN
* Added new GetProfilesInRange(x,y,x,y) data function to return sim profiles between certain coordinates (for use with World Map information, etc). Implemented in GridServer.Data.Mysql - stub functions placed in other data providers.
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL')
-rw-r--r--OpenGrid.Framework.Data.MySQL/MySQLGridData.cs39
-rw-r--r--OpenGrid.Framework.Data.MySQL/MySQLManager.cs1
2 files changed, 38 insertions, 2 deletions
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;