diff options
author | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
commit | 16d68749a457acf079a6737f4ca9a9adb9e53e2f (patch) | |
tree | 901b2c31e53eeb97f30ac46f2b7f406a01e1755a /OpenSim/Data/MySQL/MySQLGridData.cs | |
parent | Fix: Mantis#2326: Fix: privilege escalation through attach from ground (diff) | |
download | opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.zip opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.gz opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.bz2 opensim-SC-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.xz |
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.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLGridData.cs')
-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> |