mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
Add the missing bits for the new region-search:
- Added lookup in the data-layer - MySQL works - SQLite doesn't have a grid-db, so it won't work there - I added MSSQL-code to the best of my knowledge; but I don't know MSSQL :-) - Added the plumbing up to OGS1GridServices. This speaks with the grid-server via XMLRPC. - Modified MapSearchModule to use the new data. It's backward compatible; if used with an old grid-server, it just returns one found region instead of a list. - Refactored a bit. Note: This updates data, grid-server and region code. No new files.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Data
|
||||
@@ -35,6 +36,7 @@ namespace OpenSim.Data
|
||||
public abstract RegionProfileData GetProfileByUUID(UUID UUID);
|
||||
public abstract RegionProfileData GetProfileByString(string regionName);
|
||||
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
|
||||
public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
|
||||
public abstract DataResponse AddProfile(RegionProfileData profile);
|
||||
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
|
||||
@@ -44,6 +46,7 @@ namespace OpenSim.Data
|
||||
public abstract void Initialise();
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract void Dispose();
|
||||
|
||||
public abstract string Name { get; }
|
||||
public abstract string Version { get; }
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -79,6 +80,14 @@ namespace OpenSim.Data
|
||||
/// <returns>An array containing all the sim profiles in the specified range</returns>
|
||||
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="name">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
|
||||
|
||||
/// <summary>
|
||||
/// Authenticates a sim by use of its recv key.
|
||||
/// WARNING: Insecure
|
||||
|
||||
@@ -216,6 +216,33 @@ namespace OpenSim.Data.MSSQL
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="name">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
|
||||
{
|
||||
using (AutoClosingSqlCommand command = database.Query("SELECT * FROM regions WHERE regionName LIKE @name"))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("name", namePrefix + "%"));
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
while (rows.Count < maxNum && reader.Read())
|
||||
{
|
||||
rows.Add(ReadSimRow(reader));
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from its location
|
||||
/// </summary>
|
||||
|
||||
@@ -282,6 +282,52 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="name">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
override public List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?name"] = namePrefix + "%";
|
||||
|
||||
IDbCommand result =
|
||||
dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE regionName LIKE ?name",
|
||||
param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row;
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
|
||||
{
|
||||
rows.Add(row);
|
||||
}
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return rows;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from it's location
|
||||
/// </summary>
|
||||
|
||||
@@ -108,6 +108,18 @@ namespace OpenSim.Data.SQLite
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns up to maxNum profiles of regions that have a name starting with namePrefix
|
||||
/// </summary>
|
||||
/// <param name="name">The name to match against</param>
|
||||
/// <param name="maxNum">Maximum number of profiles to return</param>
|
||||
/// <returns>A list of sim profiles</returns>
|
||||
override public List<RegionProfileData> GetRegionsByName (string namePrefix, uint maxNum)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from it's handle
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user