mirror of
https://github.com/opensim/opensim.git
synced 2026-06-22 22:00:01 +08:00
* 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.
This commit is contained in:
@@ -14,7 +14,7 @@ namespace OpenGrid.Framework.Data.MySQL
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
{
|
||||
database = new MySQLManager("server", "database", "username", "password", "false");
|
||||
database = new MySQLManager("localhost", "database", "username", "password", "false");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,6 +35,43 @@ namespace OpenGrid.Framework.Data.MySQL
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (database)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?xmin"] = xmin.ToString();
|
||||
param["?ymin"] = ymin.ToString();
|
||||
param["?xmax"] = xmax.ToString();
|
||||
param["?ymax"] = ymax.ToString();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
|
||||
SimProfileData row;
|
||||
|
||||
List<SimProfileData> rows = new List<SimProfileData>();
|
||||
|
||||
while ((row = database.getSimRow(reader)) != null)
|
||||
{
|
||||
rows.Add(row);
|
||||
}
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return rows.ToArray();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from it's location
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user