diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index 1155ae3..26a8591 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs | |||
@@ -283,6 +283,52 @@ namespace OpenSim.Data.MySQL | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /// <summary> | 285 | /// <summary> |
286 | /// Returns up to maxNum profiles of regions that have a name starting with namePrefix | ||
287 | /// </summary> | ||
288 | /// <param name="name">The name to match against</param> | ||
289 | /// <param name="maxNum">Maximum number of profiles to return</param> | ||
290 | /// <returns>A list of sim profiles</returns> | ||
291 | override public List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum) | ||
292 | { | ||
293 | MySQLSuperManager dbm = GetLockedConnection(); | ||
294 | |||
295 | try | ||
296 | { | ||
297 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
298 | param["?name"] = namePrefix + "%"; | ||
299 | |||
300 | IDbCommand result = | ||
301 | dbm.Manager.Query( | ||
302 | "SELECT * FROM regions WHERE regionName LIKE ?name", | ||
303 | param); | ||
304 | IDataReader reader = result.ExecuteReader(); | ||
305 | |||
306 | RegionProfileData row; | ||
307 | |||
308 | List<RegionProfileData> rows = new List<RegionProfileData>(); | ||
309 | |||
310 | while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null) | ||
311 | { | ||
312 | rows.Add(row); | ||
313 | } | ||
314 | reader.Close(); | ||
315 | result.Dispose(); | ||
316 | |||
317 | return rows; | ||
318 | } | ||
319 | catch (Exception e) | ||
320 | { | ||
321 | dbm.Manager.Reconnect(); | ||
322 | m_log.Error(e.ToString()); | ||
323 | return null; | ||
324 | } | ||
325 | finally | ||
326 | { | ||
327 | dbm.Release(); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | /// <summary> | ||
286 | /// Returns a sim profile from it's location | 332 | /// Returns a sim profile from it's location |
287 | /// </summary> | 333 | /// </summary> |
288 | /// <param name="handle">Region location handle</param> | 334 | /// <param name="handle">Region location handle</param> |