aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-03-18 05:44:25 +0000
committerTeravus Ovares2008-03-18 05:44:25 +0000
commit42857fe4e9e898c8e350da2f9acb3b252b31694a (patch)
treede55ab7f5d6d6e1bb127a39f6e97f67e4e442cf4 /OpenSim/Framework/Data.MySQL/MySQLGridData.cs
parentFormatting cleanup. (diff)
downloadopensim-SC_OLD-42857fe4e9e898c8e350da2f9acb3b252b31694a.zip
opensim-SC_OLD-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.gz
opensim-SC_OLD-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.bz2
opensim-SC_OLD-42857fe4e9e898c8e350da2f9acb3b252b31694a.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLGridData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 584d49c..3855d99 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -249,6 +249,47 @@ namespace OpenSim.Framework.Data.MySQL
249 } 249 }
250 250
251 /// <summary> 251 /// <summary>
252 /// Returns a sim profile from it's Region name string
253 /// </summary>
254 /// <param name="uuid">The region name search query</param>
255 /// <returns>The sim profile</returns>
256 public RegionProfileData GetProfileByString(string regionName)
257 {
258 if (regionName.Length > 2)
259 {
260 try
261 {
262 lock (database)
263 {
264 Dictionary<string, string> param = new Dictionary<string, string>();
265 // Add % because this is a like query.
266 param["?regionName"] = regionName + "%";
267 // Order by statement will return shorter matches first. Only returns one record or no record.
268 IDbCommand result = database.Query("SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1", param);
269 IDataReader reader = result.ExecuteReader();
270
271 RegionProfileData row = database.readSimRow(reader);
272 reader.Close();
273 result.Dispose();
274
275 return row;
276 }
277 }
278 catch (Exception e)
279 {
280 database.Reconnect();
281 m_log.Error(e.ToString());
282 return null;
283 }
284 }
285 else
286 {
287 m_log.Error("[DATABASE]: Searched for a Region Name shorter then 3 characters");
288 return null;
289 }
290 }
291
292 /// <summary>
252 /// Adds a new profile to the database 293 /// Adds a new profile to the database
253 /// </summary> 294 /// </summary>
254 /// <param name="profile">The profile to add</param> 295 /// <param name="profile">The profile to add</param>