From 16d68749a457acf079a6737f4ca9a9adb9e53e2f Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Fri, 3 Oct 2008 23:00:42 +0000 Subject: 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. --- OpenSim/Data/MySQL/MySQLGridData.cs | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'OpenSim/Data/MySQL/MySQLGridData.cs') 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 } /// + /// Returns up to maxNum profiles of regions that have a name starting with namePrefix + /// + /// The name to match against + /// Maximum number of profiles to return + /// A list of sim profiles + override public List GetRegionsByName(string namePrefix, uint maxNum) + { + MySQLSuperManager dbm = GetLockedConnection(); + + try + { + Dictionary param = new Dictionary(); + param["?name"] = namePrefix + "%"; + + IDbCommand result = + dbm.Manager.Query( + "SELECT * FROM regions WHERE regionName LIKE ?name", + param); + IDataReader reader = result.ExecuteReader(); + + RegionProfileData row; + + List rows = new List(); + + 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(); + } + } + + /// /// Returns a sim profile from it's location /// /// Region location handle -- cgit v1.1