* Added the ability to type the partial name of a region in the start location box and go to that region if it's there. If no close match was found, it sends you home. This is tested on mySQL. There's untested code on grids that are based on sqlite and MSSQL. The SQL statements *should* be right, but your results may very.

* Ex, if you want to go to Wright Plaza, you simply need to type Wright Plaza in the start location in the client when you log-in.
This commit is contained in:
Teravus Ovares
2008-03-18 05:44:25 +00:00
parent 47180080f0
commit 42857fe4e9
13 changed files with 338 additions and 5 deletions

View File

@@ -248,6 +248,47 @@ namespace OpenSim.Framework.Data.MySQL
}
}
/// <summary>
/// Returns a sim profile from it's Region name string
/// </summary>
/// <param name="uuid">The region name search query</param>
/// <returns>The sim profile</returns>
public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
try
{
lock (database)
{
Dictionary<string, string> param = new Dictionary<string, string>();
// Add % because this is a like query.
param["?regionName"] = regionName + "%";
// Order by statement will return shorter matches first. Only returns one record or no record.
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1", param);
IDataReader reader = result.ExecuteReader();
RegionProfileData row = database.readSimRow(reader);
reader.Close();
result.Dispose();
return row;
}
}
catch (Exception e)
{
database.Reconnect();
m_log.Error(e.ToString());
return null;
}
}
else
{
m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
return null;
}
}
/// <summary>
/// Adds a new profile to the database
/// </summary>